API server

In this sectionThe 10xGraph API server handles FastAPI endpoints for invocation, streaming, threads, memory, media and observability, with auth, rate limiting and WebSocket.

  • 11 pages
  • About 80 min to read all

The 10xGraph API server runs your compiled graph behind authentication, role-based access, per-user data isolation, durable thread state, rate limits, metrics and logs. Your graph code stays free of infrastructure code.

What the server does for you

Running your graph behind 10xgraph-api gives you these guarantees without code in your agent. Each row links to the page that explains it.

Guarantee What it means Details
Authentication JWT or your own BaseAuth on every route except /ping and /health/ready. You must configure it: auth: null is allowed, even in production. Authentication
Ownership isolation With auth on, every query is filtered by the caller’s role reach (own by default, or tenant / all if you configure it). A thread outside the caller’s reach answers 404 before the model runs. Runs and state writes always stay on the caller’s own threads. Thread ownership
Scoped authorization Per-route scopes, and a boot-time route guard that refuses to start if any non-public route has no permission check. Authorization scopes
Input rules Request size limit, client messages limited to the user role, built-in state fields not writable, current_node and state values validated. Invoke and stream, CORS and security headers
Rate limits and run caps Sliding-window limits (counters in the cache store: memory or Redis) and a per-run timeout (300 s by default in production). Rate limiting
Production mode MODE=production validates itself at startup, turns off /docs, and hides 5xx error text. Production checklist
Durable state Threads, state and messages go through your checkpointer; with PgCheckpointer they survive restarts and are shared across replicas. Backup and restore, Kubernetes
Deploy files 10xgraph build writes a non-root Dockerfile and optional Compose and Kubernetes files. Deploy
Observability Metrics (off until you configure metrics), JSON logs with LOG_FORMAT=json, an optional audit log, Sentry and OpenTelemetry hooks, and per-thread run traces in development. Observability

For the reasoning behind these and the limits of what the server protects, read Production readiness, the security model and what 10xGraph does not protect.

For how the server loads and runs your graph, read Serving agents.

API routes by function

The server organizes its endpoints into logical groups. Here is the complete route map:

Group Prefix Auth required What it does
Health /ping No Unauthenticated liveness check (the Prometheus scrape path, when on, is also public); returns 200 OK while the process is up. /health/ready (also unauthenticated) checks the backends and returns 200 or 503. Used by load balancers and orchestrators.
Graph /v1/graph/* Yes Invoke and stream the graph (invoke, stream), read its structure (GET /v1/graph, GET /v1/graph/tools), manage runs (stop, fix), and read the state schema (GET /v1/graph:StateSchema). Streaming returns NDJSON (one event per line).
Threads /v1/threads/* Yes List and delete threads; read, update and clear thread state; list, read and delete messages, and set message feedback. Requires a checkpointer; without one, threads are not persisted.
Tasks /v1/tasks/* Yes Start, schedule, read and cancel background tasks run by 10xgraph worker. Only on with a worker key in 10xgraph.json; see Background tasks.
Store /v1/store/* Yes Semantic memory CRUD and search: save memories, list and retrieve them, forget specific entries, and search across all stored memories. Requires a store backend; see Use memory store.
WebSocket /v1/graph/ws, /v1/graph/live Yes Two WebSocket endpoints for streaming: /ws for traditional streaming (events as JSON frames), /live for realtime audio and bidirectional messaging. Choose based on your transport needs.
AG-UI /v1/ag-ui Yes Run the graph over the AG-UI protocol for CopilotKit and other AG-UI-compatible clients. Off by default; enable with ag_ui.enabled: true in 10xgraph.json. Requires the ag-ui SDK extra.
Media/Files /v1/files/* Yes Upload, retrieve, and introspect multimodal files (images, audio, documents): POST /v1/files/upload, GET /v1/files, GET /v1/files/{id}, /info, /url (signed URL) and DELETE /v1/files/{id}.
Config /v1/config/multimodal Yes Read the server’s multimodal configuration (supported MIME types, size limits, extraction settings).
Observability /v1/observability/{thread_id} Yes Retrieve a reconstructed run trace for a thread (spans, events, token usage). Development only: returns empty in MODE=production.

For detailed route signatures and response shapes, see the REST API reference.

What MODE=production changes is listed in the production checklist.

All pages in API server

  1. Serving AgentsHow the 10xGraph API server loads your compiled graph once at startup, reads 10xgraph.json, and passes each request through rate limiting, auth and its route.2 min

Basics

  1. Run the API ServerStart the 10xGraph dev server with 10xgraph dev, and run it in production with the image from 10xgraph build (Gunicorn, or one Uvicorn process with --k8s).4 min
  2. Configure 10xgraph.jsonSet the common 10xgraph.json keys: point agent at your compiled graph, wire a checkpointer, store and auth, and keep a separate config for each environment.11 min
  3. Initialize a ProjectScaffold a 10xGraph project with 10xgraph init using interactive prompts or flags like --mode, --provider and --storage, and see what each setup generates.5 min
  4. CLI OverviewQuick reference for the 10xgraph CLI from the 10xgraph-api package: init, dev, build, worker, scheduler, test, eval, config and audit, and what each does.5 min

Interfaces

  1. Invoke and stream over RESTCall your graph over HTTP with POST /v1/graph/invoke, stream results as NDJSON, manage per-user threads, and stop or fix runs on the 10xGraph API server.12 min
  2. WebSocket streaming and realtimeUse the /v1/graph/ws endpoint for turn-based agent streaming and /v1/graph/live for realtime audio, with bearer auth through the 10xgraph-bearer subprotocol.11 min
  3. Serve your agent over AG-UIEnable the AG-UI endpoint at /v1/ag-ui with the ag-ui extra and the ag_ui key in 10xgraph.json, then test it with curl and connect frontends like CopilotKit.5 min
  4. Handle files and multimodal inputLet clients upload images, audio and documents to your 10xGraph agent via POST /v1/files/upload, then send a file_id the server resolves before model calls.13 min
  5. Remote toolsConfigure client-executed tools on the server: define them in the remote_tools array of 10xgraph.json, attach them to graph ToolNodes, and let clients run them.5 min

Tools

  1. PlaygroundRun 10xgraph dev to open the hosted playground, allow Chrome to reach your local server, and chat with your agent and inspect its threads and runs.7 min