AI Framework Guides & Integrations
Relevant source files
The following files were used as context for generating this wiki page:
- guides/typescript/mastra/coding-agent/openai/src/mastra/agents/coding-agent.ts
- guides/typescript/mastra/coding-agent/openai/README.md
- guides/typescript/anthropic/multi-agent-claude-sdk/README.md
- guides/typescript/agentkit-inngest/coding-agent/anthropic/README.md
- guides/python/recursive-language-models/rlm/prompts.py
- guides/python/ai-data-analyst/openai/README.md
- guides/typescript/openai/codex-sdk/README.md
The AI Framework Guides & Integrations section provides a comprehensive set of implementations and architectural patterns for deploying AI agents within secure Daytona sandboxes. These integrations enable LLMs to perform complex software engineering, data analysis, and multi-agent coordination tasks by leveraging Daytona's isolated execution environments.
The primary purpose of these integrations is to bridge the gap between AI reasoning and physical code execution. By providing specialized toolsets for sandbox management, file operations, and shell execution, Daytona allows frameworks like Mastra, AgentKit, and the Claude Agent SDK to interact safely with real-world development environments.
Sources: guides/typescript/mastra/coding-agent/openai/README.md, guides/typescript/anthropic/multi-agent-claude-sdk/README.md
Core Integration Patterns
Multi-Agent Hierarchical Architecture
The project demonstrates a hierarchical "Two-Agent" system designed to separate high-level planning from low-level execution. In this architecture, a Project Manager Agent runs locally to orchestrate tasks, while a Developer Agent operates within a Daytona sandbox.
The Project Manager uses specialized XML-like tags (<developer_task>) to delegate work, and the Developer Agent uses the Claude Agent SDK within the sandbox to perform file operations and start services.
Sources: guides/typescript/anthropic/multi-agent-claude-sdk/README.md
Tool-Based Agentic Frameworks (Mastra & AgentKit)
Integrations with frameworks like Mastra and Inngest's AgentKit focus on providing the agent with a "Sandbox Toolkit." This toolkit includes atomic operations that the agent can call to manage its environment.
| Tool Category | Key Functions | Purpose |
|---|---|---|
| Sandbox Mgmt | createSandbox | Initialize isolated execution environments |
| Execution | runCode, runCommand | Execute Python/JS/TS or shell commands with real-time output |
| File Ops | writeFile, writeFiles, readFile | CRUD operations and batch file creation |
| Monitoring | watchDirectory, getFileInfo | Live tracking of filesystem changes and metadata |
Sources: guides/typescript/mastra/coding-agent/openai/src/mastra/agents/coding-agent.ts:25-56, guides/typescript/mastra/coding-agent/openai/README.md
Specialized AI Workflows
Recursive Language Model (RLM) Agents
The RLM integration uses a recursive spawning pattern where a parent agent can create sub-agents to handle complex sub-tasks in parallel. Each sub-agent receives a "fresh" sandbox copy to prevent environmental pollution during investigation.
The RLM system enforces strict formatting, requiring a THOUGHT section and exactly one Python block per response to ensure predictable execution.
Sources: guides/python/recursive-language-models/rlm/prompts.py:7-124
AI Data Analyst Workflow
The Data Analyst integration automates the process of data ingestion, processing, and visualization. It utilizes a two-step LLM process: a coding model for high-accuracy script generation and a summary model for human-readable reporting.
- Code Generation: LLM generates Python code based on a CSV data format and natural language prompt.
- Sandbox Setup: A Daytona sandbox is initialized, and the dataset is uploaded.
- Execution: The generated script runs, typically using libraries like Pandas for analysis and Matplotlib for chart generation.
- Result Retrieval: Generated artifacts (e.g.,
chart-0.png) are downloaded from the sandbox to the host.
Sources: guides/python/ai-data-analyst/openai/README.md, guides/typescript/ai-data-analyst/openai/README.md
Implementation Details
Mastra Coding Agent Configuration
The Mastra agent is configured with a persistent memory system using LibSQL and semantic recall capabilities.
export const codingAgent = new Agent({
id: 'coding-agent',
name: 'Coding Agent',
instructions: `...`,
model: process.env.MODEL || 'openai/gpt-4.1',
tools: {
createSandbox,
runCode,
readFile,
writeFile,
// ... additional tools
},
memory: new Memory({
storage: new LibSQLStore({ id: 'coding-agent-storage', url: 'file:../../mastra.db' }),
options: {
generateTitle: true,
semanticRecall: true,
},
}),
})
Sources: guides/typescript/mastra/coding-agent/openai/src/mastra/agents/coding-agent.ts:167-195
Environment Configuration
Integrations across different frameworks share a common set of required environment variables for authentication and model routing.
| Variable | Required | Description |
|---|---|---|
DAYTONA_API_KEY | Yes | Authentication for the Daytona API and sandbox creation |
OPENAI_API_KEY | Optional | Key for OpenAI models (GPT-4o, Codex) |
ANTHROPIC_API_KEY | Optional | Key for Anthropic models (Claude 3.5 Sonnet/Haiku) |
SANDBOX_OPENAI_API_KEY | Optional | Specific key passed into the sandbox environment for agent use |
Sources: guides/typescript/openai/codex-sdk/README.md, guides/typescript/agentkit-inngest/coding-agent/anthropic/README.md
Summary
The AI Framework Guides & Integrations module establishes a standardized way to run AI-generated code securely. By utilizing Daytona's infrastructure, developers can build autonomous agents that plan, write, and execute code with full access to a professional development toolkit, including multi-language support (Python, JS, TS) and real-time monitoring. These patterns enable sophisticated workflows ranging from parallelized codebase exploration to automated visual data analysis.