LangSmith Platform

Deploy your LangGraph agent to the LangSmith Platform and connect it to CopilotKit.

LangSmith Deployment gives your LangGraph and Google ADK agents a managed runtime (serverless by default). It handles scaling, persistence, and the LangGraph Server API. CopilotKit gives those agents a production-ready frontend.

How it works

The two connect through CopilotKit Runtime, a lightweight server-side layer that sits between your browser and your LangSmith deployment. It's the same runtime you'd use with any CopilotKit-powered agent. It just needs to run server-side so your LANGSMITH_API_KEY never reaches the browser.

Browser → CopilotKit Runtime → LangSmith deployment → your agent

LangSmith hosts the agent only; there's no frontend-hosting offering. You host the CopilotKit frontend and runtime wherever you already deploy your app (Vercel, your own Node server, etc.) and point the runtime at the LangSmith deployment URL.

What you get

  • Chat UI: prebuilt chat interface, or headless hooks to build your own
  • Shared state: bidirectional sync between agent state and your React UI
  • Generative UI: render custom components from tool calls in real time
  • Human-in-the-loop: let users review, approve, or redirect agent actions
  • Managed persistence: thread history and checkpoints live in the LangSmith deployment

Quickstart

Prerequisites
  • A LangSmith account on the Plus plan or above.
  • A LangSmith API key (lsv2_...).
  • The LangGraph CLI.
  • Docker, only for local container builds.
  • For Google ADK: Python 3.11+, the deployments-wrap-sdk[google-adk] package, and a Google AI API key if you use Gemini models.
Deployment models

This guide uses LangSmith Cloud via the CLI: serverless by default, or --deployment-type dedicated for a dedicated deployment. LangSmith also supports self-hosted control plane, hybrid, and standalone-server models; see the deployment overview to pick one. The CopilotKit wiring below is the same regardless of which model you deploy to.

Choose your starting point

Deploy a new agent to LangSmith from scratch, or connect CopilotKit to an agent you've already deployed.

Install the LangGraph CLI

The CLI scaffolds a deployable project and pushes it to LangSmith:

uv tool install langgraph-cli

Create your deployable app

A LangSmith deployment is any project that exports a graph via langgraph.json.

Scaffold a new project from the official template:

langgraph new ./my-agent --template new-langgraph-project-python

The template ships a langgraph.json that already exports a graph:

langgraph.json
{
  "$schema": "https://langgra.ph/schema.json",
  "dependencies": ["."],
  "graphs": {
    "agent": "./src/agent/graph.py:graph"
  },
  "env": ".env"
}

The graphs key (agent here) is the graph ID you'll point CopilotKit at later.

Add your API key

Add your LangSmith API key to the project's .env. The deploy command reads it automatically:

.env
LANGSMITH_API_KEY=lsv2_...

Deploy

Verify locally first

Before deploying, run langgraph dev from the project root to serve the graph locally and confirm it starts. This catches import errors, a bad graph export, or (for ADK) a missing LangsmithSessionService or model credentials with clearer feedback than a remote build.

From the project root:

langgraph deploy --name my-agent

This creates a serverless deployment by default. Useful flags:

  • --deployment-type dedicated: provision a dedicated (non-serverless) deployment
  • --name <name>: set the deployment name (re-running langgraph deploy with the same name updates the existing deployment in place)

For all langgraph deploy commands, see the LangGraph CLI reference.

Get your deployment URL

Where to find the URL

In the LangSmith UI, open Deployments in the sidebar, select your deployment, and copy the API URL (your deployment URL) from the details view. It looks like https://<deployment-id>.<region>.langgraph.app.

Install CopilotKit

In your frontend app:

npm install @copilotkit/react-core @copilotkit/runtime

Set up CopilotKit Runtime

CopilotKit Runtime is the server-side layer that connects your frontend to the LangSmith deployment. Create an API route:

app/api/copilotkit/[[...slug]]/route.ts
import {
  CopilotRuntime,
  createCopilotRuntimeHandler,
  InMemoryAgentRunner,
} from "@copilotkit/runtime/v2";
import { LangGraphAgent } from "@copilotkit/runtime/langgraph";

const runtime = new CopilotRuntime({
  agents: {
    my_agent: new LangGraphAgent({
      deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL!, // your deployment URL
      graphId: "agent", // must match a key in your langgraph.json "graphs"
      langsmithApiKey: process.env.LANGSMITH_API_KEY!,
    }),
  },
  runner: new InMemoryAgentRunner(),
});

const handler = createCopilotRuntimeHandler({
  runtime,
  basePath: "/api/copilotkit",
});

export const GET = handler;
export const POST = handler;
graphId must match langgraph.json

graphId is the key from the graphs object in your langgraph.json: agent for the LangGraph template, or whatever you named the ADK graph (e.g. my_agent). If it doesn't match, the runtime can't find your graph.

Add the CopilotKit provider

app/providers.tsx
"use client";

import { CopilotKit } from "@copilotkit/react-core/v2";

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <CopilotKit runtimeUrl="/api/copilotkit" agent="my_agent" useSingleEndpoint={false}>
      {children}
    </CopilotKit>
  );
}

Wrap your app with the provider in app/layout.tsx:

app/layout.tsx
import { Providers } from "./providers";
import "@copilotkit/react-core/v2/styles.css";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Providers>
          {children}
        </Providers>
      </body>
    </html>
  );
}

Run it

Point your app at the deployment and start it. Create .env.local:

.env.local
LANGGRAPH_DEPLOYMENT_URL=https://<deployment-id>.<region>.langgraph.app
LANGSMITH_API_KEY=lsv2_...

Then:

npm run dev

Add a <CopilotSidebar /> to any page and open localhost:3000. The frontend runs wherever you host it while the agent stays on LangSmith. The /api/copilotkit route forwards each call to your deployment using your API key.

Send a message in the sidebar. The agent on LangSmith replies in the chat.

Troubleshooting

What's next?

How is this guide?