Reference

In this sectionReference for 10xGraph: the Python library, the REST and WebSocket API, the CLI and 10xgraph.json configuration, and the typed TypeScript client.

  • 56 pages
  • About 565 min to read all

The 10xGraph reference documents four surfaces of one system: the Python library, the REST and WebSocket API that the server generates from your graph, the CLI with its 10xgraph.json configuration, and the TypeScript client. It is for developers who already know what they want to call and need exact signatures, options and error conditions. Pick the surface you are calling from.

If a signature, default or error here does not match the code, the code is right. Please open a pull request with the fix: use Edit this page on GitHub at the bottom of the page, or Report an issue if you are not sure.

Start here

Python developers should open Graph and Agent first: they define StateGraph, CompiledGraph, invoke, stream and how a model is wired into a node. Checkpointers matters for production, because durable threads and replay-safe tool calls depend on one.

If you run the server, the CLI commands and configuration pages cover every 10xgraph.json key, with auth and rate limiting for the production settings. Before launch, read Production readiness, the security model and Test before production. Frontend developers should start with the client and stream pages. The REST contract starts at conventions and the graph endpoints.

If you do not yet know which call you need, the guides are organized by task.

Python library

The graph engine, agents, tools, state, storage, and the evaluation harness. Everything importable from tenxgraph.*. The agentflow import is a deprecated alias until version 2.0; use tenxgraph in new code. The A2A protocol bridge is not available yet.

Core building blocks

Page Covers
Graph StateGraph, CompiledGraph, nodes, edges, START, END, compile, invoke, stream
Agent Agent, BaseAgent, ToolNode, how a model is wired into a node
State AgentState, state type hints, reducers
Messages Message, content blocks, message reducers

Tools and control flow

Page Covers
Tools ToolNode, tool metadata, ToolResult, MCP integration
Control flow Command, interrupt(), handoff, conditional routing
Callbacks CallbackManager and invoke callbacks
Lifecycle callbacks GraphLifecycleHook, on_graph_start, on_graph_end, on_graph_error

State and memory

Page Covers
Checkpointers InMemoryCheckpointer, SqliteCheckpointer, PgCheckpointer, durability
Memory stores Cross-thread memory, vector backends, search
Context manager MessageContextManager, SummaryContextManager, context trimming

Streaming and I/O

Page Covers
Stream emitter StreamEmitter and streaming events from inside tools
Media MediaRef, MultimodalConfig, media storage backends

LLM and observability

Page Covers
LLM call_llm, provider detection, client creation, timeouts
Publishers Event publishers for streaming and observability
ID generator Custom ID generation for distributed systems
Runtime utilities Graceful shutdown, logging, message conversion, metrics

Advanced

Page Covers
Exceptions GraphError, NodeError, GraphRecursionError, StaleStateError
Prebuilt agents Constructor options for all agent types
Prebuilt tools Fetch, file, search and calculator tools (deprecated in 1.1.0), plus memory and handoff tools
Background tasks Long-running tasks during graph execution
Adapters Convert OpenAI, Google GenAI and Anthropic responses to Message
Realtime Realtime audio I/O
Skills Load Agent Skills into agents

Testing and evaluation

Page Covers
Testing TestAgent, QuickTest, MockToolRegistry, MockMCPClient
Evaluation EvalSet, EvalCase, EvalCaseResult, EvalReport
Evaluation criteria Every criterion class and how to choose one
Evaluation harness Pytest helpers, batch runners and reporters

REST and WebSocket API

What the API server exposes once the server is running (10xgraph dev locally, Gunicorn in the image from 10xgraph build).

The server generates its own OpenAPI schema, so the authoritative contract for your build is always available locally:

Surface Default path Setting
Swagger UI http://127.0.0.1:8000/docs DOCS_PATH
ReDoc http://127.0.0.1:8000/redocs REDOCS_PATH
OpenAPI JSON http://127.0.0.1:8000/openapi.json On while either DOCS_PATH or REDOCS_PATH is set

Set both DOCS_PATH and REDOCS_PATH to empty values in production to turn off the interactive docs and the raw schema at /openapi.json.

Page Covers
Conventions HTTP contract, error shape, status codes
Graph /v1/graph/invoke, /v1/graph/stream, /v1/graph/stop, /v1/graph/fix
Live WebSocket /v1/graph/live for bidirectional streams and realtime audio
Threads /v1/threads, conversation history and management
Memory store /v1/store, cross-thread memory operations
Files /v1/files, upload, download and signed URLs
Config /v1/config/multimodal, server configuration
Observability /v1/observability/{thread_id}, run inspection
AG-UI /v1/ag-ui, AG-UI protocol
Ping /ping, health checks

CLI and configuration

Page Covers
Commands init, dev, build, config, eval, test, skills, audit, demo, version
Configuration Every 10xgraph.json key and per-environment overrides
Environment Every environment variable the server reads
Auth JWT configuration and custom BaseAuth extension
Rate limiting Rate limit backends and configuration

TypeScript client

The 10xgraph-client package, framework-agnostic and fully typed.

Basics

Page Covers
Client Construction, options, and authentication
Invoke Synchronous agent invocation
Stream Event streaming and NDJSON chunks

State and threads

Page Covers
Threads Thread creation and history
Graph Graph information and utilities
Message Message type definitions

Features

Page Covers
Memory Long-term memory operations
Files File upload and multimodal content
Realtime Realtime audio sessions
Auth Authentication options
Errors Error classes and error handling

Errors

Page Covers
Error codes Full catalog of error codes and causes

Conventions used here

  • Signatures are the real ones. If a page and the source disagree, the source is right and the page is a bug. Please report it.
  • Defaults are stated explicitly, including when the default is None.
  • Error codes are listed with the condition that raises them. The full index is in error codes.

Reference pages describe what things are. For task-shaped questions, start from the guides.

All pages in Reference

Python library

  1. GraphReference for StateGraph, CompiledGraph, Node, Edge, BaseAgent and RemoteToolConfig: signatures, parameters, returns, config keys and errors.16 min
  2. AgentReference for the Agent class: constructor parameters, providers, retry and fallback, reasoning, memory, multimodal limits, and common errors.15 min
  3. ToolsRegister Python functions and MCP tools with ToolNode, build JSON schemas from type annotations, run calls in parallel, and use ToolResult and @tool.11 min
  4. StateReference for AgentState, ExecutionState, ExecutionStatus and the reducer functions in tenxgraph.core.state, with signatures, fields and examples.7 min
  5. MessagesReference for Message, the twelve content block types, MediaRef, AnnotationRef and TokenUsages, the typed format for all agent communication.10 min
  6. Context ManagerReference for MessageContextManager, SummaryContextManager and BaseContextManager, which trim or summarize message history before each LLM call.7 min
  7. LLM UtilitiesMake single-turn calls to Google, OpenAI or Anthropic outside a graph with call_llm, and detect the provider with resolve_provider_and_model.7 min
  8. SkillsGive agents on-demand instructions with SkillConfig, SkillMeta and SkillsRegistry, load SKILL.md directories, and handle SkillDiagnostic and SkillResourceError.11 min
  9. Realtime audioPython API reference for live audio-to-audio agent sessions with Gemini Live, including AudioAgent, RealtimeConfig, LiveInputQueue and RealtimeEvent.15 min
  10. StreamEmitterReference for StreamEmitter, the object injected into tools during streaming that sends live progress, error and message chunks to the caller.6 min
  11. ExceptionsPython reference for the 10xGraph exception hierarchy in tenxgraph.core.exceptions: GraphError, NodeError, storage, timeout and media errors with codes.13 min
  12. Control flowSteer a graph from inside nodes: Command for state updates and routing, interrupt() to pause for human input, and create_handoff_tool for agent handoffs.8 min
  13. Callback ManagerReference for CallbackManager, InvocationType, CallbackContext, the three callback base classes, and the prompt injection and message validators.8 min
  14. Lifecycle CallbacksRun code at graph start, end, error, interrupt, resume, checkpoint and state update by subclassing GraphLifecycleHook, with GraphLifecycleContext fields.6 min
  15. Background Task ManagerRun fire-and-forget async work from a node with BackgroundTaskManager: inject it, then create, track, wait for, cancel and shut down tasks, with a timeout.5 min
  16. ID GeneratorChoose or write the ID format for threads, runs and messages: pass UUIDGenerator, ShortIDGenerator or your own BaseIDGenerator to StateGraph(id_generator=...).7 min
  17. Runtime utilitiesUse tenxgraph.utils helpers: GracefulShutdownManager for SIGINT and SIGTERM, secret redaction for logs, sync or async calling, message conversion and metrics.11 min
  18. PublishersReference for EventModel, BasePublisher, the Console, Redis, Kafka, RabbitMQ, OTEL, Phoenix, Logfire and LangSmith publishers, and publish_event.26 min
  19. Response adaptersConvert OpenAI, Google GenAI and Anthropic responses into 10xGraph Message objects with OpenAIConverter and related classes, or subclass BaseConverter.5 min
  20. CheckpointersPersist graph state, messages and threads with BaseCheckpointer, InMemoryCheckpointer, PgCheckpointer and SqliteCheckpointer, with import paths and extras.16 min
  21. Memory storesKeep long-term agent memory across threads with BaseStore, PgVectorStore, QdrantStore, embedding classes, MemoryConfig and ReadMode, with install extras.25 min
  22. MediaHandle images, audio, video and documents in messages: offload base64 blobs to graph://media refs with ensure_media_offloaded and MediaOffloadPolicy.14 min
  23. Prebuilt agentsAPI reference for built-in agent patterns: ReactAgent, RAGAgent, PlanActReflectAgent, StructuredOutputAgent, SupervisorTeamAgent, SwarmAgent, and AudioAgent.23 min
  24. Prebuilt toolsReference for the 10xGraph prebuilt tools safe_calculator, fetch_url, google_web_search, vertex_ai_search and file tools, with signatures and deprecation notes.10 min
  25. TestingTest graphs without LLM calls using TestAgent, QuickTest, TestContext and mocks from tenxgraph.qa.testing, and run quick evaluations with QuickEval.9 min
  26. EvaluationScore a 10xGraph agent on labelled datasets with EvalSet, EvalConfig, EvalPresets and AgentEvaluator, and wire a TrajectoryCollector to a compiled graph.18 min
  27. Evaluation criteriaSignatures, constructor parameters and report names of every evaluation criterion class in tenxgraph.qa.evaluation, plus how to write one with BaseCriterion.12 min
  28. Evaluation harnessRun agent evaluations from pytest with QuickEval, batch runners, reporters and result models in tenxgraph.qa.evaluation, with signatures and examples.14 min

REST API

  1. Conventions and permissionsThe 10xGraph REST API response envelope, HTTP and WebSocket authentication, the endpoint permission table, WebSocket close codes and HTTP status codes.7 min
  2. Graph endpointsReference for the 10xGraph REST endpoints that invoke, stream, stop, and inspect a graph, with request bodies, responses, and auth requirements.15 min
  3. Live WebSocket endpointReference for WS /v1/graph/live: real-time audio WebSocket bridge for LiveAgent graphs. Init frame, binary and JSON frames, authentication, close codes.6 min
  4. AG-UI endpointPOST /v1/ag-ui runs a 10xGraph graph over the AG-UI protocol: the RunAgentInput request, server-sent event stream, interrupts, client tools, auth, errors.7 min
  5. Thread endpointsReference for the 10xGraph REST endpoints that read and write thread state and messages, with request fields, responses, and auth requirements.8 min
  6. Memory store endpointsReference for /v1/store endpoints: storing, searching, listing, updating, deleting, and forgetting memories through the 10xGraph API server.8 min
  7. File upload endpointsReference for the 10xGraph REST endpoints that upload files and retrieve them, with request fields, responses, and authentication requirements.5 min
  8. Configuration endpointsReference for the 10xGraph REST config endpoint GET /v1/config/multimodal: permission, response fields, defaults, errors and a curl example.1 min
  9. Observability endpointsCall GET /v1/observability/{thread_id} to get a reconstructed run trace: span tree, event list, token usage and call counts, with limits and empty results.5 min
  10. Health check endpointGET /ping and GET /health/ready are the unauthenticated liveness and readiness probes of the 10xGraph API server, for Kubernetes, Docker and load balancers.2 min

CLI and configuration

  1. CLI referenceEvery 10xGraph CLI command with its purpose, usage, options and defaults: init, dev, build, worker, scheduler, eval, test, skills, audit, config, version.9 min
  2. 10xgraph.json configuration referenceEvery key the 10xgraph.json config file accepts, with defaults, types, purposes, and complete examples for rate limiting, auth, and servers.13 min
  3. AuthenticationSet up 10xGraph API authentication: open by default, JWT with JWT_SECRET_KEY and JWT_ALGORITHM, custom BaseAuth classes, plus roles, permissions and reach.12 min
  4. Rate LimitingConfigure the cache_store.rate_limit block in 10xgraph.json: requests, window, bucket keys (ip, user, global), trusted proxies, exclude_paths and fail_open.4 min
  5. BaseCacheStore referenceReference for BaseCacheStore, the API server's shared-state interface: every method with its signature, what it must do, and the rules a custom store keeps.3 min

TypeScript client

  1. TenxGraphClientReference for TenxGraphClient in 10xgraph-client: npm install, the TenxGraphConfig constructor fields, its methods for invoke, stream and threads, and exports.11 min
  2. Graph controlReference for graph-control methods on the TypeScript client: ping, graph, graphTools, observability, graphStateSchema, stopGraph, and fixGraph.9 min
  3. MessageBuild user, assistant, system and tool messages with the Message class of the 10xGraph TypeScript client: its factory methods, fields and all 12 content blocks.11 min
  4. invoke()Call TenxGraphClient.invoke() with Message objects to run the agent graph, run remote tool handlers automatically, and read the final InvokeResult.8 min
  5. stream()Stream agent output with TenxGraphClient.stream(): iterate StreamChunk objects as they arrive, with options such as on_busy and resume, and StreamEventType.7 min
  6. realtime()Open an audio-to-audio session with client.realtime() and RealtimeSession over the /v1/graph/live WebSocket: RealtimeInit options, PCM16 streaming and events.10 min
  7. ThreadsList, read, update and delete conversation threads with TenxGraphClient methods such as threads, threadState, threadMessages and deleteThread, with HTTP routes.7 min
  8. MemoryReference for memory store methods in the 10xGraph TypeScript client: store, search, retrieve, update and delete memories, with type filter and similarity.10 min
  9. FilesUpload files with TenxGraphClient.uploadFile, then use getFile, getFileInfo and getFileAccessUrl, and place the returned file_id and url in a MediaRef block.6 min
  10. Client authenticationAuthenticate TenxGraphClient with a bearer token, HTTP Basic or a custom header using bearerAuth, basicAuth and headerAuth, and see how WebSocket auth works.8 min
  11. Error handlingLook up each TypeScript client error class, such as TenxGraphError, GraphRecursionError and RateLimitError, how it maps from the error code or HTTP status.11 min

Errors

  1. Error Codes ReferenceLook up every 10xGraph exception by error code, such as GRAPH_000 or NODE_TIMEOUT_001, with its retryable flag, the API's HTTP status and how to handle it.13 min

CLI and configuration

  1. Environment VariablesReference for every environment variable the 10xGraph API server recognizes, grouped by area such as auth, CORS, logging, and Snowflake ID settings.14 min