Why 10xGraph: you write the AI logic, it runs the infrastructure

In shortYou write the agents, tools and tasks. 10xGraph runs them with auth, roles, tenant isolation, durable state, jobs, metrics and deploy files. All replaceable.

  • 9 min read
  • 9 sections
  • Updated
  • v1.0.0
  • Markdown

Most agent frameworks stop at the graph. The moment you want real users, you start a second project: a FastAPI wrapper, authentication, per-user data isolation, rate limits, concurrency control for parallel requests on the same conversation, health checks, a Docker image, Kubernetes manifests, graceful shutdown. That second project is where most agent prototypes stall.

10xGraph is open-source, self-hosted infrastructure for AI applications. You write the agents, tools and tasks, and 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. The server is hardened by default, scales horizontally, and is ready to deploy. Authentication is off until you configure it, and the Full setup turns it on. Every part is replaceable when the default does not fit your stack.

The server, the 10xgraph CLI and a ready-made playground come with it. 10xgraph dev starts the server and opens the playground in your browser, so your first run needs no frontend code.

What you write, what you get

You write two things: a compiled graph and a config file.

Python
# graph/agent.py
from tenxgraph.prebuilt.agent import ReactAgent
from tenxgraph.storage.checkpointer import PgCheckpointer

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 once per request."""
    return f"Refunded {amount:.2f} for order {order_id}"

checkpointer = PgCheckpointer(postgres_dsn="postgresql://...", redis_url="redis://...")
app = ReactAgent(
    model="claude-sonnet-5-5",
    tools=[lookup_order, refund_order],
).compile(checkpointer=checkpointer)
JSON
{
  "agent": "graph.agent:app",
  "env": ".env",
  "auth": "jwt"
}

Then run 10xgraph dev locally, or 10xgraph build --docker-compose (or --k8s) for deployment files. From those two files you get:

You get Details
REST and streaming endpoints POST /v1/graph/invoke, POST /v1/graph/stream, POST /v1/graph/stop, graph structure and tool schemas
WebSocket and realtime /v1/graph/ws for streaming, /v1/graph/live for voice agents
Thread and message APIs List, read, update and delete threads, messages and state under /v1/threads
Memory APIs Save, search, update and forget long-term memories under /v1/store
File uploads Upload, download and signed URLs under /v1/files, with size and type limits
AG-UI POST /v1/ag-ui for CopilotKit and other AG-UI clients (opt-in)
Health /ping for liveness, /health/ready for readiness (checks checkpointer, store and cache store)
Security Auth (when configured), role-based access with own, tenant or all reach, token revocation, rate limits, security headers, size limits
Background jobs 10xgraph worker and 10xgraph scheduler, /v1/tasks routes (Background tasks)
Metrics Prometheus scrape or OTLP push (Metrics guide)
Deployment Hardened Dockerfile, Docker Compose file, Kubernetes manifest
Tooling Playground, config editor, test, eval and audit commands

Claim 1: hardened by default

These protections are on unless you turn them off. One exception matters: authentication is off until you set the auth key, so a server started with auth unset is open, even with MODE=production. The Full setup (10xgraph init --mode full) turns auth on. See Limits.

  • No unguarded routes. Every route declares the permission it needs. At startup the server checks every route and refuses to boot if one is missing its guard.
  • Authentication. Built-in JWT ("auth": "jwt") verifies the signature, requires exp and user_id, and checks iss and aud when you set them. In production, a JWT secret under 32 bytes stops the server from starting.
  • Owner-only threads by default. With auth on, a conversation thread belongs to the user who created it. Another user cannot read, run, stop or delete it: the thread answers 404 because every query is scoped to the caller. A role can widen reads, lists, deletes and stop to its tenant or to all users (reach); runs and writes always stay with the owner.
  • Scoped permissions. Every route maps to a permission such as graph:invoke or threads:delete. Tokens that carry scope or scopes are limited to them. Role-based access is one config block away: see authentication and authorization.
  • Token revocation. Revoke a single token or every token a user holds, kept in the cache store (Redis for more than one worker). If the revocation store is unreachable, requests fail closed with 503.
  • Hardened input. Clients can only send user messages; forged assistant or system turns are refused. Reserved config keys (user_id, user, timeouts and others) are stripped, message ids are regenerated server-side, and external media URLs pass an SSRF guard.
  • Production guards. In production mode the server refuses to start with wildcard CORS origins, wildcard allowed hosts or public API docs.
  • Security headers and size limits. HSTS, CSP, frame, content-type and referrer headers on every response. Request bodies over 10 MiB (25 MB for uploads) are rejected with 413, including chunked bodies.
  • No leaking internals. In production, 5xx errors return a generic message with a request id. Logs redact tokens, passwords, keys, signed URL signatures, DSN passwords and JWT-shaped strings (LOG_REDACT_SECRETS, on by default), and escape control characters so log lines cannot be forged.

Details: Authentication, Authorization scopes, CORS and security headers.

Claim 2: scales horizontally

The server keeps no conversation state in the worker. Conversation state lives in your checkpointer, and the coordination state lives in Redis, so you can run many workers and many replicas behind a load balancer.

Concern Where it lives with Redis configured Without Redis
Conversation state Your checkpointer (Postgres + Redis cache with PgCheckpointer) Same
One run per thread (thread lock) Redis lease, renewed while the run is alive, released if the worker dies Per process
Rate limits Redis sliding window shared by all workers Per process
Per-user concurrent runs Redis counter, 429 over the cap Per process
WebSocket connection caps Redis, global and per user Per process
Token revocation Redis In memory

Two requests for the same thread never run at the same time: the second waits up to 30 seconds and then gets a 409, or it can ask the active run to stop and take over. The generated image runs Gunicorn with Uvicorn workers (WEB_CONCURRENCY, default 2), and the Kubernetes manifest starts with two replicas and separate liveness and readiness probes.

To scale out, you need a durable checkpointer (PgCheckpointer), REDIS_URL, and cloud media storage (MEDIA_STORAGE_TYPE=cloud) when you accept uploads. See Durability and concurrency.

Claim 3: production-ready

  • One switch between dev and production. MODE=production turns off debug and API docs, enforces the strict checks above, and adds a 300-second run timeout unless you set runs.timeout. The same image runs in both modes.
  • Graceful shutdown. On SIGTERM the server calls graph.aclose() (active runs finish, are stopped or are cancelled, each saved; background work such as event publishing and checkpoint writes is drained), then releases Redis, rate-limit and revocation clients. The readiness probe answers 503 from the moment SIGTERM arrives, so the load balancer stops sending new requests. The generated image gives in-flight runs up to 600 seconds to finish (open streams end with an “interrupted” chunk before that), and the Kubernetes manifest sets a longer termination grace period and a preStop delay. A run that is cut off leaves a thread the next message can use. See Graceful shutdown.
  • Replay-safe tools. After a crash, the run resumes and a tool call whose record was written is not executed again. The record is written when the tool returns, so a crash before the tool returns, or in the short gap before the record is written, can repeat the tool. Send an idempotency key derived from stable inputs (an order id) to payment and email providers. See Replay-safe tools and Tools run at least once.
  • Hardened containers. Multi-stage Docker build, non-root user (uid 10001), pip removed from the runtime image, health check built in. The Kubernetes manifest runs with a read-only root filesystem, dropped capabilities, seccomp and no service account token.
  • Observability. OpenTelemetry tracing (OTEL_ENABLED), Sentry error reporting (SENTRY_DSN, 5xx only, with the same secret redaction as the logs and no request bodies or default PII), and Logfire, LangSmith or Phoenix through the observability config block. Prometheus metrics come from the metrics block, by scrape or OTLP push. LOG_FORMAT=json writes structured logs, and the audit block writes an audit log of access decisions (metadata only; 10xGraph stores no audit data). Every response carries an X-Request-ID. See Observability.
  • Checks before you ship. 10xgraph audit validates your environment and config and exits non-zero on failure, so it works as a CI gate. 10xgraph test runs your tests with coverage thresholds, and 10xgraph eval runs agent evaluations with a pass-rate gate.
  • Scaffolded for production. 10xgraph init --mode full generates an auth class, prompt-injection validators, lifecycle hooks, tests, evals and a production 10xgraph.json with auth on, rate limits, token revocation and the audit log. Storage defaults to Postgres with a Redis cache store. --storage memory or --storage sqlite write an in-memory cache store (per process) instead.

Customize every part

Each part has a supported replacement point.

Part Default Replace it with How
Authentication Off, or built-in JWT Any identity provider or API keys Subclass BaseAuth; "auth": {"method": "custom", "path": "auth.my_auth:MyAuth"}
Authorization Default permission set with reach own (owner-only threads) Roles with permissions and reach, or your own rules roles inside the auth object, or override BaseAuth.authorize
Token revocation Off Kept in the API’s cache store (Redis, memory or your own) cache_store.token_revocation
Rate limiting Off Counters in the API’s cache store (memory, Redis or your own) cache_store.rate_limit
Shared state (locks, caps, idempotency) One process Redis, Valkey, Dragonfly, KeyDB or your own BaseCacheStore cache_store (type, url or REDIS_URL); see Bring your own backend
Persistence In-memory checkpointer Postgres + Redis, SQLite or your own Pass it to compile(checkpointer=...)
Long-term memory None PgVectorStore, Qdrant or your own BaseStore "store": "module:instance"
Events and tracing None Console, Redis, Kafka, RabbitMQ, OTel, Phoenix, Logfire, LangSmith StateGraph(publisher=...), or the observability block
Dependency injection Global container Your own InjectQ container with your services "injectq": "module:container"
Thread names None Your own naming logic "thread_name_generator": "module:Class"
Settings Safe defaults Any value Environment variables (ORIGINS, CSP_POLICY, MAX_REQUEST_SIZE, …)

Bring your own authentication

Don’t want JWT? Verify the credential your way and return who the caller is:

Python
# auth/my_auth.py
from typing import Any

from fastapi import HTTPException, Request, Response
from fastapi.security import HTTPAuthorizationCredentials
from tenxgraph_api import BaseAuth


class MyAuth(BaseAuth):
    async def authenticate(
        self,
        request: Request,
        response: Response,
        credential: HTTPAuthorizationCredentials,
    ) -> dict[str, Any] | None:
        claims = verify_with_your_provider(credential.credentials)  # Auth0, Clerk, Firebase, API keys...
        if claims is None:
            raise HTTPException(status_code=401, detail="Invalid credentials")
        # user_id becomes the owner of threads and memories; roles feed the built-in RBAC
        return {"user_id": claims["sub"], "roles": claims.get("roles", [])}
JSON
{ "auth": { "method": "custom", "path": "auth.my_auth:MyAuth" } }

Roles with permissions and reach are one roles block in auth, and BaseAuth.authorize takes your own rules; see Authentication and authorization.

Know the boundaries

Today:

  • Metrics and logs: Prometheus metrics are opt-in through the metrics block (install 10xgraph-api[metrics]), and logs are plain text unless you set LOG_FORMAT=json. Neither is on by default.
  • Custom routes: mounting the server into your own FastAPI app, or adding routes to it, is not a supported API. Run your own service alongside it.
  • Checkpointer config: set the checkpointer in compile(checkpointer=...); 10xgraph.json has no checkpointer key. The Full setup uses the checkpointer you pick with --storage (postgres by default), so avoid memory and sqlite when you run more than one worker.

Go to production in five steps

  1. Scaffold the project: 10xgraph init --mode full --storage postgres.
  2. Implement auth/agent_auth.py, or set "auth": "jwt" and a 32-byte JWT_SECRET_KEY.
  3. Compile with PgCheckpointer and set REDIS_URL.
  4. Set MODE=production, ORIGINS and ALLOWED_HOST, then run 10xgraph audit.
  5. Generate deployment files with 10xgraph build --docker-compose (or 10xgraph build --k8s) and deploy.

The full list is in the production checklist.

Next steps

Frequently asked questions

What do I have to write myself?
Your graph (agents, tools, state) and a 10xgraph.json file that points at it. The server, endpoints, authentication, access control, rate limits, concurrency control, health checks, Dockerfile and Kubernetes manifest come from 10xGraph.
Can I use my own authentication provider?
Yes. Subclass BaseAuth, verify the credential however you like (Auth0, Clerk, Firebase, API keys, an internal SSO) and return a dict with user_id. Point the auth key in 10xgraph.json at your class.
Does the server scale horizontally?
Yes, once state is outside the process: use a durable checkpointer such as PgCheckpointer and set REDIS_URL. Thread locks, rate limits, per-user run caps, WebSocket caps and token revocation then work across every worker and replica.
Is it secure by default?
The server refuses to start if any route lacks a permission guard, and production mode refuses wildcard CORS and hosts, short JWT secrets and public API docs. Authentication itself is off until you set the auth key (the Full setup turns it on). With auth on, threads default to owner-only access (reach own), and client input is stripped of reserved keys and forged assistant or system turns.
Can I add my own FastAPI routes to the server?
Not as a supported API today. Run your own FastAPI service next to it and call the 10xGraph server over HTTP, or use the TypeScript client.
Last updated for v1.0.0Edit this page on GitHubReport an issue