
Deploy Langfuse LangGraph
Trace LangGraph agents on your own Langfuse
langfuse-worker
Just deployed
Redis
Just deployed
/data
Just deployed
/var/lib/postgresql/data
langfuse-web
Just deployed
ClickHouse
Just deployed
/var/lib/clickhouse
langfuse-bucket
Bucket
Just deployed
Deploy and Host self hosted Langfuse LangGraph (Open-Source LLM Observability) on Railway
Langfuse LangGraph is a self-hosted Langfuse v3 stack for teams running LangGraph agents. Deploy the full observability backend on Railway, then pass a LangChain CallbackHandler into your compiled graph.
About Hosting Langfuse LangGraph open-source software on Railway (self hosted Langfuse tracing template)
This template runs the complete Langfuse v3 backend as six Railway services: web UI and API, async worker, Postgres, Redis, ClickHouse and an S3-compatible storage bucket.
Why Deploy Langfuse LangGraph, the LangSmith alternative on Railway (Railway Free Trial)
LangSmith is closed source and self-host only on an enterprise plan. Langfuse gives the same trace and eval workflow for LangGraph agents, but you own the data and the core is MIT.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Langfuse LangGraph on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for Langfuse LangGraph self hosting
| Provider | Tradeoffs | Cost |
|---|---|---|
| DigitalOcean | App Platform plus managed Postgres and Spaces, but you assemble services, configure cross-service networking and handle ClickHouse yourself | Mid |
| AWS | ECS, RDS, ElastiCache, S3 and a ClickHouse deployment add up fast. IAM, security groups and VPC endpoints become a second job | High |
| Hetzner | Cheap bare metal or cloud VPS, but you install Docker, manage volumes, backups, TLS and failover for six services | Low |
Common Use Cases for hosted Langfuse LangGraph
- Debug a looping agent: open the trace, find the node repeatedly calling a tool, inspect that span's input and output.
- Track cost and latency per node: see tokens and duration for each LLM call inside the graph.
- Group multi-turn runs: add
session_idto trace metadata so one conversation shows as a single thread. - Score agent outputs: attach numeric evals to traces and compare agent versions over time.
Dependencies for Langfuse LangGraph Docker hosted on Railway
The stack has six moving parts. Langfuse web handles the UI, API and trace ingestion. The worker consumes async jobs from Redis, reads raw events from the S3 bucket and writes them to ClickHouse.
Deployment Dependencies for Managed Langfuse LangGraph Service (LLM Observability)
langfuse-web:langfuse/langfuse:3, public, port 3000, serves UI and API.langfuse-worker:langfuse/langfuse-worker:3, port 3030, async ingestion and evals.- Postgres: transactional data, project settings, prompt definitions.
- Redis: queue and cache, needs
?family=0in the connection string for Railway private IPv6. - ClickHouse 24.8: traces, observations, scores. Volume mounted at
/var/lib/clickhouse. - Railway Storage Bucket: S3-compatible object storage for raw events and media.
Implementation Details for Langfuse LangGraph (Using Langfuse official docker images)
Web runs the official Langfuse image on port 3000. Worker runs a separate image on port 3030. On first deploy, web runs migrations against Postgres and ClickHouse. The worker may need one restart after web finishes migrating.
How does Langfuse LangGraph compare against other LLM observability tools
Langfuse vs LangSmith
- Source: Langfuse core is MIT open source. LangSmith is closed source and self-host only on enterprise.
- Trace structure: Both give nested spans for LangGraph nodes, tools and LLM calls. Langfuse uses LangChain CallbackHandler, LangSmith its own SDK plus callbacks.
- Cost: Self-hosted Langfuse has no per-unit charge. LangSmith self-host pricing is not public.
- Prompt management: Langfuse includes prompt versioning, labels and playground in open core. LangSmith Prompt Hub is part of the paid product.
Langfuse vs Arize Phoenix
- License: Langfuse MIT. Phoenix source-available under Elastic License 2.0.
- Instrumentation: Langfuse SDKs for Python, JS/TS, OpenTelemetry. Phoenix leans on OpenTelemetry and OpenInference.
- Backend: Langfuse needs Postgres, Redis, ClickHouse, S3. Phoenix runs as one container on SQLite or Postgres.
- Trace UI: Langfuse shows nested spans with cost and latency per node. Phoenix similar trace view.
Langfuse vs Helicone
- Architecture: Langfuse is a full observability backend. Helicone is a proxy/gateway in front of LLM calls.
- LangGraph support: Langfuse traces graph nodes and tool calls directly via CallbackHandler. Helicone sees raw LLM request/response.
- Self-hosting: Both open source. Langfuse needs more services, Helicone is lighter.
- Evals: Langfuse has built-in scoring and dataset evals. Helicone focuses on request logs, caching, rate limiting.
Langfuse vs Opik
- License: Langfuse MIT. Opik Apache 2.0, both permissive.
- Backend: Langfuse uses ClickHouse for high cardinality and long retention. Opik default self-host lighter.
- LangGraph tracing: Both support LangChain callbacks. Langfuse has dedicated CallbackHandler and nested nodes cleanly.
How to use Langfuse LangGraph (the OSS LLM observability platform)?
- Open the Langfuse UI at your Railway domain, create a project, and copy the public key, secret key, and host from project settings.
- In your LangGraph app, set
LANGFUSE_PUBLIC_KEY,LANGFUSE_SECRET_KEY, andLANGFUSE_HOST(your Railway domain). - Create the handler with
from langfuse.langchain import CallbackHandlerandhandler = CallbackHandler(). - Pass it when you invoke the compiled graph:
graph.invoke(inputs, config={"callbacks": [handler]}). - Add
session_idanduser_idthrough metadata so multi-turn runs group together. - Open the trace, walk the nested node and tool spans, and attach scores to the runs you care about.
Langfuse flushes asynchronously. In a short script, call langfuse.flush() before exit.
How to self host Langfuse LangGraph on other VPS Services (Langfuse self hosting guide)
Clone the Repository
Clone the official Langfuse repo or use its Docker Compose file. Compose spins up web, worker, Postgres, Redis, ClickHouse and MinIO. On a VPS, replace MinIO with any S3-compatible service.
Install Dependencies
Install Docker and Docker Compose. Need at least 4 cores, 16 GiB RAM, 100 GiB disk. Create .env with required vars. Generate 64-char hex ENCRYPTION_KEY, random SALT, NEXTAUTH_SECRET. Set NEXTAUTH_URL to your public domain.
Configure Environment Variables
Set DATABASE_URL, REDIS_CONNECTION_STRING (with ?family=0 for IPv6), CLICKHOUSE_URL, CLICKHOUSE_MIGRATION_URL, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_CLUSTER_ENABLED=false.
Start the Langfuse LangGraph Application
Run docker compose up -d. Web runs migrations on first boot. Wait for worker to connect to ClickHouse. If worker fails, restart once after migrations complete. Open UI, create project, copy API keys.
Official Pricing of Langfuse LangGraph (Langfuse pricing)
Langfuse Cloud tiers: Hobby free, 50k units/mo, 30 day retention, 2 users. Core $29/mo, 100k units, 90 day retention. Pro $199/mo, 3 year retention, SSO, priority support. Enterprise $2,499/mo, custom limits, dedicated support.
Langfuse LangGraph cloud vs self hosted comparison (Pricing, features, costs, and more)
Self-hosting on Railway gives unlimited traces, unlimited users, full data control. Cloud removes infra work, gives managed upgrades, backups, support.
Monthly cost of self hosting Langfuse LangGraph on Railway
At low traffic, the six-service stack with ClickHouse typically costs $15 to $40 per month on Railway. Biggest cost drivers: ClickHouse container memory and S3 storage. Railway gives $5 free trial credit.
System Requirements for Hosting Langfuse LangGraph on a VPS
Official docs recommend 4 CPU cores, 16 GiB RAM, 100 GiB disk for single VM. On Railway, size each service independently. Web and worker can run small, but ClickHouse needs at least 2 GiB RAM to start comfortably.
Frequently Asked Questions (FAQs)
Does the Langfuse CallbackHandler add latency to my LangGraph agent?
Yes, a small amount. Langfuse batches events and flushes asynchronously by default. Spans are sent in the background, so the graph doesn't wait on Langfuse for each step.
How do I group multi-turn runs into a session in Langfuse?
Add a session_id to trace metadata for every turn of the conversation. In the UI, all traces with that session ID appear under one session view. Add user_id to filter by user.
Why does my LangGraph trace look flat with no nested nodes?
You probably passed the CallbackHandler to the LLM call but not to the graph invoke. Langfuse nests spans only when the handler is in the config callbacks of graph.invoke or graph.astream.
How do I trace tool calls inside a LangGraph node?
Langfuse automatically creates a span for every tool call when the handler is active. The tool span appears as a child of the node span that invoked it. You see tool input, output, latency, errors.
What happens if my self-hosted Langfuse instance goes down while my agent runs?
The Langfuse SDK buffers events in memory and retries in background. If the instance is down longer than the buffer, some spans may be lost. Your agent does not fail.
Does Langfuse work with LangGraph JS or TypeScript?
Yes, the Langfuse JS/TS SDK includes a LangChain callback handler for JavaScript. In the current JS SDK it lives in the @langfuse/langchain package; pass it in config callbacks when you invoke your compiled LangGraph graph in Node.js.
Template Content
langfuse-worker
langfuse/langfuse-worker:3Redis
redis:8.2langfuse-web
langfuse/langfuse:3ClickHouse
clickhouse/clickhouse-server:24.8langfuse-bucket
Bucket
