Get started
In this section10xGraph is a production-grade Python framework for multi-agent AI systems. Install the library, build an agent, deploy the API server, and call it from TypeScript.
- 12 pages
- About 75 min to read all
10xGraph is an open-source Python framework for building and deploying multi-agent LLM systems. You write the agent graph in Python. 10xGraph generates the REST, WebSocket and realtime audio server around it, enforces thread ownership and access control, stores state durably, and generates Docker files. A tool that finished before a crash is not run twice on replay.
What you get
10xGraph consists of three parts that work together: a Python library for building agents, an API server that turns agents into services, and a TypeScript client for integrating those services into applications.
The Python library
The core library (10xgraph, imported as tenxgraph) is the orchestration engine. Nodes are computation (an agent that calls an LLM, or a plain function), edges control the flow, and state moves through the graph as it runs.
Start with the prebuilt ReactAgent, which loops between the model and its tools. Build a custom StateGraph when you need non-linear routing, custom state or multi-agent handoffs. Tools run in parallel by default, memory has three layers (working state, durable checkpoints, long-term vector stores), MCP tools load dynamically, and OpenAI, Google GenAI and Anthropic are supported through one interface.
The example below is a support agent that looks up orders and issues refunds. Run it with your provider key set, for example GEMINI_API_KEY.
pip install "10xgraph[google-genai]"# A support agent with two plain Python functions as tools
from tenxgraph.prebuilt.agent import ReactAgent
from tenxgraph.storage.checkpointer import InMemoryCheckpointer
def lookup_order(order_id: str) -> dict:
"""Look up an order by id and return its status and total."""
return {"order_id": order_id, "status": "delivered", "total": 59.0}
def refund_order(order_id: str, amount: float) -> str:
"""Refund an order. This moves money, so it must run exactly once."""
return f"Refunded {amount:.2f} for order {order_id}"
app = ReactAgent(
model="google/gemini-2.5-flash",
provider="google",
system_prompt=[{"role": "system", "content": "You are a support agent for an online shop."}],
tools=[lookup_order, refund_order],
).compile(checkpointer=InMemoryCheckpointer())The API server and CLI
The API server (10xgraph-api, imported as tenxgraph_api) serves your compiled graph with no extra code. A config file points at the agent, and the server exposes REST and WebSocket endpoints, access control, rate limiting, thread management and a long-term memory store. The 10xgraph CLI scaffolds projects, runs the server and generates Docker and Kubernetes files.
Install it with pip install 10xgraph-api. Then create a 10xgraph.json file that points at the app object in agent.py:
{
"agent": "agent:app",
"env": ".env"
}Start the API server from the folder that holds both files:
# Starts on http://127.0.0.1:8000
10xgraph apiThe server listens on http://127.0.0.1:8000 with a Swagger UI at /docs. Requests pass through authentication (JWT or custom), authorization (thread ownership and role scopes) and rate limiting when you configure them. POST /v1/graph/invoke runs the agent and returns the result, POST /v1/graph/stream streams chunks as NDJSON, and /v1/graph/ws is a WebSocket for bidirectional streaming. The /v1/threads routes expose a thread’s state and messages.
Test the server with curl:
curl -X POST "http://localhost:8000/v1/graph/invoke" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": [{"type": "text", "text": "Where is order 1042?"}]}],
"config": {"thread_id": "test-001"}
}'Or open the interactive playground:
10xgraph playThe TypeScript client
The TypeScript client (10xgraph-client, class TenxGraphClient) is a typed interface to the API. It sends the bearer token, parses the NDJSON stream into typed chunks, and covers invoke, stream, threads, memory and files. It does not ship React hooks.
import { TenxGraphClient, Message } from "10xgraph-client";
// Omit authToken when the server runs without auth
const client = new TenxGraphClient({
baseUrl: "http://localhost:8000",
authToken: "your-jwt-token",
});
// Invoke the agent and read the final messages
const result = await client.invoke(
[Message.text_message("Where is order 1042?")],
{ config: { thread_id: "test-001" } },
);
console.log(result.messages);
// Or stream chunks as they arrive
for await (const chunk of client.stream(
[Message.text_message("Refund order 1042 for $50")],
{ config: { thread_id: "test-001" } },
)) {
console.log(chunk.event, chunk.message);
}What’s included
The framework comes with production-ready features out of the box, no configuration needed unless you want to customize them:
| Feature | What you get |
|---|---|
| API server | REST endpoints (/v1/graph/invoke, /v1/graph/stream), WebSocket (/v1/graph/ws), realtime audio (/v1/graph/live), Swagger UI, and a memory store API |
| Security | JWT or custom authentication, owner-only thread access, role-based access control on every endpoint, rate limiting (memory, Redis, or custom backend) |
| Reliability | Replay-safe tools ensure no double execution, versioned state writes prevent race conditions, configurable node and tool timeouts |
| State and memory | Working state in memory, durable checkpoints in SQLite or Postgres+Redis, long-term facts in Qdrant or Mem0 vector stores |
| Prebuilt agents | Ready-made agents for common patterns: ReactAgent (tool-calling loop), RAGAgent (retrieval), SupervisorTeamAgent (task routing), SwarmAgent (peer handoff), PlanActReflectAgent (multi-step reasoning), StructuredOutputAgent (typed output), AudioAgent (audio) |
| Deployment | 10xgraph build --docker-compose --k8s generates a Dockerfile, docker-compose.yml and k8s.yaml; 10xgraph init scaffolds a production-ready project structure |
| Observability | Logs, traces (OTEL, Logfire, LangSmith), metrics, Sentry error tracking, and a callback system for custom monitoring |
| Tools | A prebuilt tool library covering web (fetch, search), files, memory, calculator and handoff, plus support for the Model Context Protocol (MCP) for dynamic tools |
Prerequisites
To get started, you need:
- Python 3.12 or newer
- An API key for one LLM provider:
OPENAI_API_KEY,GEMINI_API_KEY(orGOOGLE_API_KEY), orANTHROPIC_API_KEY - Node 18 or newer and npm (optional, for the TypeScript client)
Reading order
Follow this path to go from zero to a deployed agent:
| Step | Duration | What you’ll learn |
|---|---|---|
| Installation | 5 min | Install the Python library, API server, and TypeScript client; set up API keys |
| Quickstart: First agent | 10 min | Build a working agent with two tools, serve it over HTTP, and call it from curl and TypeScript |
| Tutorial: Mental model | 10 min | Understand the core concepts: messages, state, nodes, edges, graphs, agents, and threads |
| Tutorial: Build a graph | 15 min | Build a graph by hand, add tools, and understand when to use ReactAgent vs custom graphs |
| Tutorial: Threads and memory | 10 min | Run agents with persistent memory across invocations using checkpointers |
| Tutorial: Serve and inspect | 10 min | Serve your graph with the API server, use the Swagger UI and playground, and read thread state |
| Tutorial: Call from your app | 10 min | Build a front-end with the TypeScript client, handle streaming, and manage sessions |
| Project structure | 5 min | See what the production template generates and where each piece lives |
The tutorial builds on one agent across its steps, so follow it in order. Skip it if you only want a running server: the quickstart is enough.
The next major section, Concepts, explains how everything works under the hood. Guides covers task-oriented recipes (add memory, use MCP, deploy to Kubernetes), and API reference documents every class, function, and route.
Rename note
10xGraph was published under the name “Agentflow” until 2026. The Python library now imports from tenxgraph (for example from tenxgraph.core.graph import StateGraph), the PyPI package is 10xgraph, and the command is 10xgraph. The old agentflow imports still work as a deprecated alias until version 2.0. The old package name 10xscale-agentflow is no longer updated; install 10xgraph instead.
All pages in Get started
- Introduction10xGraph is an open-source Python framework for production multi-agent AI: a core library, an API server and CLI, and a TypeScript client.4 min
- InstallationInstall 10xGraph and the API server with pip on Python 3.12 or newer, add provider extras and a checkpointer, verify the CLI, and install the TypeScript client.5 min
- QuickstartInstall 10xGraph, build a support agent in Python, serve it with the API server, then call it with curl and the TypeScript client.7 min
Tutorial
- Mental ModelLearn the seven ideas behind every 10xGraph agent (message, state, node, edge, graph, agent, thread) and the seven tutorial steps that build on them.7 min
- Build a graph by handBuild a 10xGraph agent with a tool by hand, route between the agent and tool nodes, then compare it with ReactAgent.6 min
- Add Memory with ThreadsGive your agent conversation memory with thread IDs and checkpointers, persist state across calls, and tell thread memory apart from long-term memory.5 min
- Serve and inspectStart the 10xGraph API server, test with curl, and use the playground to inspect your agent's behavior.6 min
- Call from your appCall your running 10xGraph agent server from a TypeScript app with 10xgraph-client: invoke, stream, keep a thread and send an auth token.7 min
- Stream and approveStream an agent run in Python with astream(), pause it for human approval with interrupt(), then resume the same thread with a decision.6 min
- Test and evaluateWrite a unit test with a mocked model, then run a small evaluation set against your weather agent with the 10xgraph eval command.6 min
Next steps
- Project structureThe files that 10xgraph init --template production generates, what each one does, and which 10xgraph.json keys init writes for you.11 min
- Coming from agentflowMigrate from the old Agentflow package, import, command, config and environment variable names to 10xGraph, step by step.5 min