All endpoints require a JWT Bearer token unless otherwise noted.
Base URL: http://localhost:8000
Get a token:
POST /api/token/
{"username": "admin", "password": "admin1234"}
→ {"access": "<jwt>", "refresh": "<jwt>"}Refresh a token:
POST /api/token/refresh/
{"refresh": "<refresh-token>"}
→ {"access": "<new-jwt>"}List all registered agents. Supports filtering.
Query params: ?status=RUNNING&agent_type=FUNCTIONAL&source=SWARM
Response:
[{
"id": "uuid",
"name": "sales-account-strategist",
"agent_type": "FUNCTIONAL",
"source": "SWARM",
"status": "RUNNING",
"identity_key": "swarm_abc123...",
"department": null,
"roles": [],
"metadata": {"source_category": "sales"},
"version": "2.2",
"created_at": "2025-04-18T10:00:00Z"
}]Register a new agent.
Body:
{
"name": "my-finance-agent",
"agent_type": "FUNCTIONAL",
"department": "Finance",
"metadata": {}
}Fetch a single agent by UUID.
Update agent fields (name, department, metadata, status).
Decommission an agent.
Pause agent execution. Sets status=PAUSED.
Resume a paused agent. Sets status=RUNNING.
Queue a background Celery task for this agent.
Body: {"task": "Run quarterly analysis"}
List all RBAC roles.
Create a role.
Body:
{
"name": "finance-readonly",
"permissions": ["billing:read", "reports:read"]
}Authenticate an agent and get a session JWT.
Body:
{
"identity_key": "swarm_abc123...",
"agent_name": "sales-account-strategist"
}Response:
{
"token": "<jwt>",
"session_id": "uuid",
"expires_at": "2025-04-19T10:00:00Z"
}Revoke the current agent session.
List all policies. Filter: ?effect=DENY&is_active=true
Create a policy.
Body:
{
"name": "Block Production Writes After Hours",
"description": "Deny write operations in prod after 6 PM",
"resources": ["agent:execute", "tool:database"],
"effect": "DENY",
"priority": 50,
"risk_level": 80,
"is_active": true,
"valid_from": null,
"valid_until": null
}Effect values: ALLOW | DENY | AUDIT | ESCALATE
Fetch a single policy.
Update a policy.
Delete a policy.
Test a policy against a hypothetical request.
Body:
{
"resource": "tool:external-api",
"action": "call",
"context": {"hour": 20, "environment": "prod"}
}Response:
{
"decision": "DENY",
"reason": "Policy 'Block Production Writes After Hours' applied with effect DENY",
"policy_id": "uuid"
}Clone a policy. Returns the new policy record.
List all policy conditions.
Add a condition to a policy.
Body:
{
"policy": "policy-uuid",
"field": "context.environment",
"operator": "eq",
"value": "prod"
}Operators: eq neq gt lt contains not_contains in not_in between regex
List policy assignments.
Assign a policy to a specific agent or role.
Body:
{
"policy": "policy-uuid",
"agent": "agent-uuid",
"role": null
}View immutable policy decision logs.
Query params: ?agent=<id>&decision=DENY&start_date=2025-01-01
Response:
[{
"id": "uuid",
"agent": "uuid",
"policy": "uuid",
"resource": "swarm:execute",
"action": "dispatch:sales-account-strategist",
"decision": "ALLOW",
"reason": "Policy 'Global Allow - Swarm Dispatch' applied",
"execution_time_ms": 4,
"request_data": {},
"created_at": "2025-04-18T10:01:23Z"
}]One-shot permission check. Returns allow/deny without creating an execution context.
Body:
{
"agent_id": "uuid",
"resource": "tool:database",
"action": "write",
"context": {}
}Execute an agent on a one-shot task.
Body:
{
"agent_id": "uuid",
"task": "Summarize Q3 financial performance",
"context": {"quarter": "Q3"}
}Response:
{
"conversation_id": "uuid",
"response": "Q3 revenue was...",
"tokens_used": 1240,
"cost_usd": "0.003100",
"duration_ms": 2800
}List LLM configurations.
Create an LLM config.
Body:
{
"name": "Claude Sonnet Production",
"provider": "CLAUDE",
"model_name": "claude-sonnet-4-6",
"api_key": "sk-ant-...",
"temperature": 0.7,
"max_tokens": 4096,
"cost_per_1k_tokens_input": "0.003000",
"cost_per_1k_tokens_output": "0.015000"
}Provider values: CLAUDE GEMINI OPENAI MISTRAL LLAMA CUSTOM
List agent capability configurations.
Configure an agent's execution capabilities.
Body:
{
"agent": "uuid",
"llm_config": "uuid",
"graph_type": "REACT",
"tools_enabled": ["web-search", "code-interpreter"],
"memory_type": "BUFFER",
"max_iterations": 10,
"timeout_seconds": 120,
"rag_enabled": false
}Graph types: REACT PLAN_EXECUTE MULTI_AGENT CUSTOM
List all conversations.
Fetch a conversation with full message history.
Send a new message turn to an active conversation.
Body: {"content": "What were the top risks identified?"}
Get all TraceStep records for this conversation.
List registered tools.
List tools available to the current agent.
Register a new tool.
Body:
{
"name": "crm-lookup",
"tool_type": "API",
"description": "Look up a company in the CRM by domain",
"endpoint": "https://api.crm.internal/companies",
"parameters": {
"type": "object",
"properties": {
"domain": {"type": "string", "description": "Company domain"}
},
"required": ["domain"]
},
"rate_limit_per_minute": 30
}List workflow tasks.
Create a workflow task.
Add a task dependency (DAG edge).
Body: {"depends_on_task_id": "uuid"}
List all pending human-in-the-loop approvals.
Approve or deny a pending action.
Body:
{
"decision": "APPROVED",
"notes": "Reviewed and approved for this run"
}Decision values: APPROVED | DENIED
List knowledge collections.
Create a collection.
Body:
{
"name": "Company Policies",
"description": "Internal HR and legal documents",
"embedding_model": "text-embedding-004",
"chunk_size": 1000,
"chunk_overlap": 200
}Run a RAG query against a collection.
Body:
{
"query": "What is the data retention policy for customer PII?",
"top_k": 5
}Response:
{
"query": "...",
"response": "According to document X...",
"sources": [
{"title": "Data Policy v2.pdf", "content": "...", "relevance": 0.94, "page": 3}
],
"performance": {"retrieval_ms": 45, "generation_ms": 800, "total_ms": 845}
}Grant an agent read access to a collection.
Body: {"agent_id": "uuid"}
Revoke agent access.
Body: {"agent_id": "uuid"}
List documents.
Upload a document.
Multipart form: file=@document.pdf, collection=<collection-uuid>
Trigger chunking and embedding for a document.
View RAG query history and audit log.
List usage records. Filter: ?agent=<id>&start_date=2025-01-01&end_date=2025-12-31
Aggregate usage stats.
Query params: ?agent=<id> or ?department=<id> or ?start_date=...&end_date=...
Response:
{
"total_cost_usd": "14.23",
"total_tokens_input": 4200000,
"total_tokens_output": 1800000,
"total_compute_ms": 92400,
"record_count": 312
}List cost centers.
Create a department cost center.
Body:
{
"name": "Engineering",
"code": "ENG-001"
}List agent budgets.
Set a budget.
Body:
{
"agent": "uuid",
"monthly_limit": "100.00",
"alert_threshold": "80.00",
"is_active": true
}These endpoints are called by agent-swarm/core/aos_client.py. You can also call them directly.
Register or update a swarm agent in AOS.
Body:
{
"name": "sales-account-strategist",
"source_category": "sales",
"file_path": "sales/sales-account-strategist.md",
"description": "Enterprise account expansion strategist",
"preferred_engine": "claude"
}Pre-execution governance gate.
Body:
{
"execution_id": "uuid",
"agent_name": "sales-account-strategist",
"task": "Research Acme Corp for expansion opportunities",
"engine": "claude",
"environment": "dev",
"workflow_phase": "execute"
}Response:
{
"decision": "allow",
"reason": "Policy 'Global Allow - Swarm Dispatch' applied with effect ALLOW",
"policy_id": "uuid",
"pending_action_id": null,
"execution_id": "uuid"
}Post-execution metering.
Body:
{
"execution_id": "uuid",
"agent_name": "sales-account-strategist",
"engine": "claude",
"tokens_input": 1200,
"tokens_output": 800,
"cost_usd": "0.004200",
"duration_ms": 3200,
"success": true
}Emit a workflow trace event.
Body:
{
"execution_id": "uuid",
"agent_name": "sales-account-strategist",
"phase": "execute",
"event_type": "agent_complete",
"payload": {
"output": {"summary": "Found 10 prospects"},
"duration_ms": 3200
}
}Query the AOS knowledge base for context enrichment.
Query params: ?q=enterprise+sales+strategy&agent=sales-account-strategist&top_k=5
Read back an execution context. Used to poll escalation status.
| Endpoint | Description |
|---|---|
GET /api/schema/ |
OpenAPI 3.0 schema (JSON) |
GET /api/docs/swagger/ |
Interactive Swagger UI |
GET /api/docs/redoc/ |
ReDoc documentation |
GET /metrics |
Prometheus metrics |
GET /admin/ |
Django admin panel |