面向 Aetheris v2.x 用户的 HTTP API 快速参考。完整契约见 api-contract.md。
http://localhost:8080/api
# Header 认证(当前实现)
Authorization: Bearer <token>POST /api/runs
Content-Type: application/json
{
"workflow_id": "agent_message",
"input": {
"agent_id": "refund-agent",
"message": "请退款订单 order-123"
}
}Response:
{
"job_id": "job-abc123",
"status": "pending",
"created_at": "2026-04-19T12:00:00Z"
}GET /api/jobs/:id{
"job_id": "job-abc123",
"status": "parked",
"agent_id": "refund-agent",
"current_node": "wait_approval",
"created_at": "2026-04-19T12:00:00Z"
}Job Status 枚举: pending | running | parked | completed | failed | cancelled
POST /api/jobs/:id/signal
Content-Type: application/json
{
"correlation_key": "approval-abc123",
"payload": {
"approved": true,
"reason": "客户投诉合理"
}
}GET /api/jobs/:id/trace{
"job_id": "job-abc123",
"timeline": [
{"time": "12:00:00", "event": "JobCreated"},
{"time": "12:00:05", "event": "StepStarted", "node": "query_order"},
{"time": "12:00:10", "event": "ToolCompleted", "node": "query_order"},
{"time": "12:00:15", "event": "JobParked", "node": "wait_approval", "correlation_key": "approval-abc123"},
{"time": "15:12:30", "event": "SignalReceived", "payload": {"approved": true}},
{"time": "15:12:35", "event": "StepStarted", "node": "send_refund"},
{"time": "15:12:40", "event": "JobCompleted"}
]
}GET /api/jobs/:id/replayPOST /api/jobs/:id/stopGET /api/jobs/:id/eventsPOST /api/agents
Content-Type: application/json
{
"name": "refund-agent",
"description": "退款审批 Agent",
"type": "react",
"llm": "default",
"tools": ["query_order", "send_refund"]
}GET /api/agentsGET /api/agents/:id/stateGET /api/agents/:id/jobs?status=runningPOST /api/documents/upload
Content-Type: multipart/form-data
file: <binary>
knowledge_id: "kb-123"GET /api/documents?knowledge_id=kb-123通过 MCP Gateway 注册的工具通过 MCP 协议调用,不走 REST API。
# 通过 MCP 协议列出工具
mcp__tools__list
# 通过 MCP 协议调用工具
mcp__tools__call
{
"name": "mcp-github",
"arguments": {
"action": "search_repos",
"query": "aetheris golang",
"limit": 5
}
}GET /healthGET /api/version所有错误返回统一格式:
{
"error": {
"code": "JOB_NOT_FOUND",
"message": "Job job-xxx not found",
"details": {}
}
}常见错误码:
| Code | HTTP Status | 说明 |
|---|---|---|
JOB_NOT_FOUND |
404 | Job 不存在 |
AGENT_NOT_FOUND |
404 | Agent 不存在 |
INVALID_SIGNAL_KEY |
400 | correlation_key 不匹配 |
JOB_NOT_PARKED |
400 | Job 未在 Parked 状态,无法 Signal |
TOOL_NOT_FOUND |
404 | 工具未注册 |
TOOL_EXECUTION_ERROR |
500 | 工具执行失败 |
UNAUTHORIZED |
401 | 未认证 |
RATE_LIMITED |
429 | 请求过于频繁 |
| 端点 | 限制 |
|---|---|
POST /api/runs |
100 req/min |
POST /api/jobs/:id/signal |
60 req/min |
GET /api/jobs/:id/* |
300 req/min |
- API Contract — 完整 API 契约与兼容性承诺
- Getting Started — 端到端使用教程
- Observability — Trace 与监控