Deploying with LangSmith Deployment

LangGraph · Expert · 14 min

Production agents need managed persistence, background runs, streaming APIs and scaling that you'd otherwise build yourself.

A compiled graph is just a Python object; production needs an API around it with persistence, queues for long runs, streaming and scaling. LangChain's product for this is LangSmith Deployment, formerly called LangGraph Platform. Old URLs and tutorials still use the old name.

The pieces:

  • Agent Server: the API server that hosts your graphs (the same one langgraph dev runs locally). It exposes assistants (a graph plus a configuration), threads (persisted conversations), runs (executions, including background runs and cron jobs) and a store. It provides checkpointing and long-term memory backed by a database, so you don't pass a checkpointer yourself.
  • Deployment options: LangSmith Cloud (fully managed, deploy from a GitHub repo), hybrid/BYOC (bring your own cloud), or self-hosted, including a standalone server you run in containers. langgraph build produces a Docker image of your app from langgraph.json.
  • Clients: the langgraph-sdk package (get_client(url=...)) and a REST API. Front ends can use the useStream React hook.

Operational points:

  • Graphs must be importable from langgraph.json; keep secrets in environment variables.
  • Pick a thread_id strategy per user/conversation, and a multitask strategy for when a user sends a new message while a run is still going (reject, queue, interrupt or rollback).
  • Long runs belong in background runs with webhooks or polling, not a single open HTTP request.

LangSmith Deployment is framework-agnostic, but you can also self-host LangGraph entirely in your own web app with a Postgres checkpointer; you then build the API and job handling yourself.

Example

# pip install langgraph-sdk
import asyncio
from langgraph_sdk import get_client


async def main() -> None:
    client = get_client(url="http://127.0.0.1:2024")    # langgraph dev, or your deployment URL
    thread = await client.threads.create()

    async for chunk in client.runs.stream(
        thread["thread_id"],
        "support_agent",                                # graph name from langgraph.json
        input={"messages": [{"role": "user", "content": "My order is late"}]},
        stream_mode="updates",
    ):
        print(chunk.event, chunk.data)

    state = await client.threads.get_state(thread["thread_id"])
    print(state["values"]["messages"][-1]["content"])


asyncio.run(main())

Remember

  • LangSmith Deployment = the current name for LangGraph Platform
  • Agent Server hosts graphs with assistants, threads, runs, store
  • Cloud, hybrid/BYOC or self-hosted; langgraph build makes a Docker image
  • Call deployments with langgraph-sdk get_client or the REST API

Check yourself

  1. A user sends a second message while their first run is still executing on the same thread. What setting decides what happens?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.langchain.com/langsmith/deployment