Configure 10xgraph.json
In shortTask guide for setting the common 10xgraph.json keys, wiring a checkpointer, store and auth, and keeping separate configs per environment.
- 14 min read
- 19 sections
- Updated
- v1.0.0
- Markdown
The 10xgraph.json file tells the API server which graph to load, how to persist state, who can access it, and how to manage resources. This guide covers the keys you need to configure for a working deployment. For a complete list of every key, type and default, see the configuration reference.
Minimal configuration
Only the agent key is required. It is a module:attribute path that resolves to a compiled graph:
{
"agent": "graph.react:app",
"env": ".env"
}The module is imported when the server starts. The app variable must be the result of calling state_graph.compile(). If the import fails, the server refuses to start with a clear error. Test your module path by hand before deploying:
python -c "from graph.react import app; print(type(app))"The env key names a dotenv file that the server loads before importing your graph module. Use it for local development secrets (API keys, database URLs). Never commit .env files to version control. In production, pass variables through your container or orchestration platform instead, so sensitive values never touch the filesystem.
Enable thread persistence with a checkpointer
The API server persists conversation history in a checkpointer that you wire into your graph at compile time. Pass it to compile() in your graph module:
# graph/dependencies.py
from tenxgraph.storage.checkpointer import PgCheckpointer
my_checkpointer = PgCheckpointer(
postgres_dsn="postgresql://user:password@localhost/10xgraph",
redis_url="redis://localhost:6379/0",
)# graph/react.py
from graph.dependencies import my_checkpointer
app = state_graph.compile(checkpointer=my_checkpointer)The server uses the compiled graph’s checkpointer; the checkpointer key in 10xgraph.json is recognized but not applied, so you can remove it if it is present.
Without an explicit checkpointer, compile() falls back to InMemoryCheckpointer, which keeps threads in memory while the process runs. This is fine for local development and testing, but in production it means:
- Conversations are lost when the process restarts.
- Each replica maintains its own separate history; the same user hitting a different pod sees a different thread history.
For production, use PgCheckpointer (Postgres + Redis). It requires pip install "10xgraph[pg_checkpoint]" and maintains thread history durably in Postgres while using Redis as a fast cache layer. See Set up checkpointing for the full setup, including SQLite for single-machine deployments.
Set up the memory store
The store key points at a BaseStore instance (not a class). Without it, the /v1/store/* endpoints report that no store is configured. The store powers long-term memory for your agents:
# graph/dependencies.py
from tenxgraph.storage.store import QdrantStore
from tenxgraph.storage.store.embedding import OpenAIEmbedding
# needs: pip install "10xgraph[qdrant,openai]"
my_store = QdrantStore(embedding=OpenAIEmbedding(), path="./qdrant_data"){
"agent": "graph.react:app",
"store": "graph.dependencies:my_store"
}The loader validates that the attribute is a BaseStore instance and fails at startup with a clear error if not. For tests, use tenxgraph.qa.testing.InMemoryStore, which satisfies the same interface.
Reference: BaseStore · Source: base_store.py
Wire up dependency injection
The injectq key points at an InjectQ container. Use it to inject services at startup that your nodes and tools need, such as a database session factory, an HTTP client, or configuration objects:
# graph/dependencies.py
import os
from injectq import InjectQ
class MyDatabase:
def __init__(self, dsn: str) -> None:
self.dsn = dsn
container = InjectQ()
container.bind_instance(MyDatabase, MyDatabase(dsn=os.environ["DATABASE_URL"])){
"agent": "graph.react:app",
"injectq": "graph.dependencies:container"
}The server loads your container at startup and makes it the global instance. Your services land in the same container as the server’s internal bindings, so they integrate seamlessly.
Generate readable thread names
thread_name_generator takes none (the default, also when the key is unset or null; threads stay unnamed but are saved), random (a random name), first_message (the user’s first message, whitespace collapsed, cut to at most 60 characters on a word boundary) or a module:attr path to your own generator. The server saves every generated name after the run. To write your own, subclass ThreadNameGenerator. It gets the user’s messages first, then the replies:
# graph/thread_name_generator.py
from tenxgraph_api.src.app.utils.thread_name_generator import ThreadNameGenerator
class MyThreadNameGenerator(ThreadNameGenerator):
async def generate_name(self, messages: list[str]) -> str:
# Generate a name based on the first message, an LLM call, or your own logic.
return "thoughtful-conversation"{
"agent": "graph.react:app",
"thread_name_generator": "graph.thread_name_generator:MyThreadNameGenerator"
}To pick a built-in choice, set "thread_name_generator": "first_message".
Thread names appear in logs, dashboards, and the /v1/threads API response, making it easier to identify conversations at a glance.
Enable authentication and authorization
These features have their own guides and require coordination:
| Feature | Guide | What it controls |
|---|---|---|
auth |
Authentication | Who can call the server (JWT, custom), what each role may do, and how far each role sees (own, tenant, all) |
cache_store.rate_limit |
Rate limiting | How many requests per window |
cache_store.token_revocation |
Authentication | Refuse tokens you revoked |
A minimally secured production config looks like this:
{
"agent": "graph.react:app",
"auth": "jwt",
"cache_store": {
"type": "redis",
"rate_limit": {
"enabled": true,
"requests": 100,
"window": 60,
"by": "user"
},
"token_revocation": true
}
}"auth": "jwt"requiresJWT_SECRET_KEY(at least 32 characters; shorter keys are rejected in production) andJWT_ALGORITHM(for exampleHS256) in the environment. See Authentication for custom auth.- With auth on, threads, memories and files are private to their owner by default (reach
own). A thread outside the caller’s reach answers 404. With the defaultruns.thread_idsof"server", ids the server did not create are refused too (seeruns.thread_ids). Addauth.rolesto grant fewer permissions or a wider reach. The oldauthorizationkey is removed and refuses to boot. "cache_store": {"type": "redis"}gives the API a Redis cache store, which shares the rate limit (and the run locks, caps and revocations) across all replicas. Without it the counters live in each process, so three replicas allow three times the configured limit, which is unsuitable for production.
Choose the cache store (rate limits, run locks, token revocation)
The API keeps everything it shares between workers in one cache store: the per-thread run lock, run and WebSocket caps, idempotency state, token revocation and rate-limit counters. One cache_store object picks it and also holds the two settings the store backs, rate_limit and token_revocation:
| Key | Meaning |
|---|---|
type |
memory (default, also when cache_store or type is absent), redis or custom. |
url |
Type redis only, optional. Empty uses the REDIS_URL environment variable. A value you set wins, as a literal or ${VAR}, so the cache store can use a different Redis than the checkpointer. |
path |
Type custom only, required. A module:attr path to your BaseCacheStore (an instance or a zero-argument factory). See Bring your own backend. |
rate_limit |
The rate limit object. See Rate limiting. |
token_revocation |
true, false or an object. See Authentication. |
Reference: BaseCacheStore · Source: base.py
{
"agent": "graph.react:app",
"cache_store": {
"type": "redis",
"url": "${CACHE_REDIS_URL}"
}
}Leave out url to read REDIS_URL. REDIS_URL alone never selects Redis: a setup with no cache_store uses the in-memory store even when the variable is set. Top-level redis, rate_limit and token_revocation keys do not exist; a config that has one stops at load with an error that says where the setting goes.
The server logs one INFO line at boot that names the store and the config key it came from. Valkey, Dragonfly and KeyDB work through the Redis URL. With an in-memory store, each replica keeps its own locks, caps, rate-limit counters and token revocations, so use a shared store once you run more than one worker.
What is on by default
This table shows what each setting does when its key is absent from 10xgraph.json, and what 10xgraph init writes for each setup.
| Setting | Key absent | Quick setup | Full setup |
|---|---|---|---|
| Auth | Off: every request is accepted | null (off) |
jwt |
| Roles and reach | Default permission set (all but admin:*), reach own, when auth is on. Nothing when auth is off |
not written | not written (default set, reach own) |
| Cache store | In-memory, per process | not written (in-memory) | type: redis, URL from REDIS_URL |
| Rate limiting | Off | off | on: 100 requests per 60 seconds, by user, fail_open false |
| Token revocation | Off | off | on |
| ID generator | The graph’s own generator | not written | uuid |
| Thread naming | none: threads are saved without a name |
not written (none) | first_message |
| WebSocket | Routes /v1/graph/ws and /v1/graph/live mounted; a warning if no WebSocket library is installed |
enabled: false |
enabled: false unless you pass --websocket |
| AG-UI | Off | enabled: false |
enabled: false |
| Startup checks | On: checkpointer and store are fatal if unreachable; the cache store is fatal only with token revocation on (and auth set) or a rate limit with fail_open false, otherwise one warning |
same | same |
Set STARTUP_CHECKS=false to skip the startup check. 10xgraph config edits every row. See the production checklist for the startup check and /health/ready.
Set test and evaluation defaults
The optional test and evaluation blocks supply defaults for the 10xgraph test and 10xgraph eval commands. CLI flags always override these defaults:
{
"agent": "graph.react:app",
"test": {
"path": "tests",
"coverage": true,
"coverage_threshold": 80
},
"evaluation": {
"directory": "evals",
"output_dir": "eval_reports",
"threshold": 0.9
}
}With this configuration, 10xgraph test runs tests from tests/ with coverage reporting. Pass a different path to override:
10xgraph test tests/unit/ # uses tests/unit/ instead
10xgraph test --coverage # enables coverage (default is on here)
10xgraph eval --output ci_reports/ # overrides output_dir
10xgraph eval --threshold 0.95 # overrides thresholdTest criteria come from your test files. Evaluation criteria come from a confeval.py file in your evals directory. See Run evals for details.
Enable AG-UI for client-side agents
The ag_ui key exposes an AG-UI endpoint so frameworks like CopilotKit can run your agent in a browser or desktop context:
{
"agent": "graph.react:app",
"ag_ui": {
"enabled": true,
"allow_client_tools": true
}
}When enabled, POST /v1/ag-ui streams AG-UI events. This feature requires pip install "10xgraph-api[ag-ui]". Set allow_client_tools to false to accept only the tools you explicitly declare in remote_tools (tools the client sends in each request are rejected). By default, it is true, allowing clients to offer ad-hoc tools as long as they fit size limits.
Control WebSocket connections
The websocket key manages connection limits for /v1/graph/ws (streaming) and /v1/graph/live (realtime):
{
"agent": "graph.react:app",
"websocket": {
"max_connections": 1000,
"max_connections_per_user": 10,
"realtime_models": ["gemini-3.8-live"],
"realtime_client_overrides": ["voice", "modalities", "vad"]
}
}max_connectionscaps the concurrent WebSocket connections (default 1000).max_connections_per_userprevents a single authenticated user from hogging all slots (default 10). Set to0ornullfor unlimited.realtime_modelslists the models a/v1/graph/liveclient may request (empty by default, meaning clients cannot choose).realtime_client_overrideslists the session options a/v1/graph/liveclient may set in its init frame: any ofvoice,modalities,vadandsystem_prompt. The default is["voice", "modalities", "vad"].system_promptreplaces the agent’s instructions, so list it only when every caller is trusted to rewrite them.enabledset tofalseleaves/v1/graph/wsand/v1/graph/liveout of the app.
When a shared cache store is configured (cache_store of type redis or custom), the connection caps are shared by all workers and replicas. Without one, each process counts its own connections, so the real cap is the limit times the number of workers. If a worker dies, its slots expire on their own. If the cache store is unreachable, the server allows the connection and logs the error.
Limit concurrent runs per user
runs.max_concurrent_per_user caps the graph runs (invoke, stream, AG-UI) one verified user can have in flight (default 10). Over the cap, the request gets 429. Set it to 0 or null for no cap. Requests with no verified user (auth off) are not capped. Like the WebSocket caps, the count is shared across workers and replicas through the cache store when a shared one is configured, and per process otherwise.
{
"agent": "graph.react:app",
"runs": { "max_concurrent_per_user": 10 }
}Control who can read the graph structure
GET /v1/graph, GET /v1/graph/tools and GET /v1/graph:StateSchema expose node names, tool schemas and the state schema. They need the graph:read permission. The default permission set includes it. To hide the graph structure from a role, leave graph:read out of that role’s permissions in auth.roles; a refusal is 403. With auth off there is no identity, so these routes stay open.
The old graph_introspection key is removed and refuses to boot. See Migrating from authorization.
Keys the server owns in request config
A client can send a config object with a run, and your nodes and tools can read its keys. The server drops these keys from client config before the graph sees them (no error is returned): user, user_id, remote_tools, ag_ui, file_tool_root, workspace_root, tool_timeout, node_timeout, max_parallel_tool_calls, collection, and any key that starts with _. Identity comes from the verified token, never from config. To narrow the rest, list allowed keys in runs.config_keys. Client state is separate and closed by default: list the keys a client may set in runs.state_keys, or it can set none. See Invoke and stream.
Environment variable expansion in the cache store URL
cache_store.url supports environment variable expansion. Both $VAR and ${VAR} forms work:
{
"agent": "graph.react:app",
"cache_store": { "type": "redis", "url": "${REDIS_URL}" }
}If a variable is missing, the server fails at startup with an error rather than silently starting without a shared store. This is deliberate: a misconfigured server is worse than one that refuses to start.
All other configuration keys in 10xgraph.json are read literally. Keep credentials out of the file: use the environment, .env files, or your orchestration platform.
Configure per environment
Use separate config files and select one at startup:
config/
dev.json
staging.json
prod.json# Development: auto-reload, all features open
10xgraph dev --no-open --config config/dev.json
# Production-like local run: no reload, hardened settings
# (for real deployments use `10xgraph build`, see the deploy guide)
MODE=production 10xgraph dev --no-open --config config/prod.json --no-reloadA typical dev config:
{
"agent": "graph.agent:app",
"env": ".env"
}A typical prod config (see production checklist below):
{
"agent": "graph.agent:app",
"env": ".env",
"auth": "jwt",
"store": "graph.dependencies:store",
"cache_store": {
"type": "redis",
"rate_limit": {
"enabled": true,
"requests": 100,
"window": 60,
"by": "user",
"trusted_proxy_headers": true,
"trusted_proxy_hops": 1,
"fail_open": true
},
"token_revocation": true
}
}Production decisions checklist
Before deploying to production, make five explicit decisions:
1. Turn on authentication
With auth unset or null, every request is accepted. This is fine for internal development. In production, set "auth": "jwt" with JWT_SECRET_KEY (at least 32 characters) and JWT_ALGORITHM in the environment, or point at a custom BaseAuth subclass. See Authentication.
Reference: BaseAuth · Source: base_auth.py
2. Set roles and reach
With auth on, every user gets the default permission set and sees only their own data. A thread, message, memory or file outside the caller’s reach answers 404. To give some users fewer permissions or a wider reach, add auth.roles with a permissions list and a reach (own, tenant or all) per role. Reach tenant and all widen reads, lists and deletes only; runs always stay on the caller’s own threads. For checks that need a database or a policy service, use "method": "custom" and override authorize. See Authentication. The authorization key from earlier versions is removed and refuses to boot; the migration table shows the replacement for each setting.
3. Use a shared, durable checkpointer
InMemoryCheckpointer loses all threads on restart and is invisible to other replicas. In production, pass PgCheckpointer to compile() in your graph module. This ensures thread history survives restarts and is consistent across all replicas.
4. Use a shared cache store with multiple replicas
The in-memory cache store counts per process, so with three workers you allow three times the configured limit. With multiple replicas, set "cache_store": {"type": "redis"} and ensure all replicas point to the same Redis instance. Also set trusted_proxy_hops correctly: it counts from the right of the X-Forwarded-For header, so the value must match how many proxies sit in front of your server. Set it too high and a client can forge its own address to bypass limits.
5. Wire observability
A production agent you cannot trace is one you cannot debug. At minimum, set MODE=production in the environment (it turns debug off), and configure logging. See Observability.
Verify before you deploy
Run the audit command to check your setup:
10xgraph auditThis checks the Python interpreter, the installed 10xgraph-api and 10xgraph packages, evaluation API compatibility, 10xgraph.json (valid JSON, an agent value in module:attribute form, valid remote_tools), and whether port 8000 is free. It does not import your graph. It exits with status 0 if only warnings appear, or 1 if errors are found.
Then start the server and verify each control:
# 1. Config loads and graph imports
10xgraph dev --no-open --no-reload &
# 2. The health endpoint works
curl http://127.0.0.1:8000/ping
# 3. Auth is on: an unauthenticated call must be rejected (expect 401, not 200)
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://127.0.0.1:8000/v1/graph/invoke -d '{}'
# 4. Rate limiting is on: after 100 requests in 60 seconds, you get 429
for i in $(seq 1 120); do
curl -s -o /dev/null -w "%{http_code} " http://127.0.0.1:8000/ping
doneFinally, verify that persistence survives a restart: start a thread by invoking without a thread_id, restart the server, and read the thread back via /v1/threads/{thread_id} using the id the server returned.
Common configuration issues
| Symptom | Solution |
|---|---|
ModuleNotFoundError or import fails |
The module path is spelled correctly and exists in your project. Test with python -c "from module import attr". |
AttributeError: module has no attribute |
graph.react:app expects an app variable in the graph/react.py file. Check the name and that it is a compiled graph. |
| Checkpointer connection fails | The Postgres DSN is correct and the database is reachable. Test: psql <dsn>. The Redis URL is reachable: redis-cli -u <url> ping. |
JWT_SECRET_KEY and JWT_ALGORITHM must be set |
Export both variables, or set "env": ".env" and add them there. The secret needs at least 32 characters. |
| Rate limiting not working on multi-replica setup | Set "cache_store": {"type": "redis"} (with REDIS_URL set, or a url) so the cache store is shared. Ensure all replicas point to the same Redis instance. |
| Threads visible to users who did not create them | Check that auth is on and that no role has reach tenant or all for them. GET /v1/me shows the resolved reach. Check that all replicas use the same config. |
Refuses to boot naming authorization |
The key is removed. See Migrating from authorization. |
For a complete list of configuration keys, defaults, and types, see the configuration reference.