Autonomous Agents¶
MDU runs autonomous AI agents that monitor system health and gather requirements through conversation.
Agent Registry¶
15 agents are seeded in the agent_registry table. Two are currently active:
| Agent | Type | Description |
|---|---|---|
| Requirement Agent | Conversational | CVO Support Bot for gathering requirements |
| Log Analyzer | Scheduled | System Guardian for monitoring Docker logs |
Requirement Agent (CVO Support Bot)¶
File: /opt/mdu-api/requirement-agent.js
A conversational agent that helps gather product requirements through natural dialogue using Mistral 7B (via Ollama).
Endpoint¶
POST /api/admin/agents/requirement/chat
Authorization: Bearer <admin-token>
Content-Type: application/json
{
"message": "We need a way for users to share models on social media",
"session_id": "optional-session-uuid"
}
Response:
{
"reply": "That's a great idea! Let me ask some clarifying questions...",
"session_id": "uuid",
"requirement": null
}
When the agent has gathered enough information, it returns a structured requirement:
{
"reply": "Got it! I've created a requirement for social sharing.",
"session_id": "uuid",
"requirement": {
"title": "Social Media Model Sharing",
"description": "Allow users to share 3D model previews on Twitter/X and Instagram",
"priority": "medium",
"category": "feature"
}
}
Log Analyzer (System Guardian)¶
File: /opt/mdu-api/log-analyzer.js
Runs every 5 minutes, analyzing Docker container logs for issues:
- Fetches recent logs from all monitored containers
- Analyzes log patterns for errors, warnings, and anomalies
- Classifies severity:
critical,high,medium,low - Auto-creates requirements for critical/high issues
Process¶
Every 5 minutes:
Docker logs (last 5min) → Pattern matching → Severity classification
|
v
Critical/High → Auto-create requirement in pipeline_jobs
|
v
All findings → Store in agent_runs table
Monitored Patterns¶
- Container crashes / OOM kills
- Repeated error messages
- API timeout spikes
- Database connection failures
- Disk space warnings
Database Tables¶
agent_registry¶
| Column | Type | Description |
|---|---|---|
id |
UUID | Primary key |
name |
TEXT | Agent name |
type |
TEXT | Agent type |
status |
TEXT | active, inactive, error |
config |
JSONB | Agent configuration |
last_run |
TIMESTAMPTZ | Last execution time |
agent_runs¶
| Column | Type | Description |
|---|---|---|
id |
UUID | Primary key |
agent_id |
UUID | FK to agent_registry |
started_at |
TIMESTAMPTZ | Run start time |
completed_at |
TIMESTAMPTZ | Run end time |
status |
TEXT | success, failed, timeout |
output |
JSONB | Run results |
Admin Management¶
Agents are managed via the Admin Hub:
| Method | Path | Description |
|---|---|---|
| GET | /api/admin/agents |
List all agents |
| POST | /api/admin/agents |
Register new agent |
| PUT | /api/admin/agents/:id |
Update agent config |
| DELETE | /api/admin/agents/:id |
Delete agent |
| GET | /api/admin/agents/stream |
SSE real-time updates |