Why this matters: Choose the smallest layer that owns each responsibility. Use LangChain for a conventional tool-calling agent; add LangGraph for explicit stateful orchestration and durable human approval; use LangSmith services when the team needs hosted observability, evaluation, Studio, or deployment operations. Do not mistake any of these layers for authorization, idempotency, or deterministic business logic.

What you will be able to do
- Select LangChain, LangGraph, LangSmith, and optional protocols based on concrete ownership requirements.
- Implement a scoped, read-only Python LangChain agent using runtime context for dependency injection.
- Specify an explicit LangGraph state contract, routing policy, termination conditions, and approval-resume boundary for a side effect.
- Distinguish thread checkpointing from runtime context and longer-term memory, and test duplicate-action risk.
Start with the failure mode, not the product dictionary
Constrained build: Your product owner asks for an assistant that can answer account-policy questions and change a customer’s mailing address. A common failure is to begin by adding every ecosystem component: a multi-agent graph, an MCP server, a vector database, hosted deployment, and memory. The result is more state, more credentials, and more failure paths than the request requires.
Instead, make one architecture decision: what is the smallest component that can safely own each responsibility? Build read-only assistance first. Make account mutation a deterministic, auditable workflow with an explicit approval boundary. Your deliverable is a component map plus a minimal implementation that proves the boundary.
Design assumption: callers are already authenticated by the surrounding application, an account service is the system of record, and changing an address has real side effects. Those are application facts to validate in your system—not facts an LLM should infer.
Map responsibilities to the correct layer
Use LangChain for the standard loop. Current Python LangChain agents are created with create_agent. They combine a model with tools and middleware; the model can select tools iteratively until it produces a final answer or a stop condition applies. The compiled agent runs on LangGraph’s runtime. This is the correct first choice for policy answers and bounded read-only lookups. ([docs.langchain.com](https://docs.langchain.com/oss/python/langchain/agents?utm_source=openai))
Use LangGraph for explicit orchestration. LangGraph is the lower-level orchestration framework/runtime for long-running, stateful workflows. It gives you explicit nodes, edges, state, persistence, streaming, durable execution, and human-in-the-loop controls. It does not require LangChain, although LangChain components can be used within it. Add it when the topology itself is a requirement: deterministic classification and routing, a mandatory approval gate, parallel branches, a custom recovery path, or graph-level termination conditions. ([docs.langchain.com](https://docs.langchain.com/oss/python/langgraph/overview?utm_source=openai))
Use LangSmith services deliberately. LangSmith provides tracing/observability, datasets and evaluation, prompt-oriented development tooling, Studio, and deployment offerings. A LangChain or LangGraph program can execute without LangSmith. Sending traces, running managed evaluations, using Studio, or deploying through Agent Server are separate operational choices. LangSmith traces are organized as projects containing traces, with individual runs representing steps. ([docs.langchain.com](https://docs.langchain.com/langsmith/observability-concepts?utm_source=openai))
Hands-on: eliminate non-material components
Build artifact 1 — component map. Fill in this map before writing production code:
- Web/API application: authenticates caller; derives tenant, user, and account scope; owns authorization and rate limiting.
- LangChain agent: explains policy and calls read-only tools such as
get_account_summary. Middleware may add prompt policy, tool retry policy, redaction, or logging hooks. - Explicit application/graph logic: validates proposed address format, confirms caller/account ownership, creates a mutation request, and determines whether human review is mandatory.
- LangGraph approval workflow: only if the process must pause durably for review and resume later.
- Account service: performs the actual update; receives an idempotency key and records the authoritative outcome.
- LangSmith (optional): receives traces and supports evaluation; optionally provides Studio and deployment infrastructure.
- MCP (optional): a protocol boundary for connecting tools or systems, not a required agent architecture. Do not introduce it when an in-process, typed tool is sufficient.
Remove now: no vector database unless policy retrieval needs it; no subagents unless delegation improves a measured task; no MCP merely because tools exist; no Agent Server until the application needs its server execution model or selected hosting model.
Implement: a bounded LangChain agent, not an autonomous mutator
Implement the read-only portion as a LangChain agent. Python uses snake_case create_agent; current JavaScript documentation uses camelCase createAgent(). Both build on LangGraph, but do not assume every middleware integration or provider package has identical APIs across languages. ([docs.langchain.com](https://docs.langchain.com/oss/javascript/langchain/agents?utm_source=openai))
from dataclasses import dataclass
from langchain.agents import create_agent
from langchain.tools import tool, ToolRuntime
@dataclass
class RequestContext:
user_id: str
tenant_id: str
allowed_account_ids: set[str]
@tool
def get_account_summary(account_id: str, runtime: ToolRuntime[RequestContext]) -> dict:
"""Return a read-only account summary for an authorized account."""
if account_id not in runtime.context.allowed_account_ids:
raise PermissionError("Account is outside caller scope")
return account_service.fetch_summary(
tenant_id=runtime.context.tenant_id, account_id=account_id
)
agent = create_agent(
model=MODEL, # choose and configure an approved provider integration
tools=[get_account_summary],
context_schema=RequestContext,
)
result = agent.invoke(
{"messages": [{"role": "user", "content": "Summarize account A-17"}]},
context=RequestContext("u-9", "tenant-4", {"A-17"}),
)
Runtime context is dependency injection for per-invocation, generally static dependencies such as identity, database clients, or policy configuration. It is not the prompt context window and it is not durable user memory. Keep credentials in your server-side secret management and inject only capability-scoped clients or identifiers; do not place raw provider or account-service secrets in graph state or model-visible messages. ([docs.langchain.com](https://docs.langchain.com/oss/python/langchain/runtime?utm_source=openai))
Escalate to LangGraph only for the durable approval boundary
Do not make change_address a freely model-selected tool. The model may extract a proposed address or draft a confirmation, but deterministic code must own: schema validation, account ownership, allowed-change policy, approval rules, idempotency-key creation, and the final service call.
If approval must survive a browser disconnect or occur hours later, model it explicitly in LangGraph. State is the mutable working record; define who writes each field. Example contract: request is input-only after validation; validated_change is written only by validate; approval only by the reviewer-resume step; mutation_result only by apply_change. Edges are START → validate → interrupt_for_review → apply_change → END, with validate → END for rejection. The LLM can assist before this graph, but it does not route around validation.
from langgraph.types import interrupt, Command
# Inside the review node, after validation and before any external mutation:
approval = interrupt({
"request_id": state["request_id"],
"proposed_change": state["validated_change"],
"required_role": "address_change_approver",
})
# The authenticated review API verifies reviewer role and request scope,
# then resumes the SAME thread:
graph.invoke(Command(resume={"decision": "approve"}), config=config)
An interrupt saves state through the configured persistence layer and waits until resumed; resumption uses Command and the same thread_id. Authorization is still your API’s responsibility. Avoid side effects before the interrupt unless they are idempotent, because interrupted/retried execution can repeat prior code. ([docs.langchain.com](https://docs.langchain.com/oss/python/langgraph/interrupts?utm_source=openai))
Practicum: Shrink and Secure the Account-Change Assistant
Scenario: You are inheriting an internal “account-change assistant.” It answers policy questions, looks up an account, and may submit an address change. The current proposal uses LangChain, a custom LangGraph graph, MCP, LangSmith, Agent Server, Redis, a vector database, and three subagents—even though most requests are read-only. Your task is to produce the smallest safe architecture, wire a proof-of-boundary implementation, and document what is deliberately excluded.
1. Create a markdown architecture decision record with three columns: requirement, owner, and why the component is necessary. Mark every proposed component as keep, defer, or remove. 2. Implement the read-only tool exactly as a capability-scoped boundary: test an allowed and a cross-account request. 3. Draw the mutation graph with state fields, their single writer, all edges, and each termination condition. 4. Add an approval interruption after validation and before the write. Your resume endpoint must verify the reviewer’s role, tenant, request identifier, and thread identifier. 5. Add an idempotency key to the account-service request and write a test that submits the same approval/resume twice. 6. Run representative tests: valid read-only request; unauthorized account lookup; invalid address; reviewer rejects; reviewer approves; account service times out after receiving the request; duplicate resume. Success means no unauthorized service call, no mutation before approval, and no duplicate address change. 7. If your team uses LangSmith, enable tracing in a non-sensitive environment, inspect the trace path, and create an offline dataset containing these cases. Use code assertions for authorization and duplicate-action cases; reserve LLM-as-judge evaluation for response helpfulness or extraction quality. LangSmith supports both offline dataset evaluation and online evaluation of production runs/threads. ([docs.langchain.com](https://docs.langchain.com/langsmith/evaluation-concepts?utm_source=openai)) 8. For deployment, use current terms: Agent Server is the runtime/API for assistants, threads, and runs; LangSmith Deployment is the current deployment product. The LangGraph CLI offers `langgraph dev`, `langgraph build`, and `langgraph deploy`. Agent Server injects configured checkpointer/store infrastructure at deployment time, so do not hard-code a conflicting production checkpointer into graph code. ([docs.langchain.com](https://docs.langchain.com/langsmith/agent-server?utm_source=openai))
Self-review checklist
- Write a one-page component map with an owner, data lifetime, and failure policy for every component.
- Implement one read-only LangChain agent and one deterministic mutation boundary; do not expose the mutation API directly as a model-selected tool.
- Add a LangGraph approval subgraph only after proving that a pause/resume workflow is required.
- Test read-only, unauthorized, rejected, approved, duplicate-resume, and provider-timeout paths.
- Review a trace or local execution log and confirm that authorization and idempotency checks happened before the mutation call.
Key takeaways
- Start with a LangChain `create_agent` when the required topology is a standard model–tool loop; it already executes on LangGraph.
- Introduce an explicit LangGraph graph only for topology and control requirements that must be deterministic: routing, fixed policy gates, parallel work, durable state, or custom termination.
- Treat runtime context, mutable graph state, thread checkpoints, and cross-thread memory as four different data lifetimes.
- LangSmith tracing and evaluation are optional services; Agent Server and LangSmith Deployment solve deployment/runtime infrastructure rather than replacing application authorization or business policy.
- Use current terminology: LangGraph Platform was renamed LangSmith Deployment in October 2025; LangServe is deprecated for new projects.
Useful terms
- LangChain agent
- A high-level, graph-based agent implementation created in Python with `create_agent` or in JavaScript with `createAgent()`, combining models, tools, and middleware.
- LangGraph state
- Mutable data owned by a graph and updated as nodes execute; use a defined state schema and clear write ownership.
- Runtime context
- Per-invocation dependency-injection data such as identity, scoped clients, or configuration. It is distinct from graph state and LLM prompt context.
- Thread
- An identifier that groups a sequence of checkpointed graph runs; a checkpointer uses it to load state and resume an interrupted execution.
Research & review note
This lesson is built from source-traceable research and reviewed before publication. AI Agentic School uses AI as a research and practice tool, not as a substitute for evidence or editorial judgment.
Sources & further reading
- Agents – Docs by LangChain
- LangGraph overview – Docs by LangChain
- Observability concepts – Docs by LangChain
- Agents – Docs by LangChain
- Runtime – Docs by LangChain
- Interrupts – Docs by LangChain
- Persistence – Docs by LangChain
- Evaluation concepts – Docs by LangChain
- Agent Server – Docs by LangChain
- LangSmith Deployment – Docs by LangChain
- LangSmith: Agent Deployment Infrastructure for Production AI Agents