Open-source, self-hosted LangGraph Agent Server.
Production Postgres + Redis. Same SDK. Same Studio. Zero code changes.
Independent project; not affiliated with or endorsed by LangChain.
If this saves you a license key (or a weekend), ⭐ star the repo — it keeps this 100% open-source effort alive.
From uv add langhost to a live Agent Server — same SDK, same Studio, your Postgres + Redis.
Click the demo to pause / seek.
langhost is the open way to run a production-grade LangGraph Agent Server on your Postgres and Redis — no closed runtime, no license key for persistence.
It is 100% compatible with the LangGraph ecosystem. Existing LangGraph projects (with a normal langgraph.json) should run without any code changes: add langhost, point at Postgres + Redis, and serve.
Compatible with:
LangSmith Studio · langgraph-sdk · Agent Protocol · Agent Chat UI · MCP · A2A · AG-UI / CopilotKit
langgraph dev |
LangSmith Deployments | Aegra | langhost | |
|---|---|---|---|---|
| Best for | Fast local iteration | Managed cloud or licensed self-host | Self-hosted prod with an open FastAPI stack | Self-hosted prod with the stock Agent Server |
| Persistence backend | In-memory + local disk (.langgraph_api) |
Postgres + Redis | Postgres + Redis | Postgres + Redis |
| Persistence runtime | Proprietary (langgraph-runtime-inmem, Elastic-2.0) |
Proprietary (licensed) | Open (Apache-2.0) | Open (MIT, langgraph-runtime-pg) |
| HTTP / API stack | Official Agent Server | Official Agent Server | Independent FastAPI implementation | Official Agent Server |
| Official protocols & extras | MCP, A2A, Generative UI, webhooks | MCP, A2A, Generative UI, webhooks | Core Agent Protocol; MCP / A2A coming soon | MCP, A2A, Generative UI, webhooks |
| LangGraph SDK / Studio | Yes | Yes | Yes | Yes |
| Config | langgraph.json |
langgraph.json |
aegra.json (falls back to langgraph.json) |
langgraph.json |
| Project license | Elastic-2.0 (runtime) | Proprietary / commercial | Apache-2.0 | MIT |
| License key for self-host | Not required (dev) | Required (LANGGRAPH_CLOUD_LICENSE_KEY) |
None | None |
Official langgraph dev is ideal for in-memory development. Aegra reimplements the Agent Protocol serving layer as an open FastAPI stack. langhost keeps stock langgraph-api and swaps in MIT persistence — same MCP / A2A / Generative UI / webhooks, durable state, no license key.
Studio / SDK / Chat UI / MCP / A2A
│
▼
langhost serve ← this CLI (MIT)
│
▼
langgraph-api ← stock Agent Server (unchanged)
│
▼
langgraph-runtime-pg ← open Postgres + Redis runtime (MIT)
│
┌──────┴──────┐
▼ ▼
Postgres Redis
langhost— the friendly CLI you run (langhost serve)langgraph-runtime-pg— the backbone: clean-room Postgres + Redis runtime (LANGGRAPH_RUNTIME_EDITION=pg) that plugs into stocklanggraph-api- Your graphs — whatever you already have in
langgraph.json; no rewrites
No API fork. No second protocol. Clients keep talking to the official Agent Server.
Prerequisites: Python 3.11+, uv, Docker (only if you need local Postgres/Redis)
Same flow as the official local server guide:
uvx --from langgraph-cli@latest langgraph new
Follow the on-screen prompts, then:
cd <your-project> uv sync
Already have a LangGraph project? Skip scaffolding — jump to the next step.
uv add langhost
That pulls in langgraph-runtime-pg (the open runtime) automatically.
If you do not already have them running:
docker compose -f https://github.com/langhost/langhost.git#main:docker-compose.yml up -d
Create or update .env in your project root:
DATABASE_URI=postgresql+asyncpg://postgres:postgres@localhost:5432/langgraph?sslmode=disable
REDIS_URI=redis://localhost:6379/0Add other environment variables as needed.
# Development — hot reload on code changes uv run langhost serve --reload # Production — bind all interfaces; scale workers as needed uv run langhost serve --host 0.0.0.0 --workers 4
Default port is 31296. You should see API, Studio, docs, and Agent Chat UI URLs in the banner:
- API:
http://127.0.0.1:31296 - Studio:
https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:31296 - Docs:
http://127.0.0.1:31296/docs - Agent Chat UI:
https://agentchat.vercel.app/?apiUrl=http://127.0.0.1:31296&assistantId=agent
Tip: Safari often blocks localhost ↔ Studio. Use
uv run langhost serve --reload --tunnel.
from langgraph_sdk import get_client import asyncio client = get_client(url="http://127.0.0.1:31296") async def main(): async for chunk in client.runs.stream( None, # threadless run "agent", # graph / assistant name from langgraph.json input={"messages": [{"role": "human", "content": "What is LangGraph?"}]}, ): print(chunk.event, chunk.data) asyncio.run(main())
Same SDK. Same endpoints. Same Studio. Fully self-hosted.
- 100% open source (MIT) — runtime + CLI you can audit, fork, and run anywhere
- Drop-in for existing LangGraph apps — keep your
langgraph.jsonand graph code - Official Agent Server surface — assistants, threads, runs, store, crons, SSE streaming
- Studio-ready — open the printed Studio URL and debug like local
langgraph dev - Ecosystem protocols — Agent Protocol (LangChain), plus MCP / A2A surfaces from the stock server
- Horizontal scale — multi-replica claim/reclaim on Postgres + Redis
- First-party checkpoints — via
langgraph-checkpoint-postgres
Schema is managed by Alembic inside langgraph-runtime-pg:
export DATABASE_URI=postgresql+asyncpg://postgres:postgres@localhost:5432/langgraph
uv run langgraph-runtime-pg-migrate upgrade
uv run langgraph-runtime-pg-migrate current| Environment | Recommendation |
|---|---|
| Dev / tests | Auto-migrate on (default) |
| Production | Run migrate once before rollout; disable auto-migrate |
libs/langhost/ # CLI: langhost serve
libs/langgraph-runtime-pg/ # Open Postgres + Redis runtime (the backbone)
docker-compose.yml # Local Postgres 16 + Redis 7
scripts/test.sh # Full local e2e runner
git clone https://github.com/langhost/langhost.git
cd langhost
uv sync --group dev
cp .env.example .env
docker compose up -d
./scripts/test.shSee CONTRIBUTING.md.
MIT © Mohankumar Ramachandran — 100% open source.
Not affiliated with LangChain. When you run stock langgraph-api, you must still comply with its
Elastic License 2.0. This project replaces the
closed Postgres/Redis runtime, not the API package’s license.
Built in the open. If langhost helps you ship, a star goes a long way. ⭐