Data Models & Typings
Relevant source files
The following files were used as context for generating this wiki page:
Data Models & Typings define the foundational structures for the Agent Studio ecosystem. This system manages interactions between Large Language Model (LLM) providers, the Model Context Protocol (MCP), and local workspace environments. These typings ensure type safety and consistent data flow across the chat interface, file explorer, and plugin registry.
The architecture centralizes state management around sessions, which encapsulate messages, model configurations, and provider settings. This structure supports both local providers like Ollama and remote services like OpenAI or Gemini.
Core Domain Models
The application relies on several core interfaces to manage the AI workspace. These include Session for conversation state, LLMProvider for connection details, and VirtualFile for the simulated filesystem.
Session and Messages
A Session represents an active conversation stream. It tracks the selected model, provider, and technical parameters such as temperature and token limits.
LLM Providers
The LLMProvider interface defines how the application connects to various inference engines. The system supports local, remote, and custom types.
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (e.g., 'ollama', 'openai') |
name | string | Display name in the UI |
type | string | Provider category: local, remote, or custom |
baseUrl | string | The API endpoint URL |
models | string[] | List of available model strings |
selectedModel | string | The currently active model |
Sources: src/data.ts:3-56
Model Context Protocol (MCP) Structures
The Model Context Protocol (MCP) enables LLMs to interact with external tools and services. The MCPConfig structure maps these tools and their input schemas to the agent's context.
MCP Configuration and Tools
MCP servers expose specific tools that the agent can invoke. Each tool includes an inputSchema that defines the expected JSON parameters for execution.
Tool Call Lifecycle
When an LLM decides to use an MCP tool, it generates a toolCall object. The application tracks the status of these calls through pending, success, and failed states.
- read_filesystem_file: Accesses textual content from the workspace.
- query_web_search: Retrieves information via Brave or Google search indexes.
- list_filesystem_dir: Enumerates directory contents for workspace mapping.
Sources: src/utils/ai.ts:77-128, src/data.ts:119-145
Workspace Filesystem Models
The VirtualFile model represents items within the integrated file explorer. It facilitates local file editing and provides context for LLM prompts through attachments.
VirtualFile Specification
Files are managed as objects within a flat array or nested structure, distinguished by the isDir flag.
| Property | Type | Description |
|---|---|---|
id | string | Unique file identifier |
name | string | The filename including extension |
path | string | Absolute path within the virtual root |
content | string | The raw text payload of the file |
size | number | Size in bytes |
isDir | boolean | Identifies if the object is a directory |
Sources: src/types.ts, src/components/ExplorerFS.tsx:55-70, src/data.ts:252-314
System Prompt and Skill Plugins
The application uses PromptPreset to define system behaviors and SkillPlugin to handle specific UI/UX rendering tasks like SVG or LaTeX.
Behavior Patterns
Prompt presets are categorized to help the user select the appropriate "personality" or "expert mode" for the agent.
Skill Runtimes
Skills are plugins that intercept LLM output to render specialized components in the Sandbox Workspace.
- Graphics:
Visual SVG Sandboxrenders vector drawings. - Math:
LaTeX Mathematical Typesetterformats equations. - Utility:
JS / Code Playgroundexecutes logic in a secure runtime.
Sources: src/data.ts:197-228, src/components/ChatArea.tsx:501-570
Conclusion
The data models in Agent Studio create a strictly typed bridge between user interfaces and AI backends. By structuring Sessions, MCPConfigs, and VirtualFiles consistently, the system enables complex workflows including tool-calling, multi-model support, and real-time sandbox rendering. This architectural clarity allows developers to extend the project with new providers or skill plugins while maintaining state integrity.