The blog for engineers building AI agents in production.
Long reads with running code, each written from a lab or a client build. Pick a topic, read the post, then build it live on Thursday.
Save a free seatEvery post links the lab that builds it.
Every post, by topic
Coding agents
- Search Code with Ripgrep in AgentsGive your coding agent a ripgrep search tool with fixed flags, JSON output, capped results and exit code handling, plus the tool spec the model sees.9 min
- Build Safe Bash Tools for AgentsBuild a bash tool for a coding agent that is scoped and time-bounded, with an allowlist, a path guard, an output cap, human approval and a sandbox.10 min
- Build a Coding Agent LoopA coding agent is a loop around one model call.10 min
AI agents
- Build LangGraph State MachinesBuild a LangGraph state machine that loops, retries and pauses for a human, with typed state, conditional edges, a checkpointer and a step limit.8 min
- Multi-Agent Coordination PatternsThe three ways to coordinate AI agents (chain, router, supervisor), when each fits, the typed handoff between them, and when one agent is better.8 min
- Compare AI Agent Frameworks in 2026How to choose an AI agent framework in 2026.10 min
- Refine Prompts with Self-CritiqueHow self-refine prompting works, with Python code for a draft, critique and refine loop, when self-critique helps or hurts, and Rephrase and Respond.7 min
RAG
- Detect RAG HallucinationsWhy RAG still hallucinates with a grounded prompt, and how to catch it.8 min
- Tune RAG Retriever Top-KWhat top-k means in RAG, why k=5 is a guess, and a 3-step way to tune it with recall@k, a reranker and a holdout set.9 min
- Use FAISS for RAG in ProductionIs FAISS a vector database?8 min
- Summarize with LangChain Chain TypesLangChain map reduce, stuff and refine summarization compared for 2026.8 min
- Build Multi-Hop RAG with LangGraphHow multi-hop RAG answers questions one retrieval cannot.10 min
- Choose a Vector DatabaseChroma, Qdrant, Weaviate, pgvector, Pinecone and Vespa compared for RAG in 2026.10 min
- Compare Dify, RAGFlow and OnyxDify vs RAGFlow vs Onyx compared for 2026.9 min
- Choose a RAG FrameworkLlamaIndex vs LangChain vs Haystack for RAG in 2026.8 min
Production
- Retry LLM API Calls with BackoffLLM API retry logic for production agents.9 min
- Monitor LLMs with Langfuse and GrafanaPut Langfuse LLM metrics in Grafana with the Metrics API and dashboard JSON, next to Prometheus panels, alerts and trace links.9 min
- Build a Chatbot API with LangGraphWire LangGraph into FastAPI with token streaming over SSE, a Postgres checkpointer, per-user thread IDs and human in the loop with interrupt.8 min
- Monitor AI Agents with PrometheusAdd Prometheus metrics to a FastAPI agent with prometheus-fastapi-instrumentator, LLM token and latency histograms, multiprocess mode, panels and alerts.9 min
- Pool Connections in Python AI ServicesManage database connections in a Python AI agent service: pool sizing, pre-ping, lifespan, PgBouncer, and why no connection is held while the LLM streams.10 min
- Persist LangGraph State in PostgresHow LangGraph threads and the Postgres checkpointer keep agent state across restarts and replicas, plus a thread table, per-thread locks and pruning.10 min
- Separate Dev and Prod Agent ConfigHow .env, .env.development and .env.production differ, how Pydantic Settings loads them in order, and how to keep agent secrets out of git and laptops.8 min
- Run FastAPI Agents with UvicornWhat Uvicorn is, why FastAPI needs it, and the production command, workers, lifespan and SSE streaming setup that keeps AI agents up under real traffic.10 min
- Design a Production AI ChatbotAI chatbot system design for production, end to end.14 min
- Choose the Right LLM for Each TaskRoute each step of an AI app to the smallest model that passes your evals.8 min
- Stream AI Responses with SSEWhen to stream LLM tokens with server-sent events or WebSockets, with FastAPI code for both, plus reconnects, cancellation, backpressure and metrics.8 min