LangChain · 2026
Production agent engineering

Build a production-ready LangChain agent

An updated roadmap for LangChain v1-style agents: use create_agent for the common loop, LangGraph for deeper orchestration, and add middleware, structured output, durable state, controls, and evaluation.

What changed

LangChain’s current agent model is simpler at the top

The modern entry point is create_agent, backed by the LangGraph runtime. Middleware provides step-by-step control, while LangGraph remains the lower-level option for custom orchestration.

🧠

Model

Choose a provider/model based on capability, latency, cost, and tool/structured-output support.

🛠️

Tools

Define narrow, typed actions. Tool quality and permissions often matter more than prompt cleverness.

🧩

Middleware

Intercept model and tool calls for retries, dynamic prompts, model selection, HITL, policy, and context management.

🧱

LangGraph runtime

Checkpointing, persistence, durable execution, streaming, memory, and human-in-the-loop support.

Production lifecycle

From task definition to controlled rollout

The older six-stage flow still works, but the implementation details have changed.

1

Define the job

Examples, boundaries, success metrics, escalation rules.

2

Design tools

Typed schemas, narrow scopes, deterministic validation.

3

Build with create_agent

Model + tools + system prompt + structured response.

4

Add middleware

Retry, policy, HITL, context editing, tool selection.

5

Evaluate traces

Final answer + tool sequence + cost + latency + safety.

6

Deploy + monitor

Checkpoint state, observe, canary, compare variants.

Current pattern

A small production-oriented skeleton

Use structured output and middleware instead of treating the agent loop as an opaque prompt.

from langchain.agents import create_agent
from pydantic import BaseModel

class Decision(BaseModel):
    action: str
    rationale: str
    confidence: float

agent = create_agent(
    model="your-provider:model",
    tools=[lookup_customer, get_policy, create_case],
    system_prompt="Resolve only within approved policy boundaries.",
    response_format=Decision,
    middleware=[retry_policy, approval_gate, audit_middleware],
)

result = agent.invoke({"messages": [{"role": "user", "content": request}]})
2026 update: older LangGraph create_react_agent examples should be migrated toward LangChain create_agent when the higher-level abstraction is sufficient.
When to drop lower

Use LangGraph when orchestration becomes the product

Custom graph control is valuable when the workflow needs explicit state transitions, branches, loops, recovery, subgraphs, or long-running human approval.

Stay with create_agent

One agent, a manageable toolset, structured output, middleware, and standard tool loops.

Use LangGraph directly

Complex state machines, explicit routing, multiple agents, durable multi-stage work, custom resumption.

Add MCP selectively

Use MCP when tool interoperability across hosts/clients matters; do not turn every internal function into a remote protocol boundary.

Dataknobs adds the operating layer around the framework

LangChain or LangGraph can implement KREATE. KONTROLS defines tool permissions and approvals. KNOBS supplies trace evaluation, experiments, cost/latency monitoring, and rollout evidence.