Skip to main content

Module http

Module http 

Source
Expand description

HTTP API server for the Recursive agent.

Provides a lightweight axum-based HTTP server that exposes the agent’s tool registry as a read-only JSON endpoint, a health check, a POST /run endpoint that executes the agent with a given goal, session management endpoints for multi-turn conversations, and SSE streaming of agent events.

Structs§

AppState
Shared application state for the HTTP server.
AuthConfig
API key authentication for the HTTP server.
CreateSessionRequest
Request body for POST /sessions.
CreateSessionResponse
Response body for POST /sessions.
ErrorResponse
Error response body.
GoalResponse
Response body for goal mutation endpoints.
JwtConfig
JWT bearer token verification config.
ListSessionsQuery
Query parameters for GET /sessions.
Metrics
Prometheus-compatible metrics collector using lock-free atomic counters.
RateLimiter
Token-bucket rate limiter keyed by client identifier (API key or remote IP).
RunRequest
Request body for POST /run.
RunResponse
Successful response from POST /run.
SessionDetailResponse
Detail response for GET /sessions/:id.
SessionInfo
Serialized session info for list/detail endpoints.
SessionMessageRequest
Request body for POST /sessions/:id/messages.
SessionMessageResponse
Response body for POST /sessions/:id/messages.
SessionState
Internal session state (not directly serialized to clients).
SetGoalRequest
Request body for POST /sessions/:id/goal.
SlashCommandInfo
One slash command entry in GET /slash-commands.
ToolInfo
Serializable tool info for the /tools endpoint.
UsageInfo
Token/step usage information.

Enums§

SseContentBlock
A single block of message content (mirrors Claude Agent SDK’s TextBlock / ToolUseBlock). Emitted as part of SseEvent::Message so SDK clients can iterate for block in msg.content without doing a second round-trip to the session detail endpoint.
SseEvent
Server-Sent Event payload emitted during an agent session run.

Functions§

build_openapi_spec
Build a static OpenAPI 3.0.3 specification describing all API endpoints.
build_router
Build the axum Router with all API routes.
build_router_with_auth
Build the HTTP router with an explicit AuthConfig.
build_router_with_auth_and_rate_limit
Build the HTTP router with an explicit AuthConfig AND an explicit RateLimiter.
map_agent_event
Map an AgentEvent to an SseEvent for broadcasting to SSE clients.