
Langfuse provides open-source flexibility, robust tracing, and intuitive prompt management. It supports solo developers and MLOps engineers deploying large-scale pipelines. Self-hosting grants the transparency and control required for these use cases.
To optimize LLM performance with Langfuse, see: The AI Engineer’s Guide to Debug, Optimize, and Ship Production-Ready LLM Apps.
This guide covers self-hosting Langfuse with Docker Compose and virtual machines. It details the full feature set to make LLM applications observable and scalable. Self-hosting Langfuse means you run it on your own infrastructure, so you control infrastructure, data access, and compliance standards.
What You Need to Self-Host Langfuse
Verify the following components before deploying Langfuse locally or on a virtual machine:
- Git – To clone the Langfuse repository
- Docker and Docker Compose – Docker Desktop is recommended for macOS and Windows
- System resources – Minimum 4 CPU cores, 16 GiB RAM, and 100 GiB disk space for production
“Ubuntu offers high Docker compatibility. Select Ubuntu for virtual machine deployments.”
Deploy Langfuse Locally Using Docker Compose
Docker Compose enables a rapid local deployment of Langfuse. Follow these steps:
Step 1: Clone the Repository
01bashgit clone https://github.com/langfuse/langfuse.git cd langfuse
Step 2: Configure Secrets
Edit `docker-compose.yml`. Set `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and host values. Apply secure secret management practices.
Step 3: Start Service
01bashdocker compose up
Wait for the `langfuse-web-1` container to display "Ready". The service is live.
Step 4: Open the Interface
Navigate to http://localhost:3000 in a web browser to view the Langfuse dashboard.
Self-Hosting Langfuse on a Virtual Machine
Use virtual machine deployment for persistent environments or production workloads.
Recommended Setup
- OS: Ubuntu 22.04 LTS
- Specs: 4 CPUs, 16 GiB RAM, 100 GiB disk
- Security: Configure firewalls and secure SSH access
VM deployment steps
- Establish SSH connection
- Install Docker and Docker Compose
- Clone the Langfuse repository
- Configure secrets in docker-compose.yml
- Start the stack with docker compose up
“Restrict public access. Use environment variables or secrets managers for sensitive data.”
Docker Compose Fundamentals for Langfuse
Langfuse Docker Compose deployment supports development, testing, and low-volume production workloads. Limitations include:
Limitations
- No built-in high availability
- Manual container scaling
- The system lacks a built-in backup function
For high-volume or critical workloads, plan a later migration to Kubernetes. This move adds advanced orchestration controls.
Ingest Data into Local Langfuse
Connect your application to Langfuse with the Python SDK. The steps below show how to send trace data:
File: langfuse_client.py
01pythonfrom langfuse import Langfuse from langfuse.langchain import CallbackHandler
langfuse = Langfuse( public_key=os.getenv("LANGFUSE_PUBLIC_KEY"), secret_key=os.getenv("LANGFUSE_SECRET_KEY"), host=os.getenv("LANGFUSE_HOST") ) langfuse_handler = CallbackHandler()
Add Tags and Session IDs
01pythondef get_langfuse_config(agent, tags): return { "callbacks": [langfuse_handler], "metadata": { "langfuse_session_id": agent.get_context_id(), "langfuse_tags": tags, }, }
Invoke LLM with Tracing
01pythondef invoke(agent, prompt: str, tags=[]): if os.getenv("LANGFUSE_ENABLED", "false").lower() == "true": config = get_langfuse_config(agent, tags) return agent.llm.invoke(prompt, config=config) return agent.llm.invoke(prompt)
Core Langfuse Capabilities
Langfuse provides actionable insights. These features apply to both self-hosted and managed deployments.
Key Capabilities:
- Trace Management: Visualize end-to-end LLM flows
- Evaluation and Feedback: Combine human scoring with automated evaluations
- Prompt Management: Version, test, and deploy prompts in a shared environment.
- Latency and Cost Monitoring: Identify regressions, spikes, and optimization gaps.
- Observability Dashboards: Review usage, system health, and model behavior.
“Langfuse supports trace export to external tools.”
Prompt Management Architecture in Langfuse
Langfuse prompt management acts as a CMS for LLM prompts. Key benefits include:
Key Capabilities:
- Edit and version prompts via UI, API, or SDKs.
- Test prompt versions in a playground.
- Tag and label prompts to organize content.
- Compare prompt performance: latency, cost, accuracy.
“Example: Deploy prompt version 1 for customer support. Test version 2 with updated instructions. Compare metrics before production release.”
Advanced Observability: Sessions, Graphs, and Tags
Langfuse is an LLM observability platform.
Key Features:
- Sessions: Capture full conversation context
- Agent Graphs: Map multi-step agent workflows
- Custom Tags & Metadata: Structure, filter, and annotate traces
- Trace URLs & IDs: Share links or track distributed traces
Langfuse offers advanced capabilities in the open-source LLM observability market.
Business and Technical Value of Self-Hosting Langfuse

Self-hosting Langfuse enables you to control infrastructure, data access, and compliance standards. This deployment model supports specific security and governance requirements.
Key Capabilities of Self-Hosted Langfuse:
- Authentication and SSO Integration (Okta, Google SSO)
- Encryption for trace and user data storage
- UI customization for branding and role-based dashboards
- Offline mode and air-gapped deployment for regulated environments
“You own the data. You control observability. You define access.”
Maintenance and upgrades
Operate Langfuse in production using these practices:
- Stop containers with the docker-compose down command
- Update versions by pulling repository changes and restarting services
- Troubleshoot multimodal tracing using logs and community support
- Back up data regularly using Docker volumes or external scripts
Evaluate the suitability of Langfuse self-hosting
Langfuse self-hosting provides full observability for LLM applications. It supports research projects, SaaS products, and internal tools without proprietary lock-in.
Begin with Docker Compose. Scale to Kubernetes when required. Customize every layer of the stack. Langfuse supports deployments from Docker Compose LLM tools to enterprise virtual machines.
Use Langfuse to monitor, improve, and scale AI systems. See: How to create a custom AI Agent.
Frequently asked questions
You need Git to clone the Langfuse repository, plus Docker and Docker Compose. Docker Desktop is recommended for macOS and Windows. For production, the guide lists a minimum of 4 CPU cores, 16 GiB of RAM and 100 GiB of disk space. Ubuntu is recommended for virtual machine deployments.
Clone the Langfuse repository, then edit docker-compose.yml to set LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY and the host values. Start the stack with docker compose up. Apply secure secret management practices. When the langfuse-web-1 container shows Ready, open http://localhost:3000 in a browser to see the Langfuse dashboard.
Docker Compose supports development, testing and low-volume production workloads. It has no built-in high availability, no built-in backup function and needs manual container scaling. For high-volume or critical workloads, the guide advises planning a later move to Kubernetes, which adds orchestration controls.
Langfuse gives you trace management, evaluation and feedback, prompt management, latency and cost monitoring, and observability dashboards. Self-hosting adds control over infrastructure and data access, SSO integration with Okta or Google, encryption of stored trace and user data, and air-gapped deployment for regulated environments.
