MATIH Platform is in active MVP development. Documentation reflects current implementation status.
12. AI Service
Agent System
Agent Studio

Agent Studio

Production - Agent creation, templates, preview sandbox, deployment pipeline

Agent Studio provides a visual and API-driven interface for creating, configuring, testing, and deploying custom agents. It includes a template library, a live preview sandbox, and a deployment pipeline that takes agents from development through staging to production.


12.2.6.1Studio Architecture

Agent Studio is implemented across three services in data-plane/ai-service/src/agents/studio/:

ServiceFilePurpose
AgentStudioServicestudio_service.pyCore CRUD for agent definitions
TemplateServicetemplate_service.pyPre-built agent template library
PreviewServicepreview_service.pyLive sandbox for testing agents

Studio API Routes

The Studio API is registered as part of the Core module and exposes endpoints under /api/v1/studio/:

# List available templates
curl http://localhost:8000/api/v1/studio/templates?tenant_id=acme-corp
 
# Create agent from template
curl -X POST http://localhost:8000/api/v1/studio/agents \
  -H "Content-Type: application/json" \
  -H "X-Tenant-ID: acme-corp" \
  -d '{
    "name": "Sales Analyst Bot",
    "template_id": "bi-analyst",
    "config": {
      "system_prompt": "You are a sales data analyst...",
      "tools": ["execute_sql", "create_chart"],
      "max_iterations": 8,
      "temperature": 0.3
    }
  }'
 
# Preview agent (sandbox execution)
curl -X POST http://localhost:8000/api/v1/studio/agents/{agent_id}/preview \
  -H "Content-Type: application/json" \
  -H "X-Tenant-ID: acme-corp" \
  -d '{
    "message": "Show me revenue trends",
    "mock_tools": true
  }'
 
# Deploy agent to production
curl -X POST http://localhost:8000/api/v1/studio/agents/{agent_id}/deploy \
  -H "X-Tenant-ID: acme-corp" \
  -d '{"target": "production"}'

12.2.6.2Template Library

The template library provides pre-configured agent definitions:

Template IDNameDescription
bi-analystBI AnalystData analysis and visualization
sql-expertSQL ExpertAdvanced SQL generation and optimization
data-engineerData EngineerPipeline and data quality management
customer-supportCustomer SupportHelp desk and troubleshooting
leadership-briefingLeadership BriefingExecutive-level summaries
mlops-engineerMLOps EngineerModel lifecycle management
platform-adminPlatform AdminInfrastructure and monitoring

Template Configuration

class TemplateServiceConfig(BaseModel):
    templates_base_path: str = "templates/agents"
    auto_load_on_startup: bool = True
    cache_ttl_seconds: int = 300

12.2.6.3Preview Sandbox

The preview sandbox allows testing agents without affecting production data:

  • Mock tool execution: Tool calls return simulated results
  • Isolated sessions: Preview sessions are ephemeral
  • Token tracking: Monitors LLM token usage during preview
  • Response comparison: Compare responses across different configurations
{
  "preview_id": "preview-uuid-123",
  "agent_id": "agent-uuid-456",
  "response": {
    "content": "Based on the sales data, revenue grew 15% QoQ...",
    "tool_calls": [
      {"name": "execute_sql", "mocked": true, "arguments": {"sql": "SELECT..."}}
    ]
  },
  "tokens_used": 1245,
  "execution_time_ms": 1830,
  "warnings": []
}