Skip to main content
LangChain hosts Managed Deep Agents, so you can create an agent and stream a response without setting up infrastructure. This quickstart shows the CLI, Python SDK, TypeScript SDK, and React useStream paths. For the full deploy workflow and all backend options, see Deploy an agent. For package configuration and API details, see the Managed Deep Agents SDKs.
Managed Deep Agents is in private preview, available on LangSmith Cloud in the US region only. Join the waitlist to request access.

Prerequisites

Before you start, make sure you have:
  • Managed Deep Agents private preview access.
  • A LangSmith API key for a workspace with private preview access.
  • One of the clients shown below: deepagents-cli>=0.2.2, managed-deepagents, or @langchain/managed-deepagents.

Create and run an agent

1

Install a client

Choose the client for your runtime:
uv tool install "deepagents-cli>=0.2.2"

# Or with pip:
pip install -U "deepagents-cli>=0.2.2"
To upgrade an existing CLI install from uv, run uv tool upgrade deepagents-cli.
2

Set your API key

Set a LangSmith API key for a workspace with private preview access:
export LANGSMITH_API_KEY="<LANGSMITH_API_KEY>"
If a request returns 401 or 403, confirm your API key belongs to a workspace with private preview access.
3

Create the agent

Create a Managed Deep Agent. Save the returned agent_id for the run step.
deepagents init research-assistant
cd research-assistant

# Edit AGENTS.md to define the agent behavior, then deploy.
deepagents deploy
The CLI creates agent.json, AGENTS.md, .gitignore, an empty tools.json, an example skill, and an example subagent before deploying. The SDK examples create the hosted agent directly.The examples use the state backend so the agent can run without sandbox-specific configuration. Switch to the sandbox backend when the agent needs a LangSmith sandbox for code execution, filesystem work, or long-running tasks. For options, see Choose a backend.If the agent calls MCP tools, connect tools before creating or deploying the agent.
4

Run the agent

Stream a response from the agent:
from managed_deepagents import Client

agent_id = "<agent_id>"

with Client() as client:
    thread = client.threads.create(
        agent_id=agent_id,
        options={
            "test_run": False,
            "skip_memory_write_protection": False,
        },
    )

    for event in client.threads.stream(
        thread["id"],
        agent_id=agent_id,
        messages=[
            {
                "role": "user",
                "content": "Research recent approaches to agent memory and summarize the main tradeoffs.",
            }
        ],
        stream_mode=["values", "updates", "messages-tuple"],
        stream_subgraphs=True,
        user_timezone="America/Los_Angeles",
    ):
        print(event.event, event.data)
The Python stream yields Server-Sent Events from the run. The TypeScript SDK and React useStream examples use LangGraph stream projections for messages, values, and output state.
If deepagents init, deploy, agents, or mcp-servers are missing or behave unexpectedly, confirm the installed version is 0.2.2 or later with deepagents --version. An older deepagents can shadow the current release on your PATH.

Next steps

Connect tools

Add MCP-backed tools before deploying an agent that needs external capabilities.

Deploy an agent

Learn the full CLI, SDK, and REST API deploy workflow.

SDKs

Use the Python, TypeScript, and React SDKs for Managed Deep Agents.

CLI reference

Review all commands, flags, project files, and validation rules.

API reference

Review generated endpoint reference pages and common REST commands.