Concepts
In this sectionHow 10xGraph runs your agents, tools and tasks behind an API server with auth, tenant isolation, durable state, background jobs and observability.
- 14 pages
- About 79 min to read all
10xGraph is open-source, self-hosted infrastructure for AI applications. You write the agents, tools and tasks; 10xGraph runs them behind an API server with authentication, role-based access, tenant isolation, durable state in Postgres and Redis, background jobs, metrics and tracing, and generates Docker and Kubernetes deploy files.
This section explains both halves. Around your code sit the API server, security and access, data and state, background jobs, observability and deployment. Inside it is the agent model: a graph of nodes that share state and messages. Read the pages in either order. For what the server gives you once your agent is built (auth, limits, durability, scaling), go to Platform.
Three-layer architecture
10xGraph is built in three independent layers. You can use just the Python library for agents in a script, or add the API server and TypeScript client to serve agents over HTTP.
flowchart TB
subgraph "Python library (10xgraph)"
Graph[StateGraph · Agent · ToolNode]
Storage[Checkpointer · Memory Store · Media Store]
end
subgraph "API and CLI (10xgraph-api)"
CLI["10xgraph CLI"]
API[FastAPI Server]
end
subgraph "TypeScript client (10xgraph-client)"
SDK[TenxGraphClient]
end
SDK -->|HTTP / SSE / WS| API
CLI --> API
API --> Graph
Graph <--> Storage
| Layer | Package | What it does |
|---|---|---|
| Core library | 10xgraph (import tenxgraph) |
Graph engine, agents, tools, state, checkpointing, memory stores, media handling, publishers. Use this to build agents locally or embed graphs in your own apps. |
| API server & CLI | 10xgraph-api (import tenxgraph_api, command 10xgraph) |
FastAPI server that wraps your compiled graph, REST and WebSocket endpoints, auth, authorization, rate limiting, thread management. Use this to serve agents over HTTP. |
| TypeScript client | 10xgraph-client (npm 10xgraph-client) |
Typed HTTP wrapper for browser and Node.js, handles auth, streaming, thread management, file uploads. Use this to call the server from your frontend or backend. |
For what happens to one HTTP request, see Serving agents; for streaming, see Streaming.
The execution model
Inside your code, an agent is a graph: nodes (functions, Agent, ToolNode) connected by edges, all reading and writing one shared state whose context holds the conversation as Message objects. Start with StateGraph, then State and messages.
What’s in this section
Foundations
Start here to understand the execution model in depth: state graphs, messages, agents, tools, routing, dependency injection, and streaming.
- StateGraph: The core workflow engine, how compile() wires everything, and recursion limits.
- State and messages: Message structure, content blocks, state reducers, and the message catalog.
- Agents and tools: Why Agent exists, how ToolNode dispatches (parallel by default), MCP, and tool errors.
- Choosing a building block: When to use a plain node vs Agent vs prebuilt agent vs custom graph.
- Routing, Command and callbacks: Conditional edges, the Command API, and callback handling.
- Interrupts: Human-in-the-loop: pausing execution, saving checkpoints, and resuming.
- Dependency injection: Why DI vs globals, and the injectable parameters you can request.
- Streaming: Python streaming granularity, why stream, and transport summary.
Reliability
Keep agents robust: context trimming, tool replay safety, and error handling.
- Context management: Why context grows, message trimming vs summarization, and trade-offs.
- Replay-safe tools: How tool ledgers prevent duplicate execution on resume.
- Errors and limits: Exception types, recursion limits, timeouts, and retry policies.
Tools, media and extension
- Remote tools: When to use remote tool execution.
- Media and files: Media refs, offload policies, storage backends, and provider file APIs.
- Extension points: The base classes you can subclass: BaseAgent, BaseCheckpointer, BaseStore, BaseAuth, and more.
Topic pages in other sections
These pages explain how a feature works. They now sit next to the guides for that feature, and their URLs have not changed.
- Data and state: Checkpointing and threads, How PgCheckpointer works, Long-term memory and Cache store.
- Observability: Events and observability.
- Security and access: Tenancy and access and Security and validators.
- API server: Serving agents.
Next steps
- Get started: Build your first agent, step by step.
- Build agents: Task guides for everything from custom nodes to prebuilt agents to production patterns.
- API server: Serve agents over HTTP with auth, rate limiting, and observability.
- TypeScript client: Call the server from your app with the typed client.
- Reference: API signatures, CLI flags, environment variables, and error codes.
All pages in Concepts
Foundations
- StateGraphHow StateGraph models an agent as nodes, edges and shared state: build a graph, add conditional edges, compile and run it, and handle recursion limits.8 min
- State and MessagesHow AgentState holds conversation history, how Message carries multimodal content blocks, and how add_messages and custom state subclasses update state.6 min
- Agents and ToolsHow Agent wraps a model call with prompts, retries and fallbacks, why ToolNode is needed to run tools and MCP, and how parallel tool dispatch and errors work.5 min
- Choosing a building blockDecide between a prebuilt agent, the Agent node in a StateGraph, and a plain function node, based on your pattern and how much control you need.6 min
- Routing, Command and callbacksChoose between conditional edges, Command and callbacks: route by state or dynamically, and use a CallbackManager to validate and log LLM and tool calls.6 min
- Interrupts: human-in-the-loopPause a graph with interrupt() inside a node or tool to ask a human for approval or input, inspect the paused thread, then resume it with the answer.7 min
- Dependency InjectionHow 10xGraph injects framework parameters and your own services, such as database clients, the store and the checkpointer, into nodes and tools.3 min
- StreamingWhy and how to stream agent responses in Python: invoke versus stream, the StreamChunk model, ResponseGranularity, astream(), stopping a stream, transports.4 min
Reliability
- Context managementKeep the model context window in check as conversations grow: trim history with MessageContextManager or summarize it with SummaryContextManager, and pick one.4 min
- Replay-safe toolsReplay-safe tools let a resumed 10xGraph run skip tool calls that already finished, so a crash does not charge a card or send an email twice.6 min
- Errors and limitsThe 10xGraph exception taxonomy, including GraphError, NodeError and storage errors, plus node timeouts, recursion limits, retries and what clients see.9 min
Tools, media and extension
- Remote ToolsHow a Python graph asks a TypeScript client or browser to run a tool: the server holds the schema, the client runs the handler, set in 10xgraph.json or code.3 min
- Media and FilesHow 10xGraph handles media in multimodal messages: MediaRef decouples location from structure, storage backends serve files, and providers adapt automatically.5 min
- Extension pointsCustomize 10xGraph by subclassing base classes such as BaseCheckpointer and BaseStore for storage, auth, LLM calls, IDs and events, leaving graph logic alone.7 min