Agents & A2A

Agents run as Cloudflare Durable Objects backed by the Cloudflare Agents SDK. Each agent maintains state, coordinates tools, and communicates over WebSockets.

HTTP Entry Point

POST /api/agents/:id/call

{
  "method": "plan",
  "payload": {
    "objective": "Inspect turbines",
    "constraints": ["30m window", "safety checklists"]
  }
}

WebSocket Stream

Connect to /api/agents/ws (see roadmap) to receive live observation + action events. Messages are serialized as JSON:

{
  "type": "observation",
  "taskId": "task_abc",
  "status": "running",
  "payload": {
    "step": 4,
    "message": "Deploying inspection drone"
  }
}

Tools

Agents can access:

  • web.fetch – outbound HTTP with policy enforcement
  • r2.read – fetch datasets, artifacts, or logs
  • vector.search – plug in embeddings from /v1/embeddings
  • scheduler – enqueue follow-up tasks in Durable Objects

Extend the agents/ directory with new tools by exporting AgentTool classes compatible with the SDK.