Build your first production agent with LangGraph
A 90-minute walkthrough that ships a tool-using agent with persistent state, retries, and observability.
- Python 3.11+
- OpenAI or Anthropic API key
- Basic LangChain familiarity
This guide ships a small but real agent. We will build a research assistant that can browse, summarize, and persist findings — with retries, idempotency, and traces.
What you will build
A single-graph LangGraph agent with three tools: search, fetch, and append-note. State is persisted with a SQLite checkpointer so runs survive crashes.
Step 1: Project scaffold
Use uv or poetry. The dependency footprint is intentionally small.
Step 2: Define your tools
Wrap each tool with input/output validation. Most production failures originate at this layer.
Step 3: Wire the graph
Keep the graph shallow — three nodes, one router. Avoid the temptation to add a critic on day one.
Step 4: Add tracing
LangSmith or Langfuse, your choice. The point is to see every tool call.
Step 5: Run replay tests
Capture five real sessions. Replay them on every change. This is the cheapest insurance you will ever buy.