/v1/deepagents API for creating agents, managing threads, streaming runs, registering MCP servers, and building React UIs.
For concepts, see the Managed Deep Agents overview. For an end-to-end walkthrough, follow the quickstart.
The SDK packages are in public beta. Method signatures and payload fields can change during the beta.Managed Deep Agents is in private beta, available on LangSmith Cloud in the US region only. Join the waitlist to request access.
Install
- Python 3.10 or newer for
managed-deepagents. - Node.js 22 or newer for
@langchain/managed-deepagents. - Managed Deep Agents private beta access.
- A LangSmith API key for a workspace with private beta access.
Configure a client
Set your API key:https://api.smith.langchain.com/v1/deepagents. To use a compatible endpoint, set LANGSMITH_ENDPOINT or pass the API URL directly:
Client() and new Client() read LANGSMITH_API_KEY and LANGSMITH_ENDPOINT from the environment, so the remaining examples on this page construct a client with no arguments.
Create an agent
Requests to create an agent can use the same top-levelmodel and backend fields as the Managed Deep Agents CLI. Pass model as an object with an id of {provider}:{model_id}. See supported providers and models.
agent["id"]. TypeScript methods return typed objects, so use agent.id.
Run and stream
Create a thread before running the agent. Threads preserve conversation and execution state, so you can resume or inspect a run later. Use theid returned when you created the agent.
options object is optional, and both fields default to false. Set test_run to true to mark the thread as a test run that is filtered out of usage and analytics. By default, skip_memory_write_protection lets the runtime raise a human-in-the-loop interrupt before the agent writes to long-term memory, so you can approve or reject the write. Set it to true to let memory writes proceed immediately, which is useful for headless runs where no human is available to approve the write.
In Python, stream directly with client.threads.stream(...). In TypeScript, get a LangGraph client with client.getLangGraphClient(...) and stream with runs.stream(...), which accepts the message list under input. Each event exposes an event type and a data payload. The types you receive depend on stream_mode. For the stream modes and event types, see Stream a run from a thread.
Use React useStream
The TypeScript SDK includes a LangGraph client adapter for @langchain/react. Use getLangGraphClient() so useStream manages thread lifecycle, run submission, and state updates, while the Managed Deep Agents SDK supplies the correct routes, auth headers, and payload format.
Resources
The SDK clients expose these resource groups:| Resource | Python | TypeScript |
|---|---|---|
| Agents | client.agents | client.agents |
| Threads and runs | client.threads | client.threads |
| MCP servers | client.mcp_servers | client.mcpServers |
| Auth sessions | client.auth_sessions | client.authSessions |
snake_case, such as create_and_run and resolve_interrupt. TypeScript methods use camelCase, such as createAndRun and resolveInterrupt.
The SDKs can register MCP servers, complete auth sessions, and discover a registered server’s tool schemas with client.mcp_servers.list_tools(...) in Python or client.mcpServers.listTools(...) in TypeScript. Pass the selected tool entries to client.agents.create(...) or client.agents.update(...).
Handle errors
Requests raise typed errors that include the HTTP status and, when the API returns them, an error code and detail.403 whose code and detail are empty and whose reason is returned as plain text. Read it from error.body in both SDKs, for example missing permission mcp-servers:create.
For endpoint-level request and response schemas, see the Managed Deep Agents API reference.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

