Custom AI Agents

The LangGraph Production Playbook: From Prototype to Production-Grade in 2026

Rajat Gautam14 min readUpdated
Share

Key Takeaways

  • LangGraph wins production over CrewAI and AG2 (formerly AutoGen) for stateful multi-step agents that need durable checkpointing, human-in-the-loop, and multi-vendor routing
  • Six production pillars: durable state with checkpointing, evals before every change, observability and audit trail, guardrails, failover and resilience, SLAs and SLOs
  • 2026 default stack: LangGraph + Postgres checkpointer + Langfuse observability + NeMo Guardrails plus Llama Guard 4 + Promptfoo plus LangSmith evals
  • Evals are non-negotiable. 100-300 case golden set, 3-5 criteria rubric, cross-family LLM-as-judge plus 10% human spot-check.
  • Article 12 logging (EU AI Act) doubles as your production audit trail. Tamper-evident storage required for systems affecting individuals.
  • Typical cost: $1K-$8K/month infrastructure plus 0.25-0.5 FTE engineering ops for a 100K-runs/month tier-1 agent. Build cost: $100K-$300K for the first one.
  • 90-day rollout: foundation (days 1-14), agent v1 (days 15-30), guardrails plus failover (days 31-60), production hardening (days 61-90)
The LangGraph Production Playbook: From Prototype to Production-Grade in 2026

A LangGraph prototype takes a weekend. A LangGraph production system takes 8 to 16 weeks. Most teams underestimate the second number by an order of magnitude and ship the prototype anyway, then spend the next quarter firefighting hallucinations, silent failures, runaway token spend, and customer-trust incidents.

This is the playbook worth having before you ship production agent systems in regulated domains like healthcare, legal, finance, insurance, and real estate. Six engineering pillars, the 2026 stack we deploy against each, the architectural patterns that actually survive production traffic, and the gotchas that are not in the official docs.

If you are still picking a framework, our agent framework comparison covers why LangGraph wins over CrewAI and AG2 (formerly AutoGen) for the production tier and how it stacks against the OpenAI Agents SDK, Claude Agent SDK, and Microsoft Agent Framework. This guide assumes you already chose LangGraph. The question now is how to operate it.

Why LangGraph specifically (and when not)

LangGraph is the right choice when your agent has any of these requirements:

  • Multi-step workflows with branching logic and conditional retries
  • Durable state that must survive process restarts and worker scaling events
  • Human-in-the-loop approval checkpoints (medical sign-off, contract approval, compliance review)
  • Multi-vendor LLM routing (Claude for reasoning, GPT-5.6 for tool use, an open-weight model such as Qwen3.8 Max or GLM-5.2 for self-hosted bulk)
  • Per-tenant isolation with auditable per-tenant configuration
  • Audit-trail requirements (EU AI Act Article 12, HIPAA, NY DFS, SOX)

LangGraph is the wrong choice when:

  • The agent is a one-shot prompt or a 2-3 step chain that does not need state. LangChain expression language or a vanilla Python script is fine.
  • You are single-vendor and committed (Claude only, or GPT only). The Claude Agent SDK or OpenAI Agents SDK ships natively integrated observability and may be cleaner.
  • The team has zero Python depth. LangGraph's superpower is its programmability. If you cannot write Python and read tracebacks, you will struggle in production.

Assuming you are still here, the six pillars.

Pillar 1: durable state with checkpointing

The single feature that separates LangGraph from a glorified prompt chain is its checkpointer. Every state mutation is persisted to a backing store (Postgres, Redis, SQLite for prototypes). If a worker crashes mid-execution, the next worker resumes from the last checkpoint. If a human-in-the-loop step pauses for hours, the state survives the pause.

What to use

  • Prototyping: SQLite checkpointer. Ships in the library, zero setup.
  • Production single-tenant: PostgresCheckpointer. Use your existing managed Postgres (RDS, Cloud SQL, Supabase). Plan for ~1KB-10KB per checkpoint, ~10-50 checkpoints per agent run.
  • Production multi-tenant or high-throughput: PostgresCheckpointer with per-tenant database (cleanest) or per-tenant schema with row-level security. Redis as an L1 cache in front for hot reads.
  • High-availability: Postgres with read replicas for the checkpoint reads, primary for writes. Avoid SQLite in production, full stop.

The gotchas

  • State size grows quickly. Every step appends to the conversation history by default. After 50 steps your checkpoint blob is 100KB-1MB. Use the `summarize` pattern to compress old turns, or split long-running agents into sub-graphs with their own checkpoint scope.
  • Checkpoint cleanup is your problem. LangGraph does not garbage-collect old checkpoints. Write a cron job to archive checkpoints older than your retention window (typically 90 days for ops, longer for audit trails).
  • Migration is painful. State schema changes (you add a new field, change a tool signature) break in-flight agents. Version your state schema, write migrators, and run them before deploying breaking changes.

Pillar 2: evals before every prompt or model change

The rule: every change to a prompt, model, tool signature, or graph structure must run against a golden eval set before merge. Without this, you have no way to know whether a change improved or regressed the system. "It works on my example" is not eval data.

The eval framework

Golden dataset. 100-300 representative cases covering happy paths, edge cases, and known failure modes. Hand-curated initially, then grown by adding cases for every production incident. Stored in version control alongside the agent code.

Scoring rubric. 3-5 criteria specific to your use case: factual accuracy, format compliance, tone match, tool-call correctness, citation quality. Each scored 1-5.

Judge. Three options. (1) Human review every eval run (gold standard, slow, expensive). (2) LLM-as-judge using a different vendor than the system under test (Claude judging GPT output or vice versa). (3) Hybrid: LLM-as-judge for fast iteration, human spot-check of 10% of cases each release.

Tooling. Promptfoo for lightweight YAML-defined evals, LangSmith for evals integrated with LangGraph tracing, or OpenAI Evals if you are OpenAI-primary. We default to Promptfoo plus LangSmith. Promptfoo for fast prompt iteration, LangSmith for end-to-end graph evals against production traces.

The gotchas

  • LLM-as-judge is not free. Budget for the judge token cost separately, and do the arithmetic rather than guessing. Opus 5 is $5 per million input tokens and $25 per million output. A 200-case run at roughly 3,000 input and 800 output tokens per judgment is 0.6M in and 0.16M out: $3 plus $4, so about $7 a run. Longer cases or a chain-of-thought rubric push that past $20 quickly, and you will run it on every merge.
  • Eval bias is real. LLMs prefer outputs from the same family. Cross-family judging (Claude judging GPT, Gemini judging Claude) reduces bias but does not eliminate it. Human spot-check is the calibration.
  • Regression detection requires a baseline. Score your current production agent against the eval set today. Every future change is delta-vs-baseline. Without a baseline, "the new version is good" is just an assertion.
  • Test the tool calls, not just the text. For agents that call functions, score whether the right tool was called with the right arguments. Not whether the final natural-language output looks good.

Pillar 3: observability and audit trail

If you cannot replay a production failure, you cannot fix it. Observability is the difference between an outage you debug and an outage you guess about.

The 2026 stack

Langfuse. Our default for production LangGraph. Captures every node execution, every LLM call, every tool call, every state mutation. Self-hostable. The trace UI is built for agentic workloads (not generic spans). Integrates with LangGraph via a single callback handler.

Helicone. Strong if you are OpenAI-heavy. Proxy-based, so it captures every LLM call regardless of orchestration layer. Less LangGraph-native than Langfuse, but its async-by-default model has lower latency overhead.

OpenTelemetry GenAI Semantic Conventions. The emerging standard. Your traces emit standard span attributes that any OTel-compatible backend (Honeycomb, Datadog, Grafana Tempo) can consume. Use this if you already run a central observability stack and want LangGraph traces in the same pane of glass.

What to capture

At minimum, for every agent run:

  • Input payload (with PII redaction policy applied)
  • Every LLM call with model, prompt, temperature, response, latency, token counts
  • Every tool call with name, arguments, response, duration
  • Every state mutation
  • Every guardrail decision (pass, warn, block)
  • Every retry and the reason
  • Every human intervention or override
  • Final output

For EU AI Act Article 12 compliance, these traces double as the audit log. Store them in tamper-evident storage (S3 Object Lock, Azure immutable Blob) for the retention window your regulator requires.

The gotchas

  • Async-by-default is non-negotiable. Synchronous trace export adds 50-200ms per call. For real-time chat or voice agents this is a deal-breaker. Use async exporters.
  • PII redaction must happen pre-trace. If user PII flows into your trace store, that store becomes a regulated data system. Redact before the trace handler, not after.
  • Sampling at high volume. Capture 100% of failures, 100% of human-flagged outputs, and a sample of successful runs (typically 5-10%). Storing every trace for a 100K-runs/day system is expensive and rarely useful.

Pillar 4: guardrails

Guardrails are the layer between the LLM's output and your downstream system. They catch prompt injection, sensitive-data exfiltration, jailbreaks, factual hallucinations, and policy violations.

The layers

Input guardrails. Run on user input before it reaches the agent. Detect prompt injection (instructions to ignore prior context, prompt-leak attempts), jailbreaks, PII you do not want in the agent's context.

Output guardrails. Run on agent output before it ships to the user or downstream system. Detect policy violations, factual inconsistency with retrieved context (for RAG agents), tone violations, sensitive-data exfiltration, hallucinated tool calls.

Tool-call guardrails. Run between an LLM's tool-call decision and the actual tool execution. Validate arguments against schemas, check authorization for the requested resource, enforce rate limits, sandbox dangerous tools (filesystem access, code execution).

What to use

  • NeMo Guardrails (NVIDIA). Flexible policy-as-code framework. Best for complex multi-rule policies.
  • Llama Guard 4 (Meta). Open-weight 12B natively multimodal classifier for unsafe content, consolidating the older Llama Guard 3 text and vision variants into one model. Strong baseline for content-policy enforcement. Pair it with Prompt Guard 2 (86M or 22M) for injection and jailbreak detection specifically, and LlamaFirewall if you want the orchestration layer over both.
  • Lakera Guard. Managed prompt-injection and jailbreak detection. Faster to deploy than self-hosted, lower flexibility.
  • Custom Pydantic validators. For structured output (JSON schema enforcement, type coercion, range checks). Cheap, fast, no LLM involvement.

The gotchas

  • Guardrail latency adds up. Each guardrail adds 50-300ms. Three layers compound. Run input and output guardrails in parallel where logically safe. Reserve the slowest guardrails for high-risk operations.
  • Guardrails fail closed for safety, open for availability. Decide the policy explicitly and test it. A guardrail timeout that blocks a valid request looks like an outage to your customer.
  • Test guardrails against red-team data, not happy-path data. Use the OWASP GenAI LLM Top 10, refreshed in August 2026 off 7,714 recorded incidents, as your red-team checklist. Prompt injection (LLM01) and sensitive information disclosure (LLM02) hold the top two slots. The entry that matters most for anyone reading a LangGraph playbook is excessive agency (LLM03), which climbed three places into the top three precisely because agent frameworks now hand models real tools. New for 2026 is the cross-modal class: instructions hidden inside an image or an audio track, where a text filter never looks. If your agent accepts a file upload, that is now in scope.
  • Guardrail eval is its own eval set. Your accuracy eval and your guardrail eval are different datasets. Mix them and you cannot tell whether a regression is a model issue or a guardrail issue.

Pillar 5: failover and resilience

LLMs fail. APIs go down. Rate limits trigger. Tool calls time out. Production agents must degrade gracefully, not crash.

The failover patterns

Model fallback ladder. Primary model (Opus 5 for high-stakes reasoning, or Fable 5 where the reasoning genuinely justifies $10 in and $50 out per million) → secondary (Sonnet 5) → tertiary (GPT-5.6 Terra, or a self-hosted open-weight model). Trigger conditions: rate limit, timeout above N seconds, error response. Each fallback step is logged for post-incident analysis.

Tool-call retry with exponential backoff. Idempotent tools (read operations) can retry aggressively. Non-idempotent tools (writes, payments, sends) need idempotency keys plus careful retry policy. Without idempotency keys, you risk double-charging customers, double-sending emails, double-writing records.

Circuit breakers. When a downstream tool fails repeatedly, open the circuit and skip the tool for a cool-down period. Surface the degraded state to the agent's reasoning loop so it can decide what to do without the tool's data.

Deterministic fallback paths. For critical workflows, design a non-LLM fallback. The LLM-driven path is the happy path. A rule-based path handles the case where the LLM is unavailable or the eval-set indicates the model is unreliable on this input. This is also the EU AI Act human-oversight obligation (Article 14) in practice.

The gotchas

  • "Just retry" creates cost spirals. Aggressive retries on transient errors can 10x your token bill in an incident. Cap retries per request and per agent run.
  • Fallback model drift. If you fall back to a smaller model, the prompt that worked on Opus 5 may not work on Sonnet 5 the same way. Test the fallback in your eval set.
  • Silent failure is the worst failure. A guardrail that blocks output silently looks like a successful run with no response. Always log every block decision and surface it in observability.

Pillar 6: SLAs and SLOs

The step from "we ship an agent" to "we sell a managed agent service" is the SLA. Pick a small number of measurable commitments, define the math, monitor in production, and report monthly.

The four SLOs we run

Availability. Percentage of agent runs that complete (success or graceful failure, not crash). Target: 99.5% for most production tiers. 99.9% for tier-1 customer-facing.

Latency. P50, P95, P99 of end-to-end agent run time. Target: P95 under 5 seconds for chat-style agents, P95 under 30 seconds for complex multi-step agents. Measure on the user-perceived clock, not just the LLM-call clock.

Accuracy. Percentage of agent outputs that pass the eval scoring rubric. Run a continuous sample of production outputs through the eval pipeline. Target: typically 90-95% depending on use-case sensitivity.

Hallucination rate. For RAG agents, percentage of outputs that contradict the retrieved context. Measured via citation-grounding eval. Target: under 5% for most workloads, under 1% for high-stakes (legal, medical).

Monthly reporting

The customer-facing artifact is a one-page SLA report. Each SLO with the target, the actual, the breach windows (with root-cause one-liners), and the remediation actions. This is what differentiates a managed AI service from a software license.

The gotchas

  • Accuracy SLOs are expensive to monitor. Continuous LLM-as-judge sampling on production output adds cost. Budget 10-20% of inference cost for eval overhead.
  • Latency SLOs trip on guardrails first. Long-tail latency in production is usually a slow guardrail call or a slow tool call, not the LLM. Trace breakdown is essential.
  • SLA breaches need a remediation budget. Decide in advance whether breaches credit the customer's invoice or trigger an incident review. Without policy, every breach becomes a one-off negotiation.

Deployment options for LangGraph in 2026

LangGraph Platform, managed (billed through LangSmith). Built by the LangChain team. Hosted runtime, hosted checkpointer, integrated LangSmith tracing. Best for teams that want to skip the ops layer. LangChain renamed the managed deployment product to LangSmith Deployment after the 1.0 release in October 2025, so you will see both names in the docs. Published pricing is per seat plus consumption: Developer at $0 for a single seat with 5,000 base traces a month, Plus at $39 per seat per month with 10,000 base traces and one free small serverless deployment, Enterprise on custom terms with self-hosted and hybrid options. Compute is metered on top at $1.50 per LangChain Compute Unit and $1.00 per LangChain Storage Unit, which is where a production bill actually comes from. The open-source framework itself stays MIT-licensed with no usage limit.

Self-hosted on Kubernetes. Run the LangGraph runtime as your own service. Bring your own Postgres for checkpointing, your own Langfuse for observability, your own scaling and security policies. Best for teams with regulated workloads, custom compliance requirements, or significant existing Kubernetes investment.

Serverless (AWS Lambda, Cloud Run, Azure Functions). LangGraph runs cleanly in serverless if your agents are short-lived (under 15-minute execution caps) and stateless between runs (state in external Postgres). Best for bursty workloads where you do not want idle cost.

Hybrid. Tier-1 customer-facing agents on managed cloud for the SLA. Internal agents on self-hosted Kubernetes for cost control. Both share the same Langfuse and Postgres backends. This is the pattern most production-scale deployments converge to.

For a deeper take on private deployment specifically, our private LLM infrastructure guide covers the on-prem option.

Cost model at production scale

For a single tier-1 production agent serving 100,000 runs/month, expect:

  • LLM inference: $500-$5,000/month depending on model mix and prompt sizes
  • Checkpoint storage: $20-$200/month on Postgres (RDS or equivalent)
  • Observability: $100-$1,000/month on self-hosted Langfuse, more if SaaS-tier
  • Guardrails: $100-$500/month (Llama Guard 4 inference plus any managed services)
  • Eval overhead: 10-20% of inference cost
  • Engineering ops: 0.25-0.5 FTE for monitoring, incident response, and continuous eval iteration

Total: roughly $1K-$8K/month in infrastructure plus the engineering ops cost. At 1M runs/month, scale roughly linearly on inference, sub-linearly on the others.

The build cost to get a tier-1 production agent live the first time, including evals, observability, guardrails, failover, and SLA reporting, lands at $100K-$300K with our team. Smaller agents or follow-on agents in the same vertical drop to $40K-$120K because the platform infrastructure is reusable.

Our AI agents and workflow automation services cover the full end-to-end build, including all six pillars above.

The 90-day production rollout plan

If you are starting today and want a tier-1 production agent live in 90 days, this is the sequence we would run.

Days 1-14: foundation. Pick the agent's bounded scope. Build the golden eval set (start with 50 cases, grow to 200). Stand up checkpointer (Postgres) and observability (Langfuse). Define the SLOs.

Days 15-30: agent v1. Build the LangGraph graph. Wire the eval pipeline. Hit baseline accuracy on the eval set. Ship to internal users only.

Days 31-60: guardrails and failover. Add input, output, and tool-call guardrails. Add model fallback ladder. Add deterministic fallback path for critical workflows. Red-team against OWASP LLM Top 10. Run accuracy regression evals.

Days 61-90: production hardening. Ship to 5% of traffic via feature flag. Monitor SLOs. Iterate on observed failure modes. Ramp to 100% over weeks 11-12. Publish the first monthly SLA report.

This is aggressive but doable for a focused team. The teams that miss are the ones that try to build all six pillars in parallel without sequencing. Foundation first, agent v1 second, hardening third.

When LangGraph is not enough

Three scenarios where LangGraph alone leaves gaps:

Voice agents with sub-300ms latency requirements. LangGraph's overhead is small but real. For real-time voice, layer a voice-specific framework (Vapi, ElevenLabs Conversational AI) and use LangGraph for the off-path reasoning that does not block the voice turn.

Massive parallelism (1M+ concurrent agents). LangGraph's checkpointer model assumes per-agent state. At true massive scale, you may want a custom event-sourced architecture where state is reconstructed on demand. Most teams do not need this.

Heavy multi-modal. Image, video, and audio agentic workflows can be modeled in LangGraph, but you will often want a multi-modal-native framework (Replicate's Cog, custom orchestration) for the modality-specific paths. LangGraph still drives the top-level planning.

Keep reading

For the framework decision, see multi-agent systems for our take on LangGraph vs OpenAI Agents SDK vs Claude Agent SDK vs Microsoft Agent Framework. For the model selection inside your LangGraph nodes, see our LLM decision framework. For RAG-specific patterns, see RAG explained. And when you are ready to scope a tier-1 production build, let us talk.

Frequently Asked Questions

Should I use LangGraph or CrewAI for production?+
LangGraph for production. CrewAI is faster to prototype but its abstractions break down once you need durable state, custom checkpointing, retries with idempotency, multi-vendor model routing, and human-in-the-loop approval steps. A tier-1 production agent almost always has at least three of those requirements at once, which is where CrewAI's abstractions start costing more than they save. LangGraph also has better Langfuse and LangSmith integration, which matters for the audit trail you will need under EU AI Act Article 12, HIPAA, NY DFS, or SOX. CrewAI shines for quick internal-tool prototypes; it is rarely the right answer for customer-facing tier-1 work.
What is the difference between LangGraph and LangChain?+
LangChain is the lower-level library: model abstractions, prompt templates, retrievers, output parsers, tool definitions. LangGraph is the orchestration layer built on top of LangChain primitives: stateful graphs, checkpointing, durable workflows, conditional branching, human-in-the-loop nodes. Most 2026 production stacks use both. LangGraph for the agent's graph structure, LangChain for the LLM-call and tool-call primitives the nodes use. They are complementary, not competing.
How do I deploy LangGraph in production?+
Three options. LangGraph Platform managed, billed through LangSmith and renamed LangSmith Deployment after the October 2025 1.0 release. It is the fastest path to production, priced per seat plus consumption: $0 Developer for one seat, $39 per seat per month on Plus, custom on Enterprise, with compute metered at $1.50 per LangChain Compute Unit and $1.00 per LangChain Storage Unit on top. Self-hosted on Kubernetes (full control, best for regulated workloads, bring your own Postgres and Langfuse). Serverless on AWS Lambda or Cloud Run (best for bursty workloads, requires stateless-between-runs design with external state). Most production-scale deployments converge on a hybrid: tier-1 customer-facing on the managed platform for the SLA, internal agents self-hosted for cost control, shared Langfuse and Postgres backends.
What is the right checkpointer for production LangGraph?+
Postgres. SQLite is fine for prototypes but does not survive production traffic or multi-worker scaling. Use a managed Postgres (RDS, Cloud SQL, Supabase) for single-tenant. For multi-tenant, use per-tenant database (cleanest isolation) or per-tenant schema with row-level security. Plan for 1-10KB per checkpoint times 10-50 checkpoints per agent run. Add Redis as an L1 cache for hot reads at high throughput. Avoid SQLite in production, full stop.
What evals should I run before every prompt or model change?+
A golden dataset of 100-300 representative cases covering happy paths, edge cases, and known failure modes. Score each output on 3-5 criteria specific to your use case (factual accuracy, format compliance, tool-call correctness, citation quality, tone). Use cross-family LLM-as-judge (Claude judging GPT or vice versa) for speed, with 10% human spot-check for calibration. Tools: Promptfoo for fast prompt iteration, LangSmith for end-to-end graph evals against production traces. Without an eval baseline, you cannot tell whether a change improved or regressed the system.
How do I add guardrails to a LangGraph agent?+
Three layers. Input guardrails (Llama Guard 4, Prompt Guard 2 or Lakera Guard) on user input before it reaches the agent: detect prompt injection, jailbreaks, unwanted PII. Output guardrails (NeMo Guardrails or custom Pydantic validators) on agent output before it ships: detect policy violations, factual inconsistency, hallucinated tool calls, sensitive-data exfiltration. Tool-call guardrails between the LLM's tool-call decision and the actual tool execution: validate arguments against schemas, check authorization, enforce rate limits, sandbox dangerous tools. Each adds 50-300ms latency, so run input and output guardrails in parallel and reserve the slowest for high-risk operations.
What SLAs should a managed LangGraph agent service offer?+
Four SLOs work for most production tiers. Availability (typically 99.5% for tier-1, 99.9% for premium). Latency (P95 under 5 seconds for chat, P95 under 30 seconds for complex multi-step). Accuracy (percentage of outputs passing the eval rubric, typically 90-95% depending on sensitivity). Hallucination rate for RAG agents (percentage contradicting retrieved context, under 5% typical, under 1% for high-stakes). Report monthly with target, actual, breach windows (with root-cause one-liners), and remediation. This is the artifact that differentiates a managed AI service from a software license.

Need a tier-1 production agent built on LangGraph with evals, observability, guardrails, and SLAs? Let us scope it.

Explore AI Agent Services

About the Author

Rajat Gautam

Rajat Gautam

AI Consultant & Founder

My work goes far beyond recommending tools - I design AI systems that integrate directly into your workflows, eliminate inefficiencies, and deliver measurable business impact. Every solution I build is tailored, practical, and built with long-term scalability in mind.

Need help with this?

Related Topics

LangGraph
AI Agents
Production AI
Langfuse
Observability
Evals

Related Articles

Ready to transform your business with AI? Let's talk strategy.

Book a Free Strategy Call