Agent Architecture
Mirobody Health provides two types of AI agents, each optimized for different use cases:DeepAgent
Recommended for Complex TasksLangChain-based agent with advanced capabilities for file operations, multi-step planning, and complex workflows.
BaselineAgent
Best for Simple TasksNative Gemini/MiroThinker agent optimized for lightweight operations and direct MCP integration.
Agent Comparison
| Feature | DeepAgent | BaselineAgent |
|---|---|---|
| Framework | LangChain DeepAgents | Gemini/MiroThinker MCP |
| Planning | ✅ Built-in todos | ❌ |
| File System | ✅ Full support | ❌ |
| Subagents | ✅ Task isolation | ❌ |
| MCP Tools | ✅ Full integration | ✅ Native |
| MCP Resources | ❌ | ✅ Native |
| MCP Prompt Templates | ❌ | ✅ Native |
| Memory | ✅ PostgreSQL | ❌ |
| Streaming | ✅ | ✅ |
| Model Support | Multi-provider | Gemini 2.5/3.0, MiroThinker |
| Best For | Complex workflows, file operations | Simple tasks, native MCP |
| Setup Complexity | Medium | Low |
DeepAgent (Recommended for Complex Tasks)
Features
- ✅ Multi-step Planning: Built-in task decomposition with TODO system
- ✅ File Operations: Read, write, edit files with glob and grep support
- ✅ Subagents: Spawn subagents for context isolation
- ✅ Long-term Memory: PostgreSQL-backed persistent memory
- ✅ Full MCP Tools: Complete integration with MCP tool ecosystem
Supported Providers
DeepAgent supports multiple LLM providers via LangChain:- Gemini 3.0 (via Google GenAI SDK)
- GPT-5 (via OpenAI API or OpenRouter)
- Claude Sonnet (via OpenRouter)
- DeepSeek v3.2 (via OpenRouter)
Configuration
config.localdb.yaml
Use Cases
- Complex health data analysis workflows
- Multi-step research and reporting
- File processing and management
- Tasks requiring persistent context
- Projects needing task decomposition
Usage Example
BaselineAgent (Best for Simple Tasks)
Features
- ✅ Native MCP: Direct MCP server support
- ✅ Streaming: Fast streaming responses
- ✅ Direct Tool Config: Tools configured directly to LLM
- ✅ Lightweight: Minimal overhead, fast execution
- ❌ No file operations
- ❌ No subagents
Supported Providers
- Gemini 2.5/3.0 (native Google GenAI)
- MiroThinker (custom model)
Configuration
config.localdb.yaml
Use Cases
- Simple health data queries
- Quick conversations
- Direct MCP tool usage
- Lightweight operations
- Native Gemini/MiroThinker features
Usage Example
Tools System
What are Tools?
Tools are Python functions that enable AI agents to interact with health data, perform actions, and access external services. Mirobody Health makes it easy to add custom functionality without complex configuration.Tool Structure
Built-in Tools
General Tools (mirobody/pub/tools/):
chart_service.py- 25+ chart types (line, bar, pie, sankey, etc.)
mirobody/pub/tools_health/):
genetic_service.py- Genetic data analysishealth_indicator_service.py- Health metrics trackinguser_service.py- User profile management
Tool Configuration
config.localdb.yaml
Creating Custom Tools
Create tool file
Create a new Python file in a configured tool directory:
mirobody/pub/tools/weather_service.py
Auto-discovery
Tools are automatically discovered when the server starts. No manual registration required!
Tool Best Practices
- Authentication: Use
user_infoparameter for user-specific operations - Error Handling: Return structured error responses
- Type Hints: Use proper type annotations for validation
- Documentation: Include clear docstrings with Args and Returns
- Async Operations: Prefer async functions for I/O operations
MCP Protocol Integration
Mirobody Health functions as an MCP (Model Context Protocol) server, enabling integration with:- Claude Desktop - Direct integration
- Cursor IDE - AI-powered coding assistant
- ChatGPT - Via custom GPT apps
- Custom MCP Clients - Any MCP-compatible client
MCP Endpoints
tools/list- List available toolstools/call- Execute tool functionsresources/list- List available resourcesresources/read- Read resource content
Database Schema for Health Data
Tools query standardized health data from these tables:th_series_data
Time-series health indicators:| Column | Type | Description |
|---|---|---|
id | integer | Primary key |
user_id | varchar | User identifier |
indicator | varchar | Indicator name |
value | text | Original value |
value_standardized | text | Standardized value |
start_time | timestamp | Start time |
end_time | timestamp | End time |
source | varchar | Data source |
source_table | varchar | Source table |
theta_ai.health_user_profile_by_system
User profile storage:| Column | Type | Description |
|---|---|---|
id | integer | Primary key |
user_id | varchar | User identifier |
version | integer | Version number |
name | varchar | Profile name |
last_execute_doc_id | integer | Last executed document ID |
common_part | varchar | Profile content (JSON) |
create_time | timestamp | Creation timestamp |
last_update_time | timestamp | Last update timestamp |
is_deleted | boolean | Deletion flag |