Plan

Open a plan; stream SSE of the orchestration.

Accepts a user question + agent catalog, starts (or resumes) a session, and streams Server-Sent Events as the planner runs.

Session continuation

Pass session_id to resume an existing session — history persists, the planner sees prior turns. Omit to start a fresh session. The server returns the resolved session_id in the first SSE frame (event: session), even for new sessions, so clients can cache it.

Catalog immutability per session

The agents catalog is stored on first plan and refreshed on each subsequent call; agents added or removed between plans take effect immediately but don't retroactively change prior turns' tool sets.

Streaming & abort

Closing the HTTP connection aborts the plan — in-flight A2A calls receive an AbortSignal and the planner loop terminates. Clients that want a partial result should buffer text.delta frames client-side rather than relying on final.

post/plan

Request body

questionstring required

The user's natural-language question. Non-empty — an empty string is rejected upstream because some LLM providers (Anthropic) reject empty user messages with a 400 mid-stream, surfacing as a vague "Provider returned error". Validating here gives a clean 400 with invalid_request instead.

session_idstring

Opaque external session identifier. If provided AND a session row exists with the matching external_session_id, that session is resumed (history persists). If omitted or unmatched, a new session is created and its server-assigned id is surfaced in the first SSE session event.

Example request

{
  "question": "Summarize the latest quarterly results for Apple.",
  "agents": [
    {
      "name": "research",
      "endpoint": "http://localhost:3773",
      "auth": {
        "envVar": "PEER_A_TOKEN"
      },
      "trust": {
        "pinnedDID": "did:bindu:research-agent-key-1"
      },
      "skills": [
        {
          "id": "search",
          "description": "Search the open web and return a ranked list of passages.",
          "outputModes": [
            "text/plain",
            "application/json"
          ],
          "tags": [
            "research",
            "web"
          ]
        }
      ]
    }
  ],
  "preferences": {
    "max_steps": 8
  },
  "session_id": "client-session-42"
}

Response

SSE stream of the plan. Each event is one of the types documented under SSEEvent below. The stream closes after event: done.

Changes