Kova API Reference
A complete REST API built on Axum, 35+ endpoints, unified JSON format — covering Agents, Tasks, Workflows, Swarms, WAL, and system management.
Base URLBase URLThe root address of the API. The Lurus Base URL is https://hub.lurus.cn/v1.
http://localhost:3000/api/v1Authentication
All requests pass the API key via the X-API-Key header required:
X-API-Key: sk-kova-<64-char hex>Key format: ^sk-kova-[a-f0-9]{64}$, generated by create-tester.sh and stored in testers/<NAME>/.env (chmod 600).
Rate Limits
Idempotency window
POST /agents/:id/run within 15s returns 409 Conflict.Backpressure limit
429 Too Many Requests (with Retry-After: 5).Agent Management
/api/v1/agentsCreate an agent/api/v1/agentsList agents (supports status / limit / offset)/api/v1/agents/:idGet agent details/api/v1/agents/:idUpdate an agent/api/v1/agents/:idDelete an agentCreate request body:
{ "name": "researcher", "system_prompt": "你是一个专业的研究员...", "model": "deepseek-chat",
"tools": ["web_search", "file_write"],
"config": { "max_tokens": 4096, "temperature": 0.7, "max_iterations": 20 } }Response (201): { "id": "agt_a1b2c3d4", "name": "researcher", "status": "idle", "created_at": "2026-03-17T10:00:00Z" }
When listing, you can use the query parameters GET /api/v1/agents?status=idle&limit=20&offset=0.
WARNING
You can only delete agents in the idle or completed state. Running agents must be stopped first.
Task Execution
/api/v1/agents/:id/runTrigger an agent to execute a task/api/v1/eventsSSE event stream (real-time push of all agent events)/api/v1/tasks/:id/stopStop a task/api/v1/tasksList tasks (supports agent_id / status / limit)Trigger execution request body:
{ "message": "研究 WebAssembly 在服务端的最新发展",
"context": { "output_format": "markdown", "max_length": 2000 } }Response (200): { "task_id": "tsk_e5f6g7h8", "status": "running", "agent_id": "agt_a1b2c3d4" }
Idempotency
Resubmitting the same agent within 15s returns 409 Conflict; when the dispatch queue is ≥80% full, the API returns 429 Too Many Requests (with Retry-After: 5).
Real-time Event Stream (SSE)
GET /api/v1/events pushes all agent events, with optional query parameters ?workflow_id=<id>&tenant=<slug>. Request headers:
Accept: text/event-stream
X-API-Key: sk-kova-<64-char hex>SSE frame examples:
{"type": "thinking", "content": "正在分析搜索结果..."}
{"type": "tool_call", "tool": "web_search", "input": {"query": "WASM server-side 2026"}}
{"type": "tool_result", "tool": "web_search", "output": "..."}
{"type": "output", "content": "根据搜索结果..."}
{"type": "completed", "task_id": "tsk_e5f6g7h8"}When listing tasks, you can use the query parameters GET /api/v1/tasks?agent_id=agt_a1b2c3d4&status=completed&limit=20.
Workflow Management
/api/v1/workflowsCreate a workflow/api/v1/workflows/:name/runExecute a workflow/api/v1/workflows/:name/runs/:run_idView execution status/api/v1/workflowsList workflowsCreate request body:
{ "name": "content-pipeline", "description": "内容创作管道",
"steps": [
{ "name": "research", "agent": "researcher", "prompt": "调研主题:{{input.topic}}" },
{ "name": "write", "agent": "writer", "prompt": "基于研究结果撰写文章:\n{{steps.research.output}}",
"error_policy": "retry", "max_retries": 2 }
] }The execution request body is { "input": { "topic": "边缘计算趋势" } }.
Swarm Management
/api/v1/swarmsCreate a swarm/api/v1/swarms/:name/tasksSend a task to a swarmCreate request body:
{ "name": "dev-team", "coordinator": "project-manager", "agents": ["researcher", "coder", "tester"],
"config": { "max_rounds": 10, "consensus_required": false } }WAL Management
/api/v1/wal/statusQuery WAL status/api/v1/wal/compactTrigger WAL compactionStatus response example:
{ "total_entries": 1024, "pending_entries": 0, "corrupted_entries": 0, "buffer_usage": 0.35, "last_compaction": "2026-03-17T08:00:00Z" }System Management
/api/v1/healthHealth check/api/v1/metricsSystem metrics (Prometheus format)Error Responses
Unified format: { "error": { "code": "agent_not_found", "message": "Agent with id 'agt_xxx' not found", "details": null } }
| HTTP | Error code | Description |
|---|---|---|
| 400 | invalid_request | Invalid request parameters |
| 401 | unauthorized | Missing or invalid X-API-Key |
| 404 | agent_not_found | Agent does not exist |
| 409 | agent_busy | Resubmitted within the 15s idempotency window |
| 422 | workflow_invalid | Workflow definition is invalid |
| 429 | queue_full | Dispatch queue ≥80%, triggering backpressure rate limiting |
| 500 | internal_error | Internal error |
| 503 | wal_error | WAL system error |