Skip to main content

build_router

Function build_router 

Source
pub fn build_router(state: AppState) -> Router
Expand description

Build the axum Router with all API routes.

Routes:

  • GET /health — returns "ok" (200)
  • GET /tools — returns JSON array of ToolInfo
  • POST /run — runs the agent with a goal and returns the outcome
  • POST /sessions — create a new session
  • GET /sessions — list all sessions
  • GET /sessions/:id — get session detail with messages
  • POST /sessions/:id/messages — send a message in a session
  • DELETE /sessions/:id — remove a session
  • GET /sessions/:id/events — SSE stream of agent events for a session
  • GET /openapi.json — returns the OpenAPI 3.0.3 specification

Auth is sourced from the RECURSIVE_HTTP_AUTH_KEYS env var. For tests that need a deterministic auth state (no env-var races across parallel test threads), use build_router_with_auth instead.