Overview
You manage a simplified made up of Agent Servers and their required backing services (PostgreSQL, Redis, etc.):
This option gives you full control over scaling, deployment, and CI/CD pipelines, while still allowing optional integration with LangSmith for tracing and evaluation.


Workflow
- Define and test your graph locally using the
langgraph-clior Studio. - Package your agent as a Docker image.
- Deploy the Agent Server to your compute platform of choice (Kubernetes, Docker, VM).
- Optionally, configure LangSmith API keys and endpoints so the server reports traces and evaluations back to LangSmith (self-hosted or SaaS).
Supported compute platforms
- Kubernetes: Use the LangSmith Helm chart to run Agent Servers in a Kubernetes cluster. This is the recommended option for production-grade deployments.
- Docker: Run in any Docker-supported compute platform (local dev machine, VM, ECS, etc.). This is best suited for development or small-scale workloads.
Prerequisites
- Use the LangGraph CLI to test your application locally.
- Use the LangGraph CLI to build a Docker image (i.e.
langgraph build). To build on a network with no public internet access, see Set up a build machine on a restricted network. - The following environment variables are needed for a data plane deployment.
-
REDIS_URI: Connection details to a Redis instance. Redis will be used as a pub-sub broker to enable streaming real time output from background runs. The value ofREDIS_URImust be a valid Redis connection URI.Shared Redis Instance Multiple self-hosted deployments can share the same Redis instance. For example, forDeployment A,REDIS_URIcan be set toredis://<hostname_1>:<port>/1and forDeployment B,REDIS_URIcan be set toredis://<hostname_1>:<port>/2.1and2are different database numbers within the same instance, but<hostname_1>is shared. The same database number cannot be used for separate deployments. -
DATABASE_URI: Postgres connection details. Postgres will be used to store assistants, threads, runs, persist thread state and long term memory, and to manage the state of the background task queue with ‘exactly once’ semantics. The value ofDATABASE_URImust be a valid Postgres connection URI.Shared Postgres Instance Multiple self-hosted deployments can share the same Postgres instance. For example, forDeployment A,DATABASE_URIcan be set topostgres://<user>:<password>@/<database_name_1>?host=<hostname_1>and forDeployment B,DATABASE_URIcan be set topostgres://<user>:<password>@/<database_name_2>?host=<hostname_1>.<database_name_1>anddatabase_name_2are different databases within the same instance, but<hostname_1>is shared. The same database cannot be used for separate deployments. -
LANGSMITH_API_KEY: LangSmith API key. -
LANGGRAPH_CLOUD_LICENSE_KEY: LangSmith license key. This will be used to authenticate ONCE at server start up. -
LANGSMITH_ENDPOINT: To send traces to a self-hosted LangSmith instance, setLANGSMITH_ENDPOINTto the hostname of the self-hosted LangSmith instance.
-
- Egress to
https://beacon.langchain.comfrom your network. This is required for license verification and usage reporting if not running in air-gapped mode. See the Egress documentation for more details.
Agent Server services listen on both IPv4 and IPv6 by default as of 0.14.0. No additional configuration is required for dual-stack clusters. To listen on a single address family, set
LANGGRAPH_SERVER_HOST to 0.0.0.0 for IPv4 only or :: for IPv6 only. See Self-hosted Agent Server environment variables.Kubernetes
Use this Helm chart to deploy an Agent Server to a Kubernetes cluster. This is the recommended setup for production standalone server deployments. The Helm chart (v0.2.6+) supports MongoDB checkpointing with a bundled instance (dev/testing) or an external deployment (production). Setmongo.enabled: true in your values file. See Configure checkpointer backend for full configuration details.
Docker
Run the followingdocker command:
- You need to replace
my-imagewith the name of the image you built in the prerequisite steps (fromlanggraph build)
REDIS_URI, DATABASE_URI, and LANGSMITH_API_KEY.- If your application requires additional environment variables, you can pass them in a similar way.
Docker Compose
Use the following Docker Compose file:docker compose up with this file in the same folder.
With MongoDB checkpointing
With MongoDB checkpointing
To store checkpoints in MongoDB instead of PostgreSQL, add a MongoDB service and configure the checkpointer backend. Set the backend to See Configure checkpointer backend for more details on MongoDB configuration options.
"mongo" in your langgraph.json or use the LS_DEFAULT_CHECKPOINTER_BACKEND environment variable. PostgreSQL is still required for all other server data.8123 (change the port mapping in langgraph-api if needed). Test if the application is healthy:
Authenticate requests with LangSmith API keys
By default, a standalone Agent Server does not authenticate incoming requests. You can configure it to require a LangSmith API key on every request.If
langgraph.json defines a custom authentication handler in auth, that handler authenticates requests instead of this configuration. The server then checks LangSmith API keys only for Studio requests, or for requests without an Authorization header when auth.allow_langsmith_api_keys is true. For more information, see Set up custom auth.LANGGRAPH_AUTH_TYPE:langsmith. The Helm chart sets this whenauth.enabledistrue.LANGSMITH_AUTH_ENDPOINT(auth.langSmithAuthEndpoint): The LangSmith API URL that validates keys, for your region or instance. For example,https://api.smith.langchain.comorhttps://eu.api.smith.langchain.com. For self-hosted LangSmith, use your instance’s API URL, ending in/api/v1.LANGSMITH_TENANT_ID(auth.langSmithTenantId): The ID of the workspace whose API keys the server accepts.
X-Api-Key header. For each request, the server asks LangSmith to validate the key, then checks that the key belongs to the workspace in LANGSMITH_TENANT_ID:
- Any key for the workspace works: The caller’s key does not need to be the server’s own
LANGSMITH_API_KEY. A personal access token or service key for the same workspace is accepted. - The key’s role is not checked: The server accepts a valid key for the workspace whatever its workspace role, including Workspace Viewer. The server does not receive the role, so it cannot limit what the caller does: a caller authenticated with a LangSmith key carries only its LangSmith user ID and the
authenticatedpermission. To control access per caller, replace LangSmith key auth with custom authentication that issues your own credentials. - Keys for other workspaces are rejected: The server rejects a valid key for a different workspace with
Invalid tenant ID. A key with access to several workspaces resolves to its default workspace. To use it with a server in another workspace, send that workspace’s ID in theX-Tenant-Idheader. - Tracing keys are rejected: A tracing key can only send traces, so the server rejects it with
Forbidden. - Validation results are cached: The server caches each successful validation for up to 60 seconds, so a revoked key can keep working for up to a minute.
Connect these docs to your agent of choice via MCP for real-time answers.

