A complete setup guide for running LangSmith self-hosted tracing platform with a multi-agent system built using LangGraph. This project demonstrates how to set up observability for complex parallel agent workflows using self-hosted infrastructure.
Multi-Agent Graph Diagram Representation Chat DemoSelf-Hosted Limitations: LangSmith self-hosted is an add-on to the LangSmith Enterprise plan. This development deployment does not include all the full production features available in the hosted LangSmith platform. Some advanced features, integrations, and capabilities are only available in the fully managed enterprise hosted solution.
This setup is designed for:
- Local development and testing
- Understanding LangSmith architecture
- Building and debugging multi-agent systems
- Learning about observability patterns
For production use with full feature parity, consider using the hosted LangSmith Enterprise service.
- Important Notes
- Overview
- Architecture
- Prerequisites
- Quick Start
- Detailed Setup
- Testing Your Multi-Agent System
- Viewing Traces
- Troubleshooting
- Project Structure
- Additional Resources
This project provides a complete implementation of:
- LangSmith Self-Hosted: A Docker-based deployment of LangSmith for local development and testing
- Multi-Agent System: A parallel agent architecture using LangGraph with planner, workers, and reducer agents
- Tracing Infrastructure: Complete observability with traces stored in ClickHouse
- No-Auth Development Mode: Simplified setup for local development
User Input
↓
PLANNER Agent
Creates 3 tasks:
1. Gather background information
2. Extract key entities
3. Propose next steps
↓
┌───┬───┬───┐
│ W │ W │ W │ Workers execute in parallel
│ o │ o │ o │
│ r │ r │ r │
│ k │ k │ k │
│ e │ e │ e │
│ r │ r │ r │
└───┴───┴───┘
↓
REDUCER Agent
Synthesizes final results
↓
Complete Response
- LangSmith Frontend: Web UI for viewing traces (
localhost:1980) - LangSmith Backend: REST API for trace ingestion (
localhost:1984) - ClickHouse: Time-series database for trace storage (
localhost:8124) - PostgreSQL: Metadata storage (
localhost:5433) - Redis: Caching layer (
localhost:63791) - LangGraph: Multi-agent orchestration framework
Before starting, ensure you have:
- Docker and Docker Compose installed
- Python 3.11+ with virtual environment support
- OpenAI API Key (Get one here)
- Linux/WSL2 or macOS with Docker support
- Basic familiarity with Docker and Python
# Navigate to your project directory
cd ~/lg-parallel
# Create Python virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Generate a secure JWT secret
openssl rand -base64 32
# Copy the output - you'll need it nextCopy the example environment file and customize it:
cd langsmith-dev
cp .env.example .envThen edit langsmith-dev/.env and replace YOUR_GENERATED_SECRET_HERE with the output from step 2.
Or create langsmith-dev/.env file manually:
# Core Authentication (No-Auth Mode for Development)
AUTH_TYPE=none
OAUTH_CLIENT_ID=
OAUTH_ISSUER_URL=
OAUTH_CLIENT_SECRET=
BASIC_AUTH_ENABLED=false
BASIC_AUTH_JWT_SECRET=
# Generated Secret (replace with your openssl rand output)
API_KEY_SALT=YOUR_GENERATED_SECRET_HERE
# License Key
LANGSMITH_LICENSE_KEY=dev-local
# Service URLs (Internal)
LANGSMITH_URL=http://langchain-frontend:1980
SMITH_BACKEND_ENDPOINT=http://langchain-backend:1984
# Database Connection Strings (Internal Service Names)
POSTGRES_DATABASE_URI=postgres:postgres@langchain-db:5432/postgres
REDIS_DATABASE_URI=redis://langchain-redis:6379
# ClickHouse Configuration
CLICKHOUSE_HOST=langchain-clickhouse
CLICKHOUSE_PORT=8123
CLICKHOUSE_NATIVE_PORT=9000
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=password
CLICKHOUSE_DB=default
CLICKHOUSE_TLS=false
# Trace TTL Configuration (Valid JSON)
TRACE_TIER_TTL_DURATION_SEC_MAP={"longlived":34560000,"shortlived":1209600}
# Blob Storage (Disabled for Local Dev)
FF_S3_STORAGE_ENABLED=false
BLOB_STORAGE_BUCKET_NAME=
BLOB_STORAGE_API_URL=
BLOB_STORAGE_ACCESS_KEY=
BLOB_STORAGE_ACCESS_KEY_SECRET=
# Feature Flags
FF_ORG_CREATION_DISABLED=false
FF_TRACE_TIERS_ENABLED=true
FF_UPGRADE_TRACE_TIER_ENABLED=true
# Logging
LOG_LEVEL=infocd langsmith-dev
docker compose up -d
# Verify all services are running
docker ps --format "table {{.Names}}\t{{.Status}}"Create myapp/.env:
# OpenAI API Key (Required)
OPENAI_API_KEY=sk-your-key-here
# LangSmith Configuration (No-Auth Mode)
LANGCHAIN_TRACING_V2=true
LANGSMITH_ENDPOINT=http://localhost:1980/api/v1
LANGSMITH_API_KEY=
LANGCHAIN_PROJECT=lg-parallel-dev# Return to project root
cd ..
# Run the test
python simple_test.pyThe langsmith-dev/docker-compose.yaml file contains the complete service definitions. Key components:
Frontend Service:
- Requires
extra_hostsfor Linux compatibility - Depends on backend services
- Serves UI on port 1980
Backend Services:
- Must have
AUTH_TYPE,API_KEY_SALT, andX_SERVICE_AUTH_JWT_SECRETexplicitly set - All backend services (backend, platform-backend, queue) must share the same JWT secret
- Network aliases ensure proper service name resolution
Create langsmith-dev/users.xml:
<clickhouse>
<users>
<default>
<access_management>1</access_management>
<named_collection_control>1</named_collection_control>
<show_named_collections>1</show_named_collections>
<show_named_collections_secrets>1</show_named_collections_secrets>
<profile>default</profile>
</default>
</users>
<profiles>
<default>
<async_insert>1</async_insert>
<async_insert_max_data_size>2000000</async_insert_max_data_size>
<wait_for_async_insert>0</wait_for_async_insert>
<parallel_view_processing>1</parallel_view_processing>
<materialize_ttl_after_modify>0</materialize_ttl_after_modify>
<wait_for_async_insert_timeout>25</wait_for_async_insert_timeout>
<allow_simdjson>0</allow_simdjson>
<lightweight_deletes_sync>0</lightweight_deletes_sync>
</default>
</profiles>
</clickhouse>Ensure your docker-compose.yaml includes:
# For platform-backend
langchain-platform-backend:
networks:
default:
aliases:
- langchain-platform-backend
# For frontend (Linux only)
langchain-frontend:
extra_hosts:
- "host.docker.internal:host-gateway"Critical environment variables must be explicitly passed to containers:
langchain-backend:
environment:
- AUTH_TYPE=${AUTH_TYPE:-none}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
- POSTGRES_DATABASE_URI=${POSTGRES_DATABASE_URI}
- REDIS_DATABASE_URI=${REDIS_DATABASE_URI}
# ... additional vars
langchain-platform-backend:
environment:
- AUTH_TYPE=${AUTH_TYPE:-none}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
# ... additional vars
langchain-queue:
environment:
- AUTH_TYPE=${AUTH_TYPE:-none}
- API_KEY_SALT=${API_KEY_SALT}
- X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}
# ... additional varsThe simple_test.py script demonstrates a minimal multi-agent setup with parallel execution:
python simple_test.pyThis test creates two agents that run in parallel and merge their results through a join node.
The test_agent.py script uses your full application graph from myapp/src/app_graph.py:
python test_agent.pyThis executes the complete planner-worker-reducer flow with OpenAI integration.
Configuration:
Endpoint: http://localhost:1980/api/v1
Project: lg-parallel-dev
Tracing: true
API Key: (empty - no-auth mode)
Running parallel multi-agent system...
Execution completed!
Result:
user: Do the tasks in parallel
agent_a: A: fetched docs
agent_b: B: did a web lookup
system: JOIN: Do the tasks in parallel | A: fetched docs | B: did a web lookup
To view traces:
- Open http://localhost:1980 in your browser
- Look for project 'lg-parallel-dev'
- You should see a run with nodes: agent_a, agent_b, and join
| Service | URL | Description |
|---|---|---|
| LangSmith UI | http://localhost:1980 |
Main UI for viewing traces |
| Backend API | http://localhost:1984/api/v1 |
REST API |
| API Docs | http://localhost:1984/api/docs |
OpenAPI documentation |
| Playground | http://localhost:3001 |
LangSmith Playground |
| ACE Backend | http://localhost:1987 |
ACE Backend |
| ClickHouse | http://localhost:8124 |
ClickHouse UI |
| PostgreSQL | localhost:5433 |
PostgreSQL database |
| Redis | localhost:63791 |
Redis cache |
- Open
http://localhost:1980in your browser - Navigate to your project (
lg-parallel-dev) - Click on a run to see the execution graph
- Examine agent steps, inputs, outputs, and timing
from langsmith import Client
client = Client(
api_url="http://localhost:1980/api/v1",
api_key=None # No-auth mode
)
# Get all runs in your project
runs = client.list_runs(project_name="lg-parallel-dev")
for run in runs:
print(f"Run ID: {run.id}, Name: {run.name}")Problem: Docker containers fail to start or restart continuously.
Solution:
# Check logs
docker logs langsmith-dev_langchain-backend_1
# Restart all services
cd langsmith-dev
docker compose down -v
docker compose up -dProblem: nginx: host not found in upstream "langchain-platform-backend"
Solution:
- Ensure network alias is set in
docker-compose.yaml - Verify all services are on the same network:
docker network inspect langsmith-dev_default
Problem: Error parsing token err="token contains an invalid number of segments"
Solution:
- Verify
API_KEY_SALTis set in.env - Ensure
X_SERVICE_AUTH_JWT_SECRET=${API_KEY_SALT}in all backend services - Restart services:
docker compose down -v docker compose up -d
Problem: ClickHouse container exits with error
Solution:
- Check
users.xmlfor unsupported settings - Ensure no
allow_materialized_view_with_bad_selectsetting exists - Remove the setting if present
Problem: UI loads but no traces visible
Solution:
- Verify tracing is enabled:
LANGCHAIN_TRACING_V2=true - Check backend logs:
docker logs langsmith-dev_langchain-backend_1 - Verify endpoint:
LANGSMITH_ENDPOINT=http://localhost:1980/api/v1 - Query ClickHouse directly:
docker exec -it langsmith-dev_langchain-clickhouse_1 clickhouse-client SHOW TABLES; SELECT * FROM traces LIMIT 10;
Problem: OPENAI_API_KEY not set
Solution:
# Set in environment
export OPENAI_API_KEY='sk-your-key'
# Or in myapp/.env
echo "OPENAI_API_KEY=sk-your-key" >> myapp/.envProblem: ModuleNotFoundError
Solution:
# Activate virtual environment
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txtlg-parallel/
├── README.md # This file
├── langsmith-dev/ # LangSmith Docker setup
│ ├── docker-compose.yaml # Docker Compose configuration
│ ├── users.xml # ClickHouse configuration
│ └── .env # Environment variables (create this)
├── myapp/ # Your multi-agent application
│ ├── src/
│ │ └── app_graph.py # Main agent graph
│ ├── .env # Application environment
│ └── requirements.txt # Python dependencies
├── simple_test.py # Minimal parallel agent test
├── test_agent.py # Full application test
├── .gitignore # Git ignore rules
└── requirements.txt # Root dependencies
- LangSmith Self-Host Documentation
- LangGraph Documentation
- Docker Compose Documentation
- ClickHouse Documentation
# Start all services
cd langsmith-dev && docker compose up -d
# Stop all services
cd langsmith-dev && docker compose down
# Stop and remove volumes (deletes data)
cd langsmith-dev && docker compose down -v
# View logs
docker logs -f langsmith-dev_langchain-backend_1
# Check service status
docker ps --format "table {{.Names}}\t{{.Status}}"
# Restart a specific service
docker compose restart langchain-backend
# Run your tests
python simple_test.py
python test_agent.py
# Check API health
curl http://localhost:1980/info
curl http://localhost:1984/api/v1/infoFor production deployments, you should:
- Enable Authentication: Configure OIDC or Basic Auth
- Use HTTPS: Set up SSL certificates
- Secure Secrets: Use proper secrets management (not plain text .env files)
- Database Backups: Configure regular backups for PostgreSQL and ClickHouse
- Monitoring: Set up monitoring and alerting
- Network Security: Configure proper firewall rules
- Resource Limits: Set appropriate CPU and memory limits for containers
- Logging: Configure centralized logging
- High Availability: Set up redundant services
This project is for development and testing purposes. LangSmith self-hosted requires appropriate licensing for production use.
Contributions are welcome. Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
For issues and questions:
- Check the troubleshooting section
- Review the logs:
docker logs <service-name> - Consult the official documentation
- Ask in the community Discord
- Docker and Docker Compose installed
- Python 3.11+ virtual environment created
- OpenAI API key obtained
- Security secret generated with
openssl rand -base64 32 -
langsmith-dev/.envconfigured -
langsmith-dev/users.xmlcreated - Docker services started and running
-
myapp/.envconfigured with OpenAI key - Test executed successfully
- Traces visible in LangSmith UI
Your LangSmith self-hosted environment with multi-agent system is ready.

