Enterprise-Grade AI Agent & Backend Platform
β οΈ BETA - This project is under active development. Features may change, and some components are still being refined. Contributions and feedback are welcome!
The unified, production-ready platform combining high-performance FastAPI with advanced Agentic AI capabilities
π Get Started β’ π FastAPI β’ π€ Agents β’ π¦ Sandbox β’ π Tools
- Agents Backend
- π Table of Contents
- π Get Started in 60 Seconds
- π¬ Demo
- π System Lifecycle Architecture
- π FastAPI Backend - Production-Ready Backend Architecture
- π§ PTC Module - Programmatic Tool Calling
- π¦ Sandbox Execution Environment - Dual Architecture
- π Tool Server - Comprehensive Integrations
- βοΈ Configuration
- π Documentation
- π Recent Changes (December 2024)
- π€ Contributing
- π License
# 1οΈβ£ Clone the repository
git clone https://github.com/obinopaul/agents-backend.git && cd agents-backend
# 2οΈβ£ Set up environment variables
cp backend/.env.example backend/.env
cp deploy/backend/docker-compose/.env.server.example deploy/backend/docker-compose/.env.server
# Edit backend/.env and deploy/backend/docker-compose/.env.server with your API keys (OpenAI, E2B, Tavily, etc.)
# 3οΈβ£ Build the E2B Sandbox Template
# First-time setup: Create your own E2B sandbox template
# Get your E2B API key from https://e2b.dev/dashboard and add it to backend/.env and/or deploy\backend\docker-compose\.env.server
# Option A β CLI (legacy V1):
# If you DON'T have an existing template, create one:
e2b template build -d backend/e2b.Dockerfile -c "bash /app/start-services.sh" -n agents-sandbox --cpu-count 4 --memory-mb 2048
# Option B β Python build script (V2, recommended):
# Uses backend/template.py config (4 vCPUs, 2048 MB RAM by default).
# Edit SANDBOX_CPU_COUNT / SANDBOX_MEMORY_MB in backend/template.py to change resources.
python backend/build_prod.py # Production: tags as 'agents-sandbox'
# python backend/build_dev.py # Development: tags as 'agents-sandbox-dev'
# If you already have a template_id in e2b.toml, just rebuild:
# e2b template build -c backend
# β οΈ Recreating a template? If e2b.toml exists with old config, rename it first:
# Windows: Rename-Item e2b.toml e2b.toml.bak -Force
# Linux/Mac: mv e2b.toml e2b.toml.bak
# Then run the build command above
# The command will output your new template_id - update backend/.env:
# E2B_TEMPLATE_ID=<your-new-template-id>
# 4οΈβ£ Start everything with one command
docker-compose up -d --build
# 5οΈβ£ Verify the database is created (runs Alembic migrations)
docker-compose exec agents_backend_server bash -c "cd /agents_backend/backend && alembic upgrade head"
# 6οΈβ£ Create a test user for login (required for authentication)
python backend/tests/create_test_user.py
# Default credentials: sandbox_test / TestPass123!
# 7οΈβ£ Test the setup (optional but recommended)
python backend/tests/live/interactive_agent_test.pyNote: The
agents_backendPostgreSQL database is automatically created by Docker. All tables (users, agents, sandboxes, etc.) are created on first startup via SQLAlchemy.
| Service | URL |
|---|---|
| Backend API | http://localhost:8001 |
| Swagger UI | http://localhost:8001/docs |
| Celery Flower | http://localhost:8555 |
# 1οΈβ£ Install dependencies
pip install -r requirements.txt
# 2οΈβ£ Start PostgreSQL & Redis
docker-compose up -d agents_backend_postgres agents_backend_redis
# 3οΈβ£ Run database migrations
cd backend && alembic upgrade head
# 4οΈβ£ Start the server
python -m uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
# 5οΈβ£ Test the setup (in a new terminal)
python backend/tests/live/interactive_agent_test.py
# 6οΈβ£ Start the Frontend (in a new terminal)
cd frontend
pnpm install # or npm install
pnpm dev # or npm run dev
# Frontend will be available at http://localhost:1420Test all backend functionalities without starting the server using the Agents Backend (agents-backend) CLI.
# Install & view commands
pip install -r requirements.txt
agents-backend --help
# Quick test: Run the Deep Research Agent interactively
agents-backend agentThis launches an interactive session where you select a language, ask a question, and watch the agent research and generate a report.
π Full CLI Reference: See docs/guides/cli-reference.md for all commands and options.
Start the full FastAPI server for production deployment:
agents-backend run --host 0.0.0.0 --port 8000
# Start the Frontend (in a new terminal)
cd frontend
pnpm install # or npm install
pnpm dev # or npm run dev| Service | URL |
|---|---|
| Backend API | http://localhost:8000 |
| Swagger UI | http://localhost:8000/docs |
| ReDoc | http://localhost:8000/redoc |
| Frontend | http://localhost:1420 |
| Agent API | POST /api/v1/agent/chat/stream |
π Full API Reference: See docs/guides/fastapi-backend.md for detailed endpoint documentation.
| Guide | Description |
|---|---|
docs/guides/admin-api.md |
Admin API endpoints and middleware |
docs/guides/api-endpoints.md |
API endpoints and middleware |
docs/guides/cli-reference.md |
CLI commands and options |
docs/guides/fastapi-backend.md |
FastAPI endpoints & middleware |
docs/guides/agentic-ai.md |
LangGraph agent architecture |
docs/guides/sandbox-guide.md |
Sandbox execution environments |
docs/api-contracts/sandbox-server.md |
Sandbox execution API Guide |
docs/guides/environment-variables.md |
All environment variables |
docs/guides/plugins.md |
Plugin system (OAuth2, Email, etc.) |
docs/guides/ptc-module.md |
Programmatic Tool Calling |
docs/api-contracts/database.md |
Database schema & tables |
docs/api-contracts/tool-server.md |
Tool Server API |
docs/api-contracts/e2b-sandbox.md |
E2B Sandbox API |
docs/guides/standalone-scripts.md |
Writing standalone Python scripts |
A visual overview of how all components work together.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β APPLICATION STARTUP β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β Plugin β β FastAPI β β Middleware β
β Discovery β β Creation β β Registration β
β (OAuth, Email)β β (App Factory) β β (JWT, CORS) β
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β LIFESPAN: STARTUP β
βββββββββββββββββββββββββββ€
β 1. Create database tablesβ
β 2. Open Redis connection β
β 3. Initialize rate limiterβ
β 4. Initialize Snowflake β
β 5. Start audit log task β
βββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β SERVER RUNNING β
β localhost:8000 β
βββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AUTHENTICATION LIFECYCLE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββ βββββββββββββββ
β User β β Database β
ββββββ¬βββββ ββββββββ¬βββββββ
β β
β 1. Login Request β
β POST /api/v1/admin/auth/login β
βΌ β
βββββββββββββββ 2. Validate βββββββββββββββ β
β FastAPI β ββββββββββββββββββββΊ β Service β β
β Endpoint β β Layer β β
βββββββββββββββ ββββββββ¬βββββββ β
β β
βΌ β
βββββββββββββββ β
β Query βββββββ
β sys_user β
ββββββββ¬βββββββ
β
ββββββββββββββββββββββββββββββββββββββββ
β 3. Generate JWT
βΌ
βββββββββββββββ 4. Store Session βββββββββββββββ
β JWT Token β ββββββββββββββββββββββΊ β Redis β
β (HS256) β β Sessions β
ββββββββ¬βββββββ βββββββββββββββ
β
β 5. Return Token
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β { β
β "access_token": "eyJhbGciOiJIUzI1NiIs...", β
β "token_type": "Bearer", β
β "user": {"id": 1, "username": "admin", ...} β
β } β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AGENT CHAT LIFECYCLE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Frontend Backend Sandbox
ββββββββ βββββββ βββββββ
β β β
β POST /agent/chat/stream β β
β ββββββββββββββββββββββββββΊβ β
β β β
β βΌ β
β βββββββββββββββ β
β β LangGraph β β
β β Workflow β β
β ββββββββ¬βββββββ β
β β β
β βββββββββββββββββΌββββββββββββββββ β
β βΌ βΌ βΌ β
β βββββββββββββ βββββββββββββ βββββββββββββ β
β βInvestigatorβ β Base β β Reporter β β
β β Node β β Node β β Node β β
β βββββββββββββ βββββββ¬ββββββ βββββββββββββ β
β β β
β β Tool Call? β
β βΌ β
β βββββββββββββββ β
β β MCP Client ββββββββββββββββββββββββΊ
β ββββββββ¬βββββββ POST /mcp β
β β β
β βββββββββββββββββββββββββββββββ
β β Tool Result β
β β β
ββββββββββββββββββββββββββββ€ β
β SSE: Stream Events β β
β β’ type: "text" β β
β β’ type: "tool_call" β β
β β’ type: "done" β β
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SANDBOX LIFECYCLE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
API Request Sandbox Service E2B/Daytona
βββββββββββ βββββββββββββββ βββββββββββ
β β β
β POST /sandboxes β β
β ββββββββββββββββββββββββββΊβ β
β β β
β β 1. Get User MCP Settings β
β β ββββββββββββββββββββββββββΊβ
β βββββββββββββββββββββββββββββ β
β β β
β β 2. Create Container β
β β ββββββββββββββββββββββββββΊβ
β β β
β β ββββββββββ΄βββββββββ
β β β start-services.shβ
β β β β
β β β β’ MCP Server β
β β β :6060 β
β β β β
β β β β’ Code Server β
β β β :9000 β
β β ββββββββββ¬βββββββββ
β β β
β β 3. Write Credentials β
β β β’ ~/.codex/auth.json β
β β β’ ~/.claude/.credentials β
β β ββββββββββββββββββββββββββΊβ
β β β
βββββββββββββββββββββββββββββ€ β
β { sandbox_id, β β
β mcp_url, β β
β vscode_url } β β
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TOOL SERVER (MCP) LIFECYCLE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Sandbox Container
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MCP Server (:6060) β β
β β Built with FastMCP - Exposes 44+ tools via SSE β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββΌβββββββββββββββββββββ β
β βΌ βΌ βΌ β
β βββββββββββββ βββββββββββββ βββββββββββββ β
β β Shell β β File β β Browser β β
β β Tools β β Tools β β Tools β β
β β (6) β β (7) β β (15) β β
β βββββββββββββ€ βββββββββββββ€ βββββββββββββ€ β
β β shell_initβ β file_read β β navigate β β
β β shell_run β β file_writeβ β click β β
β β shell_viewβ β file_edit β β type β β
β β ... β β grep β β scroll β β
β βββββββββββββ βββββββββββββ βββββββββββββ β
β β
β ββββββββββββββββββββββΌβββββββββββββββββββββ β
β βΌ βΌ βΌ β
β βββββββββββββ βββββββββββββ βββββββββββββ β
β β Web β β Media β β Dev β β
β β Tools β β Tools β β Tools β β
β β (6) β β (2) β β (4) β β
β βββββββββββββ€ βββββββββββββ€ βββββββββββββ€ β
β β web_searchβ β image_gen β β fullstack β β
β β web_visit β β video_gen β β checkpointβ β
β β img_searchβ β β β register β β
β βββββββββββββ βββββββββββββ βββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Custom MCP Servers β β
β β Codex CLI β Claude Code β User Custom MCPs β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
β SSE/HTTP
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCPClient β
β from backend.src.tool_server.mcp.client import MCPClient β
β β
β async with MCPClient(mcp_url) as client: β
β tools = await client.get_langchain_tools() β
β agent = create_react_agent(llm, tools) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COMPLETE REQUEST LIFECYCLE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Frontend API Gateway Services External
ββββββββ βββββββββββ ββββββββ ββββββββ
β β β β
β 1. Login β β β
β βββββββββββββββββΊβ β β
ββββββ JWT Token βββ€ β β
β β β β
β 2. Create Sandbox β β
β βββββββββββββββββΊββββββββββββββββββββΊβ β
β β βββββββββββββββββββββββΊ
βββββ Sandbox URLs β€ββββββββββββββββββββ€ E2B/Daytona β
β β β β
β 3. Configure MCP β β
β βββββββββββββββββΊββββββββββββββββββββΊβ β
ββββββ Success βββββ€ββββββββββββββββββββ€ Store in DB β
β β β β
β 4. Chat Stream β β β
β βββββββββββββββββΊββββββββββββββββββββΊβ β
β β ββββββΊ LangGraph β
β β β β β
β β ββββββββ β
βββββ SSE Events βββ€ββββββββββββββββββββ€ β
β text, tools β β β
β β β β
β 5. Cleanup β β β
β βββββββββββββββββΊββββββββββββββββββββΊβββββββββββββββββββββββΊ
β β β Delete Sandbox β
β β β β
π Detailed Lifecycle Documentation: See docs/lifecycle/README.md for step-by-step guides with code examples.
An interactive AI coding assistant that connects to a secure sandbox for writing, executing, and debugging code.
# Quick Start
cd backend/src/sandbox/agent_infra_sandbox && docker-compose up -d
python -m deepagents_cliSandbox URL: http://localhost:8090
π Full Guide: See docs/guides/deepagents-cli.md for all commands, skill modes, and configuration.
-
FastAPI with Async Performance
- High-performance async API endpoints with uvloop optimization
- SQLAlchemy 2.0 async with PostgreSQL connection pooling
- Redis caching with configurable TTL
- Celery workers for background task processing
- Docker and Docker Compose support with health checks
-
Enterprise Security
- JWT authentication with access/refresh tokens and auto-renewal
- Role-Based Access Control (RBAC) with granular permissions
- Row-level security with custom data access policies
- Password policy enforcement with history tracking
- OAuth2 social login (GitHub, Google, Linux.do)
- Input sanitization and CORS configuration
-
Complete Audit Trail
- Login history with IP tracking and user agent detection
- Operation audit logs for all user actions
- Request/response logging with timing metrics
- Structured logging with request context binding
-
Internationalization & Localization
- Multi-language support with locale detection
- I18n middleware for automatic language switching
- Translatable content and error messages
-
Plugin System
- OAuth2 social login providers
- Email notifications with SMTP and templates
- Auto-generate CRUD code from database models
- Dynamic configuration and feature flags
- System notifications and announcements
-
Multi-Agent Orchestration with LangGraph
- Directed Acyclic Graph (DAG) state machine for agent workflows
- State persistence and checkpointing for long-running tasks
- Automatic plan generation, revision, and execution
- Human-in-the-loop interrupt/resume capabilities
-
Specialized Agent Nodes
- Research Node: Web search, RAG retrieval, information synthesis
- Code Node: Python/Bash execution in sandboxes
- Content Node: Podcast, PPT, and prose generation
- Tool Caller: MCP integration with 50+ tools
-
LLM Provider Support
- OpenAI (GPT-4o, GPT-4o-mini, o1, o3-mini)
- Anthropic (Claude 3.5 Sonnet, Claude 3 Opus)
- Google (Gemini 2.0, Gemini 1.5 Pro)
- Ollama for local/self-hosted models
- LangChain adapters for custom providers
-
RAG Pipeline with 6 Vector Databases
- Milvus / Zilliz Cloud for high-performance storage
- Qdrant for efficient similarity search
- Dify, RagFlow for managed document processing
- VikingDB (ByteDance) for enterprise scale
- Custom vector store implementations
-
Content Generation
- Multi-voice podcast generation with audio effects
- AI-generated PowerPoint presentations
- Long-form prose with chapters and coherent narrative
- Prompt enhancement and optimization
-
Dual Sandbox Architecture
- Agent Infra Sandbox: Local Docker-based for development
- E2B / Daytona: Cloud-based for production workloads
- Web preview URLs for running applications
- VS Code integration for interactive debugging
-
Programmatic Tool Calling (PTC)
- Agents write Python code instead of JSON tool calls
- Data stays in sandbox, only summaries returned
- Full programming power with loops and conditionals
- MCP tool discovery and Python function generation
-
CLI Tools
fbaCLI for all backend operations (run, init, agent, celery)- DeepAgents CLI for interactive AI coding
- Code generation from database schemas
- SQL script execution
-
API Documentation
- Swagger UI and ReDoc auto-generation
- Type hints throughout for IDE support
- Comprehensive endpoint documentation
- Request/response schema validation
π Full Technical Reference: See docs/guides/fastapi-backend.md for complete API endpoints, service layers, and code paths.
π Agentic AI Details: See docs/guides/agentic-ai.md for graph components, RAG pipeline, and LLM configuration.
The PTC (Programmatic Tool Calling) module provides a production-ready implementation where agents write Python code to interact with tools instead of using JSON-based tool calls.
| Traditional Approach | PTC Approach |
|---|---|
| LLM β JSON tool call β Result β LLM | LLM β Write Python β Execute in sandbox β Summary |
| Intermediate data fills context | Data stays in sandbox |
| Limited to single operations | Full programming power (loops, conditionals) |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PTC Module (backend/src/ptc/) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β PTCSandbox β β MCPRegistry β β ToolGenerator β β
β β (76KB) β β (25KB) β β (30KB) β β
β β Daytona SDK β β Tool Discovery β β Python codegen β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β β β β
β ββββββββββββββββββββββΌβββββββββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββββββ β
β β Session Manager β β
β β (Persistent State) β β
β βββββββββββββββββββββββββββ β
β β β
β ββββββββββββββ΄βββββββββββββ β
β βΌ βΌ β
β βββββββββββββββββββ βββββββββββββββββββ β
β β Interactive β β Web Preview β β
β β CLI β β Links β β
β βββββββββββββββββββ βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Description | Size | Code Path |
|---|---|---|---|
| PTCSandbox | Daytona cloud sandbox management | 76KB | ptc/sandbox.py |
| MCPRegistry | MCP server connections, tool discovery | 25KB | ptc/mcp_registry.py |
| ToolGenerator | Generate Python functions from MCP tools | 30KB | ptc/tool_generator.py |
| SessionManager | Session lifecycle, persistence | 6.7KB | ptc/session.py |
| Security | Code validation, sandboxing | 10KB | ptc/security.py |
The PTC module includes a production-ready interactive CLI:
# Start the interactive agent
cd backend
python -m src.ptc.examples.langgraph_robust_agentπ§ Initializing...
β Sandbox ID: sandbox-abc123
β Web Preview (port 8000): https://sandbox-abc123.daytona.io
β Tools: Bash, read_file, write_file, edit_file, glob, grep
You > Create a Flask API with /hello endpoint
π€ Agent (5 tool calls):
Created app.py with Flask server
Server running on port 5000
You > status
π Sandbox Status
Preview (port 5000): https://sandbox-abc123.daytona.io:5000
You > exit
π Goodbye! Your sandbox is preserved.
| Command | Description |
|---|---|
help |
Show available commands |
status |
Show sandbox ID and preview URLs |
files |
List files in sandbox |
clear |
Clear screen |
exit |
Quit (sandbox persists) |
| Tool | Description |
|---|---|
execute_code |
Run Python code with MCP tools |
Bash |
Shell commands (git, npm, docker) |
read_file |
Read file with line numbers |
write_file |
Create/overwrite files |
edit_file |
Edit existing files |
glob |
Find files by pattern |
grep |
Search file contents |
π Full Documentation: backend/src/ptc/README.md
The platform includes two sandbox systems for different use cases.
A containerized local sandbox for development and testing, with two integration options:
# 1. Start the sandbox
cd backend/src/sandbox/agent_infra_sandbox
docker-compose up -d
# 2. Verify sandbox is running
python check_sandbox.py
# 3. Run DeepAgents CLI (interactive AI coding assistant)
export OPENAI_API_KEY=your_key_here
python -m deepagents_cli| Approach | Description | Best For |
|---|---|---|
| DeepAgents CLI | Interactive terminal AI coding assistant | Developers, interactive sessions |
| LangChain Tools | 23+ tools for LangChain/LangGraph agents | Production agents, automation |
# Interactive mode (default sandbox: agent_infra)
python -m deepagents_cli
# With auto-approve (no confirmation prompts)
python -m deepagents_cli --auto-approve
# List available agents
python -m deepagents_cli list
# Reset an agent's memory
python -m deepagents_cli reset --agent my_agent
# Run without sandbox (local filesystem only)
python -m deepagents_cli --sandbox nonefrom agent_infra_sandbox import SandboxSession
async with await SandboxSession.create(session_id="chat_123") as session:
tools = session.get_tools()
tool_map = {t.name: t for t in tools}
await tool_map["file_write"].ainvoke({
"file": "app.py",
"content": "print('Hello!')"
})
result = await tool_map["shell_exec"].ainvoke({
"command": "python app.py"
})βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Infra Sandbox (Docker) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββ βββββββββββββββββββββββ β
β β DeepAgents CLI β β LangChain Tools β β
β β (Interactive AI β β (23+ sandbox tools β β
β β coding assistant) β β for agents) β β
β βββββββββββββββββββββββ βββββββββββββββββββββββ β
β β β β
β ββββββββββββββ¬ββββββββββββ β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Shared Infrastructure β β
β β β’ client.py - Unified sandbox client β β
β β β’ session.py - Workspace isolation β β
β β β’ exceptions.py - Common error handling β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Description | Code Path |
|---|---|---|
| DeepAgents CLI | Interactive AI coding assistant | deepagents_cli/ |
| LangChain Tools | 23+ sandbox tools for agents | langchain_tools/ |
| Shared Client | Unified sandbox connection | client.py |
| Docker Compose | Container orchestration | docker-compose.yaml |
π Full Documentation: backend/src/sandbox/agent_infra_sandbox/README.md
Enterprise sandbox with session management, lifecycle control, and cloud providers.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Sandbox Server Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββ β
β β Sandbox Controller β β
β β (12.5KB lifecycle)β β
β βββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌββββββββββββββββββββββ β
β βΌ βΌ βΌ β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β E2B Cloud β β Daytona β β Local Docker β β
β β (13.5KB) β β (42.7KB) β β β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Note: For advanced Programmatic Tool Calling with Daytona, see the PTC Module section.
| Provider | Description | Features | Code Path |
|---|---|---|---|
| E2B | Cloud-based isolation | Persistent, secure, VS Code | e2b.py |
| Daytona | Managed dev environments | Git integration, custom images | daytona.py |
| Sandbox Factory | Provider abstraction | Switch via SANDBOX_PROVIDER env |
sandbox_factory.py |
| Component | Description | Code Path |
|---|---|---|
| Queue Scheduler | Message queue for sandbox operations | lifecycle/queue.py |
| Sandbox Controller | Create, stop, delete, timeout handling | lifecycle/sandbox_controller.py |
| Template | Purpose | Code Path |
|---|---|---|
| Code Server | VS Code in browser | docker/sandbox/start-services.sh |
| Cloud Code | Google Cloud Shell compatible | docker/sandbox/ |
| Claude Template | Claude-optimized environment | docker/sandbox/claude_template.json |
| Codex Config | OpenAI Codex integration | docker/sandbox/codex_config.toml |
The Tool Server is a standalone server that provides tools to agents via MCP (Model Context Protocol).
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Tool Server β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tool Categories β β
β ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββββββ€ β
β β Browser β Web β Slides β Shell β File β Media β β
β β (12) β (7) β (5) β (9) β (9) β (3) β β
β ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Integrations β β
β ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββββββ€ β
β β Web VisitβImage Gen βImage SrchβVideo Gen βWeb Searchβ Storage β β
β ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MCP Server (SSE) β β
β β β’ client.py - MCP client connection β β
β β β’ server.py - MCP server implementation β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Full Playwright-based browser control for BrowserUse-style automation.
| Tool | Description | Code Path |
|---|---|---|
click |
Click elements by selector | browser/click.py |
navigate |
Navigate to URLs | browser/navigate.py |
enter_text |
Type text into inputs | browser/enter_text.py |
enter_text_multiple |
Fill multiple form fields | browser/enter_text_multiple_fields.py |
scroll |
Scroll pages | browser/scroll.py |
drag |
Drag and drop elements | browser/drag.py |
dropdown |
Select from dropdowns | browser/dropdown.py |
press_key |
Keyboard input | browser/press_key.py |
tab |
Tab management | browser/tab.py |
view |
Screenshot/view page | browser/view.py |
wait |
Wait for elements/time | browser/wait.py |
Complete PowerPoint manipulation toolkit.
| Tool | Description | Size | Code Path |
|---|---|---|---|
slide_write |
Create new slides from scratch | 31KB | slide_system/slide_write_tool.py |
slide_patch |
Modify existing slides | 27KB | slide_system/slide_patch.py |
slide_edit |
Edit slide content | 8.7KB | slide_system/slide_edit_tool.py |
| Provider | Description | Code Path |
|---|---|---|
| BeautifulSoup | HTML parsing | web_visit/beautifulsoup.py |
| Firecrawl | Advanced web scraping | web_visit/firecrawl.py |
| Jina | AI-powered extraction | web_visit/jina.py |
| Gemini | Google Gemini vision | web_visit/gemini.py |
| Tavily | AI search + extraction | web_visit/tavily.py |
| Provider | Description | Code Path |
|---|---|---|
| DuckDuckGo | Privacy-focused search | web_search/duckduckgo.py |
| SerpAPI | Google/Bing via API | web_search/serpapi.py |
| Provider | Description | Code Path |
|---|---|---|
| DuckDuckGo | Image search | image_search/duckduckgo.py |
| SerpAPI | Google Images via API | image_search/serpapi.py |
| Provider | Description | Code Path |
|---|---|---|
| DuckDuckGo | Free image generation | image_generation/duckduckgo.py |
| Vertex AI | Google Imagen | image_generation/vertex.py |
| Tool | Description | Code Path |
|---|---|---|
| Bash | Execute shell commands | tools/bash.py |
| Code Execution | Python with artifacts | tools/code_execution.py |
| File Operations | Read/write/search files | tools/file_ops.py |
| Grep | Pattern matching | tools/grep.py |
| Glob | File pattern matching | tools/glob.py |
| Tavily Search | AI web search | tools/tavily.py |
| InfoQuest Search | Custom search tool | tools/infoquest_search/ |
| TTS | Text-to-speech | tools/tts.py |
| Think | Internal reasoning | tools/think.py |
| Crawl | Web page crawling | tools/crawl.py |
| Retriever | RAG document retrieval | tools/retriever.py |
Connect multiple MCP servers to enable agents to use external tools.
| Component | Description | Code Path |
|---|---|---|
| MCP Client | Connect to MCP servers via SSE | mcp/client.py |
| MCP Server | Expose tools via MCP protocol | mcp/server.py |
| MCP Tool | Base MCP tool implementation | tools/mcp_tool.py |
MCP Architecture:
βββββββββββββββββββ SSE βββββββββββββββββββ
β Agent Graph β βββββββββββββΊβ MCP Server β
β (LangGraph) ββββββββββββββ β (Tool Server) β
βββββββββββββββββββ βββββββββββββββββββ
β β
β β
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ
β Sandbox β β External MCP β
β (E2B/Daytona) β β Servers β
βββββββββββββββββββ βββββββββββββββββββ
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CORE SETTINGS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ENVIRONMENT=dev # 'dev' or 'prod'
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# DATABASE
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DATABASE_TYPE=postgresql
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_USER=postgres
DATABASE_PASSWORD=your-password
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# REDIS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_USERNAME=default # For Redis 6+ ACL
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SECURITY
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
TOKEN_SECRET_KEY=your-secret-key
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# AI PROVIDERS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
TAVILY_API_KEY=tvly-...
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SANDBOX
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
SANDBOX_PROVIDER=e2b # 'e2b' or 'daytona'
E2B_API_KEY=e2b_...
DAYTONA_API_KEY=...
DAYTONA_API_URL=https://app.daytona.io/api
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# INTEGRATIONS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
SERPAPI_API_KEY=... # For web/image search
FIRECRAWL_API_KEY=... # For web scrapingSee .env.example for complete reference.
- API Contracts - Complete API reference for frontend developers
- API Documentation - Interactive Swagger UI
- Agent System Guide - Deep dive into agent architecture
- Sandbox Guide - Sandbox server documentation
- Agent Infra Sandbox - Local sandbox guide
- SessionMetrics model enhanced with
user_idandmodel_namefields - Token-based pricing for LLM usage tracking
- Credit deduction integrated with metrics service
- See:
backend/app/agent/service/metrics_service.py
- Supabase compatible - Set
DATABASE_SCHEMA=postgresin.env - Auto-table creation on startup via
create_tables() - LangGraph checkpoints auto-created via
checkpointer.setup() - Migration fix: Corrected
down_revisionchain in Alembic
- Fixed
ResponseModelβResponseSchemaModelfor generic type hints - Fixed
DependsJwtAuthdependency injection in sandbox/slides APIs - Fixed duplicate route name
get_configβget_agent_config
- 43+ unit tests for metrics, credits, PTC tools, and slides API
- Test documentation:
backend/tests/README.md
# Run all tests
cd backend && pytest tests/ -vContributions are welcome! Please read our Contributing Guide first.
This project is licensed under the MIT License.
