Slides · LangChain ecosystem
LangSmith Deployment: running agents in production
1 / 34
LangSmith Deployment: running agents in production
What an agent server adds to a graph, where it can run, how it treats a second message, how to lock it down and how to ship a change without stranding paused runs.
By the end you can define the server’s objects, choose a hosting model, pick a double-texting strategy, design access control and budgets, and plan a safe release.
Concept
Names change, so check the date
- This deck reflects the official docs as read on 24 October 2026. Product names, plan tiers and limits move often; confirm them before quoting in an interview or a contract.
- At that date the docs call the hosted-and-self-hostable product LangSmith Deployment, and its runtime the Agent Server. The Deployment page describes it as a workflow orchestration runtime built for agent workloads.
- The Deployment page says every hosting option uses the same Agent Server runtime.
- The page text read for this deck does not use the older name “LangGraph Platform”. Older articles and videos may.
- Principles in this lesson outlast the names: durable state, queues, access control, budgets, safe releases.
Sources[1] LangSmith Deployment (LangSmith documentation)[2] Agent Server (LangSmith documentation)
Compare
What a plain endpoint leaves to you
| Agent need | Wrapping graph.invoke in a handler | Agent Server |
|---|---|---|
| Wait hours for a person, then continue | You build storage and a resume path | Checkpoints and threads (docs) |
| Survive a process restart | In-flight work is lost unless you saved it | State kept in PostgreSQL (docs) |
| Many runs at once | You build a queue and workers | A task queue with workers (docs) |
| Live partial output | You build streaming | Server-sent events (docs) |
| A run that outlasts a request timeout | Course reasoning: the connection drops first | Background runs return at once |
The Agent Server page describes persistence and a task queue as built in. It does not make the agent safe, cheap or correct; that stays with you.
Diagram
Inside the Agent Server
Compare
Five words to define on a whiteboard
| Object | What it is | Typical mapping |
|---|---|---|
| Assistant | A graph plus its configuration | One per tenant or persona |
| Thread | A container for one conversation’s state | One per conversation |
| Run | One execution of a graph | One per user message |
| Store | Long-term memory across threads (PostgreSQL by default, replaceable) | A user’s saved preferences |
| Checkpoint | A snapshot of graph state written during execution | Lets an interrupted run resume |
The page also lists cron jobs (scheduled runs) and the task queue (pending runs that workers pick up and cancel on signal). The “typical mapping” column is this course’s suggestion. The persistence page describes checkpoints as a thread’s graph state.
Sources[2] Agent Server (LangSmith documentation)[3] Persistence (LangGraph documentation)
Diagram
How the objects relate
Concept
What lives where
- PostgreSQL is the default for assistants, threads, runs, cron jobs, checkpoints and the store. The page says checkpoints can go to MongoDB or a custom backend, and the store can be replaced.
- Redis handles signalling, cancellation and streaming between API servers and workers. The page says it stores only ephemeral data, and that run data is always read from and written to PostgreSQL.
- Durability modes on the page:
async(the default) writes a checkpoint after each step;exitstores only the final state. The trade-off: less writing, but an interrupted run has less to resume from. - Concurrency: the queue allows at most one run per thread at a time, and each worker runs up to
N_JOBS_PER_WORKERruns (default 10).
Code
A deployable project is small
JSON
{
"dependencies": ["."],
"graphs": { "support": "./src/graph.py:graph" },
"auth": { "path": "./src/auth.py:auth" }
}The CLI reference marks graphs as required and dependencies as required for Python unless source is set. env, auth, checkpointer, store, http and api_version are optional; the checkpointer key’s backend defaults to "default" (PostgreSQL).
Each key under graphs is a graph id that clients pass as the assistant id. The reference says a graph path may point to a compiled graph or a factory function. langgraph dev runs a local server with hot reload and needs no Docker.
Tested 24 October 2026 with langgraph-cli 0.4.38 and langgraph-api 0.16.6: this file started a local dev server with the auth handler loaded.
Sources[4] LangGraph CLI (LangSmith documentation)[5] Application structure (LangSmith documentation)
Code
A background run, step by step
Python
client = get_client(url=URL)
thread = await client.threads.create()
run = await client.runs.create(thread["thread_id"], "support", input=inp)
print((await client.runs.get(thread["thread_id"], run["run_id"]))["status"])
await client.runs.join(thread["thread_id"], run["run_id"])
print((await client.runs.get(thread["thread_id"], run["run_id"]))["status"])
state = await client.threads.get_state(thread["thread_id"])| Step | Observed (local dev server, 3-second graph) |
|---|---|
runs.create returns | status pending, before the work finishes |
runs.get right after | pending |
after runs.join | success |
threads.get_state | the graph’s final messages |
This is the shape for work that outlasts an HTTP request. The local dev server is a single-process runtime with local file persistence (the CLI reference says state is persisted to a local directory), so it shows the API, not production durability.
Source[6] How to kick off background runs (LangSmith documentation)
Check yourself
Check: which server object?
A retailer’s support graph has three requirements: (a) remember a customer’s preferred language the next time they chat; (b) if a worker dies mid-run, continue from where it stopped; (c) produce a summary report every night at 2 a.m. Name the server object for each. Then, with 6 workers at default settings, how many runs can the fleet execute at once?
Answer
(a) The store, because it holds memory across threads. (b) Checkpoints, written during a run so it can resume. (c) A cron job, which is the server’s scheduled run. Capacity: 6 workers times 10 runs each is 60 concurrent runs, if the default N_JOBS_PER_WORKER of 10 is unchanged and the one-run-per-thread rule is not the limit.
Compare
Four hosting types and a fifth path
| Option | Who runs what | Plan the page states |
|---|---|---|
| Cloud | LangChain runs the control plane, data plane and databases, on AWS and GCP | Plus or above |
| Hybrid | LangChain runs the control plane; you run the servers and data plane. Traces go to LangSmith Cloud or self-hosted LangSmith | Not stated on the page |
| Self-hosted with control plane | You run everything in your Kubernetes cluster next to self-hosted LangSmith | Enterprise, with Deployment enabled |
| Standalone server | You run the server with Docker, Compose or Kubernetes and supply PostgreSQL, Redis and a licence; no control plane | Not stated on the page |
| Build your own | You assemble a web framework, a job queue and a checkpointer | Not a product |
Plan names and prices change; the table is as of 24 October 2026. Only self-hosted LangSmith keeps traces inside your network; hybrid with LangSmith Cloud sends them out. The intro of the page also mentions BYOC without defining it, so this deck does not cover it. The fifth row is course framing, not a docs option.
Diagram
A first-pass filter, not a rule
Concept
What each choice costs
- Cloud: least work to run, but the vendor operates the data plane and databases, and a paid plan is needed.
- Hybrid: data stays with you, but you run and scale the servers.
- Self-hosted with control plane: most control and most to operate, on Kubernetes.
- Standalone: smallest footprint, but you bring PostgreSQL, Redis and a licence and give up the control plane.
- Build your own: you re-implement streaming, resume, queues, scheduling and concurrency rules (course reasoning: each is a piece the server supplies).
- Lock-in framing (course advice): the graph code is open source and portable; the server is the piece your team comes to rely on, so it is where switching costs sit. The Deployment page says the product is framework-agnostic, so agents from other frameworks can be hosted.
Check yourself
Check: match two teams to an option
Team A must run the whole stack, including the management layer, inside its own Kubernetes cluster, beside a self-hosted LangSmith. Team B has two engineers, a single Docker host and no wish for a console, and will bring its own PostgreSQL and Redis. Which option for each, what does the page say Team A needs, and what does Team B take on?
Answer
Team A: self-hosted with control plane; the Deployment page says it requires the Enterprise plan with LangSmith Deployment enabled. Team B: a standalone server; it supplies PostgreSQL, Redis and a licence, has no control plane, and must operate, back up and upgrade everything itself. The cost to weigh is staff time against the vendor’s price.
Concept
A second message arrives mid-run
- Users send a correction before the first answer finishes. The queue allows one run per thread at a time, so the server needs a rule for the second one.
- The docs call this double texting and name four strategies. Enqueue is the default.
- The page states double texting is a feature of LangSmith Deployment, not of the open-source library. Course reasoning: a bare graph behind your own web server has no such rule, so you would have to write one.
- Choosing is a product decision. The default is a decision somebody else made.
Sources[7] Double texting (LangSmith documentation)[2] Agent Server (LangSmith documentation)
Compare
The four strategies and their costs
| Strategy | What the docs say happens | What it costs |
|---|---|---|
| Enqueue (default) | The current run finishes before the new input is processed | The user waits, and a stale first answer still appears |
| Reject | Additional runs are refused while one is in progress | The new message is turned away |
| Interrupt | The current run halts with progress preserved; the new input is added and execution continues from that state | The graph must handle half-finished work such as a partial tool call |
| Rollback | The run halts and all progress, including its input, is reverted; the new input starts a fresh run | The earlier work is discarded |
Sources[7] Double texting (LangSmith documentation)[8] Reject Concurrent (LangSmith documentation)[9] Interrupt concurrent (LangSmith documentation)[10] Rollback Concurrent (LangSmith documentation)
Worked example
Observed: one thread, two messages
A 3-second graph echoes its last message. The first message “first” is sent, then “second” one second later with each multitask_strategy. Local dev server, 24 October 2026. Each result was observed and matches the how-to guides: reject returns HTTP 409 Conflict and the first run continues; interrupt keeps the first run with status interrupted and its partial data in the thread; rollback deletes the first run, which cannot be restarted.
| Strategy | Second request | First run | Messages in the thread |
|---|---|---|---|
| enqueue | accepted | success | first, echo: first, second, echo: second |
| reject | refused with HTTP 409 | success | first, echo: first |
| interrupt | accepted | interrupted | first, second, echo: second |
| rollback | accepted | record gone (lookup returned not found) | second, echo: second |
Read the last two rows carefully. Interrupt keeps the first input but no answer to it; rollback removes the first input as well. Neither undoes anything outside the graph, such as an email already sent (course reasoning).
Sources[8] Reject Concurrent (LangSmith documentation)[9] Interrupt concurrent (LangSmith documentation)[10] Rollback Concurrent (LangSmith documentation)
Diagram
Choosing by what a half-done run costs
Check yourself
Check: three products, three strategies
(a) A live-caption tool where only the newest sentence matters. (b) A triage queue where every incoming message is a separate customer complaint that must all be handled. (c) A bulk spreadsheet import that users sometimes trigger twice by double-clicking. Pick a strategy for each and state its cost.
Answer
(a) Interrupt or rollback: older input is worthless; the cost is discarded or half-finished work. (b) Enqueue: nothing may be dropped; the cost is waiting. (c) Reject: the second trigger would duplicate or collide with a job already running; the cost is that a deliberate second request is turned away. Other answers can be defended if the cost is stated.
Concept
Authentication, then authorization
- Authentication runs on every request through the
@auth.authenticatehandler. It validates credentials and returns the caller’s identity, with extra fields such as role or organisation optional. - Defaults differ. Per the auth page, the hosted product uses LangSmith API keys in the
x-api-keyheader unless you replace them. A self-hosted server has no default authentication: you implement the whole model. - Authorization runs through
@auth.onhandlers at three levels: global, resource and action. The most specific match wins. - A handler can add metadata to a resource at creation, return a filter to restrict reads and searches, or raise an error to deny.
Source[11] Authentication and access control (LangSmith documentation)
Diagram
Thread ownership by metadata
owner value written into their metadata at creation. Runs inherit the thread’s access control; the store is scoped by rewriting its namespace.Source[11] Authentication and access control (LangSmith documentation)
Code
A tested handler pair
Python
USERS = {"tok-alice": "alice", "tok-bob": "bob"} # stand-in for a real identity check
@auth.authenticate
async def authenticate(headers: dict):
tok = headers.get(b"x-token", b"").decode()
if tok not in USERS:
raise Auth.exceptions.HTTPException(status_code=401, detail="Invalid token")
return {"identity": USERS[tok], "is_authenticated": True}
@auth.on
async def owner_only(ctx: Auth.types.AuthContext, value: dict):
value.setdefault("metadata", {})["owner"] = ctx.user.identity
return {"owner": ctx.user.identity}| Case (local dev server, 24 October 2026) | Observed |
|---|---|
| No token, or an unknown token | HTTP 401 |
| Alice creates a thread and runs it | works; metadata shows owner: alice |
| Bob reads, gets state of, or starts a run on Alice’s thread | HTTP 404 |
| Bob searches threads | 0 results, while Alice sees her own |
Same server with the @auth.on handler removed | Bob read Alice’s messages, and Alice’s threads appeared in his search |
The last row is the insecure direct object reference: authentication alone does not stop it. The 404 is what this version returned; the auth page names only 401 and 403.
Source[11] Authentication and access control (LangSmith documentation)
Compare
Four controls and what happens without each
| Control | What goes wrong without it |
|---|---|
User id read from the authenticated run configuration (config["configuration"]["langgraph_auth_user"], per the auth page) | A model-supplied id can name any customer |
| A cap on calls, tokens, time and money per run, plus an explicit recursion limit (course advice) | One looping run spends like a normal day |
| A degraded mode that turns write tools off, plus a runbook for stopping runs (course advice) | Nothing limits damage while you investigate |
| Tools that tolerate being called twice (the interrupts docs advise idempotent side effects before an interrupt) | A resume or retry repeats a payment or a message |
The Agent Server page says workers cancel a run when signalled, so cancellation is a platform capability. The degraded mode, per-run spend caps and repeat-safe tools are yours to build.
Sources[11] Authentication and access control (LangSmith documentation)[12] Interrupts (LangGraph documentation)
Math
Worst-case cost of one run
max cost per run=calls×(in_tokens×price_in+out_tokens×price_out)fleet worst case=max cost per run×runs per day| Symbol | Meaning |
|---|---|
| calls | The model-call limit you enforce per run |
| in_tokens, out_tokens | Average tokens in and out per call |
| price_in, price_out | Price per token (illustrative below) |
Illustrative: 15 calls, 3,000 tokens in and 500 out per call, at 2 dollars per million input tokens and 8 dollars per million output tokens. Input: 15×3,000×$2/1,000,000=$0.09. Output: 15×500×$8/1,000,000=$0.06. Total 0.15 dollars per run. At 50,000 runs a day the ceiling is 7,500 dollars, which is a number to set an alert against.
Check yourself
Check: size a cap and find the leak
A team caps runs at 12 model calls, averaging 2,000 tokens in and 400 out per call, at an illustrative 3 dollars per million input and 12 dollars per million output. What is the per-run ceiling, and what is it across 20,000 runs a day? Separately, their agent keeps long-term preferences in the store under one shared namespace. How do they stop one customer reading another’s, and how does that differ from isolating threads?
Answer
Input: 12×2,000×$3/1,000,000=$0.072. Output: 12×400×$12/1,000,000=$0.0576. Total 0.1296 dollars per run; times 20,000 is 2,592 dollars a day. On the store: the auth page says store handlers do not return metadata filters; they rewrite the namespace field so each user’s data sits under their own prefix. Threads, by contrast, are protected by writing an owner into metadata and filtering on it.
Process
A deploy while runs wait for approval
If 2,000 runs wait for a person and you ship a new graph, what must be true?
- State is in a durable store, not the process. The persistence docs say in-memory checkpoints are lost on restart.
- Old saved state must still fit the new code. Do not rename or remove keys that live runs hold, and tolerate missing ones.
- Interrupt order and node names are stable. The interrupts docs say a node re-runs from its start on resume and that resume values pair by position.
- Side effects are idempotent, because a node can run again.
- In-flight runs drain, or the rollout behaviour is understood and tested (course advice; check the platform’s rollout documentation).
Sources[12] Interrupts (LangGraph documentation)[3] Persistence (LangGraph documentation)
Worked example
Observed: a release swaps two questions
A node asks “Approve refund?” then “Reason?”. A run pauses at the first question. A new release swaps the two calls in the same node, and a person answers yes.
Python
# v1: approved = interrupt("Approve refund?"); reason = interrupt("Reason?")
# v2: reason = interrupt("Reason?"); approved = interrupt("Approve refund?")Step (in-memory saver, langgraph 1.2.17) | Result |
|---|---|
| Paused under v1 | waiting at “Approve refund?” |
Resumed under v2 with yes | the first interrupt now means “Reason?”, so yes lands there |
| Second answer, “duplicate order” | lands in approved |
| Final state | approved: duplicate order, reason: yes |
Nothing failed loudly. A wrong value in an approval field is truthy, which is how a swap becomes a wrong action. Keep order stable, or version the node and drain old runs.
Check yourself
Check: a renamed state key
A release renames the state key ticket_id to id, and the node now reads state["id"]. 800 runs are paused. What happens when they resume, and how do you ship safely?
Answer
In a test with an in-memory saver, a run paused under the old graph and resumed under the new one raised KeyError: 'id', because the saved state still holds ticket_id. A tolerant read (id first, then ticket_id) worked only while the new state schema still declared ticket_id: with a schema declaring only id, the old value never reached the node (the read returned nothing). So the required condition is to keep both keys in the schema. Safe path: declare both for a release or two, read tolerantly, migrate saved state, then remove the old key once no paused run holds it.
Compare
Two gates for one change
| Aspect | Offline gate | Online watch |
|---|---|---|
| When | Before release, on a dataset | After release, on sampled production traces |
| Reference outputs | Available, so correctness can be scored | None exist, so only reference-free checks work |
| Catches | Regressions on known cases | Quality degradation and cases the dataset lacks |
The table follows the evaluation-concepts page. Course advice around it: expose a new version to a small share of traffic first, pin langchain, langgraph, langsmith and provider versions in a lock file, upgrade on a branch with an evaluation and a trace comparison, and keep the previous graph and prompt deployable so one rollback restores both.
Compare
Runbooks for failures that will happen
| Failure | First response (course advice) |
|---|---|
| Model provider down | Fall back to a second model; degrade to answer-only if needed |
| Runaway loop | Cancel through the kill switch; check the budget and the recursion limit |
| Corrupted thread | Update the state, or fork from the last good checkpoint |
| Queue backlog | Limit or shed load by tenant; add workers |
| Bad release | Roll back graph and prompt together |
| Database growth | Prune old checkpoints; keep large documents out of state, since checkpoints accumulate over long conversations |
Write each as steps a tired person can follow at 3 a.m., with a named owner.
Summary
Recap
- Agent runs are long, bursty, stateful and interruptible; the Agent Server adds queues, persistence, streaming and scheduling around your graph.
- Assistant, thread, run, store, checkpoint: define each and say where it lives. PostgreSQL holds data; Redis only signals.
- Hosting: cloud, hybrid, self-hosted with control plane, standalone, or build your own. Each trades operating effort against control.
- Double texting: enqueue (default), reject, interrupt, rollback. Choose by what a half-done run costs.
- Authenticate every request, filter threads by owner, inject identity from context, cap spend, and keep a kill switch.
- Paused runs survive a release only if state is durable and compatible and interrupt order is stable. Gate changes with evaluation.
References
References & Sources (1 of 3)
LangSmith Deployment (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/deployments
Used for The deployment options (cloud, hybrid, self-hosted with control plane, standalone), who runs what, the plan requirements the page states, and the shared Agent Server runtime. Read 24 October 2026.
Agent Server (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/agent-server
Used for Assistants, threads, runs, cron jobs, the store, checkpoints and the task queue; PostgreSQL for core data, Redis for ephemeral signalling; the async and exit durability modes; one run per thread at a time. Read 24 October 2026.
Persistence (LangGraph documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/oss/python/langgraph/persistence
Used for Checkpointers persist a thread's graph state as checkpoints; in-memory ones lose them on restart and a persistent checkpointer is advised for production.
LangGraph CLI (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/cli
Used for The langgraph.json keys (graphs, dependencies, env, auth, checkpointer, api_version) and the dev, build, up and deploy commands.
Application structure (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/application-structure
Used for The parts of a deployable project and the shape of the graphs and env entries in the configuration file.
References
References & Sources (2 of 3)
How to kick off background runs (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/background-run
Used for The steps of a background run: create a thread, create a run, poll its status (pending, then success), join, and read the final state.
Double texting (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/double-texting
Used for The four strategies (enqueue as the default, reject, interrupt, rollback) and the statement that double texting is a deployment feature, not part of the open-source library.
Reject Concurrent (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/reject-concurrent
Used for Reject throws an error for the new run (HTTP 409 Conflict) while the first run continues.
Interrupt concurrent (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/interrupt-concurrent
Used for Interrupt keeps the first run in the database with status interrupted, and the thread holds partial data from it.
Rollback Concurrent (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/rollback-concurrent
Used for Rollback deletes the first run, which cannot be restarted; the thread then holds only the second run's messages.
References
References & Sources (3 of 3)
Authentication and access control (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/auth
Used for Authentication on every request, hosted versus self-hosted defaults, authorization handlers at three levels, thread ownership through metadata, store namespaces, and how identity reaches the run configuration.
Interrupts (LangGraph documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/oss/python/langgraph/interrupts
Used for A node re-runs from its start on resume, resume values pair by position, and side effects before an interrupt should be idempotent.
Evaluation concepts (LangSmith documentation) (opens in a new tab)
LangChain2026Documentation
https://docs.langchain.com/langsmith/evaluation-concepts
Used for Offline evaluation runs on datasets before deployment; online evaluation runs on production traffic without reference outputs.
Keys: ← → move, Home End first and last, F full screen.