Run This Ai
EN DE

LangWatch Tutorial: Set Up LLM Agent Testing in 15 Minutes

Step-by-step tutorial to deploy LangWatch with Docker, create your first project, run agent simulations, and start tracing production LLM calls.

LangWatch

πŸ› οΈ Tutorial: Set Up LangWatch and Run Your First Agent Simulation in 15 Minutes

I'll walk you through getting LangWatch running with Docker, creating your first project, and running an agent simulation that catches bugs before they hit production. No prior setup needed β€” just Docker and a terminal.

Time estimate: ~15 minutes (first-time Docker pull adds 5-10 minutes). Take a coffee break during the image downloads.

πŸš€ Prefer a ready-made deploy?

System requirements, Docker Compose templates, and deployment guides are on the tool page.

View LangWatch Tool Page β†’

Step 1: Start LangWatch with Docker

Clone the repo and spin it up:

git clone https://github.com/langwatch/langwatch.git
cd langwatch
cp langwatch/.env.example langwatch/.env
docker compose up -d --wait --build

⚠️ First-time pull: This downloads PostgreSQL, Redis, and ClickHouse images β€” roughly 2GB. It'll take 5-10 minutes depending on your connection. Subsequent starts are instant.

Once the containers are up, open http://localhost:5560 in your browser. If you see a login page β€” congrats, it worked. If not, run docker compose logs langwatch to check for errors.


Step 2: Create Your First Project

Click "Create Project" β†’ name it "Test Agent" β†’ copy the API key that appears. You'll need this key to send traces from your agent.

In the dashboard, notice a few things:

  • Traces tab: Empty now, but this is where every agent decision shows up
  • Datasets tab: For storing and labeling evaluation data
  • Scenarios tab: This is where you define agent simulations
  • Evaluations tab: Run evals against your datasets or scenarios

Don't worry if it looks sparse β€” it will fill up as soon as you send your first trace or run a simulation.


Step 3: Run Your First Agent Simulation

Go to Scenarios β†’ "New Scenario". Define a simple test:

Field Value
Scenario Name Order Refund Request
User Message "I ordered a widget 2 days ago but it hasn't shipped. I want a refund."
Expected Behavior Check order status β†’ cannot refund shipped orders β†’ offer alternative

Click "Run Simulation". LangWatch will simulate a user interacting with your agent through this scenario. Every tool call, every LLM response, every decision β€” it's all captured in the trace view.

What I discovered on my first run: My agent tried to refund an order that had already shipped. The trace showed it called the wrong tool β€” it used cancel_order instead of check_refund_policy. LangWatch flagged the mismatch between the actual and expected behavior. Caught it before any real user hit it.


Step 4: Send a Real Trace (Optional)

To monitor a production agent, install the LangWatch SDK:

pip install langwatch
# or: npm install langwatch

Then instrument your agent:

import langwatch

langwatch.init(api_key="lw_...")  # your project API key

with langwatch.trace("user-query") as span:
    result = my_agent.process(query)
    span.log(result)

Traces appear in real-time in the LangWatch dashboard. Each trace shows the full decision chain: which LLM calls were made, which tools were invoked, latency per step, token usage, and cost.


πŸ“Š Performance Expectations

Metric Value
Cold start (first Docker pull) ~5-10 min (2GB download)
Subsequent starts ~30 seconds
Idle RAM usage ~2.5 GB (Postgres + Redis + ClickHouse)
Trace ingestion (1000 req/s) <500ms p99 latency
AI Gateway overhead ~700 ns per request

🎯 Common Pitfalls

⚠️ Pitfall 1: Port conflicts

LangWatch uses port 5560 by default. If you already have something on that port, edit the ports: section in docker-compose.yml to map a different host port like 5561:5560.

⚠️ Pitfall 2: .env missing secrets

If you skip the cp .env.example .env step, LangWatch generates random secrets on first start β€” but only if the file exists. Without .env, the app may fail silently. Always copy the example file first.

⚠️ Pitfall 3: ClickHouse memory

ClickHouse can be memory-hungry. On a 4GB server, set CLICKHOUSE_MEMORY_LIMIT=2G in your docker environment to prevent OOM kills.


βœ… Verification Checklist

After following these steps, you should see:

  1. http://localhost:5560 β†’ LangWatch dashboard βœ…
  2. Created a project with an API key βœ…
  3. Ran at least one scenario simulation βœ…
  4. Viewed the trace for that simulation βœ…

If all four are checked β€” you're up and running. If something failed, check docker compose logs for errors or hop into the LangWatch Discord.

πŸš€ Explore LangWatch on Run This Ai

Docker Compose configs, system requirements, installation guides, and more β€” all in one place.

View LangWatch Tool Page β†’
#llm-evaluation #agent-testing #tutorial #docker