> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy a Managed Deep Agent

> Test and deploy a Managed Deep Agent with the mda CLI.

Deploying a Managed Deep Agent compiles a code-first project into a managed LangGraph app, syncs deploy-owned context to [Context Hub](https://docs.langchain.com/langsmith/python/managed-deep-agents-context-hub.md), uploads the compiled source, and triggers a LangSmith hosted deployment build. The result is an [Agent Server](https://docs.langchain.com/langsmith/agent-server-overview.md) deployment, including the Agent Server API and [MCP endpoint](https://docs.langchain.com/langsmith/python/managed-deep-agents-mcp-endpoint.md).

> [!NOTE]
>
> Managed Deep Agents is in **public [beta](https://docs.langchain.com/langsmith/release-stages.md)** on [LangSmith Cloud](https://docs.langchain.com/langsmith/cloud.md) and [Bring Your Own Cloud (BYOC)](https://docs.langchain.com/langsmith/byoc.md). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.

This page covers secrets routing and deploy options. To test the agent before deploying, see [Develop locally with LangSmith Studio](https://docs.langchain.com/langsmith/python/managed-deep-agents-local-development.md). For command flags, the deploy step list, and troubleshooting, see the [CLI reference](https://docs.langchain.com/langsmith/python/managed-deep-agents-cli.md). To deploy a finished open-source project instead, see the [design agent](https://docs.langchain.com/langsmith/python/managed-deep-agents-design-agent.md) and [paid media agent](https://docs.langchain.com/langsmith/python/managed-deep-agents-paid-media-agent.md) templates.

## Prerequisites

Before you deploy, make sure you have:

* A LangSmith Cloud workspace or a workspace in a [BYOC data plane](https://docs.langchain.com/langsmith/byoc-onboarding-aws.md).

* A [LangSmith API key](https://docs.langchain.com/langsmith/create-account-api-key.md) for that workspace, in `.env` or your shell environment. On an interactive terminal, `mda deploy` prompts for a key or signs you in through the browser instead.

* The `mda` CLI installed from `managed-deepagents`.

* Project dependencies installed with `uv sync` for generated Python projects.

* Model provider credentials, such as `OPENAI_API_KEY`, in `.env`, your shell environment, or LangSmith workspace secrets.

## Select a SaaS region

`LANGSMITH_ENDPOINT` selects the LangSmith region the CLI deploys to. The CLI targets GCP US by default.

Set `LANGSMITH_ENDPOINT` in your project's `.env` or your shell environment before your first deploy:

| Region | Endpoint | Deployment support |
| - | - | - |
| GCP US (`smith.langchain.com`) | `https://api.smith.langchain.com` | Supported |
| GCP EU (`eu.smith.langchain.com`) | `https://eu.api.smith.langchain.com` | Supported |
| GCP APAC (`apac.smith.langchain.com`) | `https://apac.api.smith.langchain.com` | Supported |
| AWS US (`aws.smith.langchain.com`) | `https://aws.api.smith.langchain.com` | Supported |
| Azure US (`azure.smith.langchain.com`) | `https://azure.api.smith.langchain.com` | Supported |

For example, to deploy to GCP EU:

```text .env theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com
```

Credentials must belong to the target region. Set `LANGSMITH_ENDPOINT` before the first deploy, because it also selects the region that browser sign-in authenticates against. A non-interactive run cannot fall back to browser sign-in, so in CI set `LANGSMITH_API_KEY` for the target region.

For more information on regions, see the [Regions FAQ](https://docs.langchain.com/langsmith/regions-faq.md).

> [!NOTE]
>
> LangSmith managed tools are available in GCP US only.

## Select a BYOC data plane

For BYOC, use Managed Deep Agents CLI and SDK v0.10 or later. Set `LANGSMITH_ENDPOINT` to your data plane's API URL, not a SaaS regional endpoint. Find the endpoint in **Settings > Data Planes**. See [BYOC usage](https://docs.langchain.com/langsmith/byoc-usage.md).

Set `LANGSMITH_API_KEY` to a key for a workspace inside that data plane. Set `LANGSMITH_WORKSPACE_ID` to the target workspace ID, or pass `--workspace-id` to `mda deploy`. Configure these values in your project's `.env` or shell environment before deploying.

The CLI derives the Deployment API URL from the data plane endpoint. Do not append `/api-host` to `LANGSMITH_ENDPOINT`.

BYOC data planes do not support Serverless Agent Servers. Run `mda deploy --push-to <image-repository>` to build and push your agent image. The CLI creates a Dedicated Agent Server by default, so you do not need to pass `--agent-server-type dedicated`.

## Deploy to LangSmith

Deploy the local project:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
uv run mda deploy
```

> [!TIP]
>
> `mda deploy` routes local project inputs to different managed surfaces:
>
> ```text theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
> instructions.md + skills/**  -> Context Hub deploy-owned context
> .env                         -> deploy auth + non-reserved hosted secrets, not archived
> project source files         -> .mda/build source archive -> hosted deployment
> schedules/**                 -> LangSmith cron jobs after the deployment is live
> ```

Set the deployment name explicitly when the directory name is not the name you want:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
uv run mda deploy --name research-assistant
```

`mda deploy` creates a Serverless Agent Server by default. Use `--agent-server-type dedicated` when creating a Dedicated Agent Server. The legacy `--deployment-type` spelling remains accepted. If your CLI does not recognize the Agent Server flag, use the legacy spelling or upgrade.

Serverless is available in every LangSmith Cloud region. Self-hosted and hybrid environments reject Serverless deployments. Use `dedicated` for always-on capacity.

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
uv run mda deploy --agent-server-type dedicated
```

Use `--no-wait` to trigger the build without polling for completion:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
uv run mda deploy --no-wait
```

When `--no-wait` is set, schedule reconciliation is skipped for that deploy invocation because the CLI exits before the deployment reaches `DEPLOYED`.

On success, the CLI prints the LangSmith deployment dashboard URL. For the full deploy step list, see the [CLI reference](https://docs.langchain.com/langsmith/python/managed-deep-agents-cli.md#deploy-projects).

## Set the Python version

> [!NOTE]
>
> Configuring the Python version requires `managed-deepagents>=0.8.0`.

MDA builds the deployment image on Python 3.11, 3.12, 3.13, or 3.14, and by default selects the newest that `requires-python` allows. To pin a version, add the optional `[tool.mda]` table to `pyproject.toml`:

```toml pyproject.toml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
[project]
requires-python = ">=3.11"

[tool.mda]
python-version = "3.14"
```

When set, `python-version` takes a quoted `major.minor` string, with no patch version. MDA writes the resolved version to `python_version` in the generated `langgraph.json` and selects the matching [Agent Server](https://docs.langchain.com/langsmith/agent-server-overview.md) image. `requires-python` remains the project's own compatibility requirement.

Pin it to stay on the same minor version when MDA adds support for a newer Python. To override it for a single build, set `MDA_PYTHON_VERSION`:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
MDA_PYTHON_VERSION=3.12 uv run mda deploy
```

A target that `requires-python` excludes fails the build. One that depends on the image's exact patch version warns instead, because image tags do not pin patch versions.

`python-version` controls the deployment image only. Local builds, `mda dev`, Harbor task images, and [execution sandboxes](https://docs.langchain.com/langsmith/python/managed-deep-agents-sandboxes.md) select their interpreters separately.

## Secrets and environment files

`mda deploy` reads project `.env` values before shell environment variables. Use `.env` for the LangSmith API key that authenticates the deploy and for runtime secrets the hosted deployment needs:

```text .env theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
LANGSMITH_API_KEY=<LANGSMITH_API_KEY>
OPENAI_API_KEY=<OPENAI_API_KEY>
GITHUB_MCP_TOKEN=<GITHUB_MCP_TOKEN>
DATABASE_URL=<DATABASE_URL>
MDA_INGRESS_SECRET=<MDA_INGRESS_SECRET>
```

`MDA_INGRESS_SECRET` is required only when the project declares [backend identity](https://docs.langchain.com/langsmith/python/managed-deep-agents-identity.md#configure-identity-with-your-own-backend). Deploy fails preflight when that declaration is present and the value is missing.

`LANGSMITH_API_KEY`, `LANGGRAPH_HOST_API_KEY`, `LANGCHAIN_API_KEY`, and other platform variables are reserved. They can authenticate the deploy, but they are not uploaded as user-managed deployment secrets.

Non-reserved `.env` entries, such as model provider keys, MCP tokens, and custom tool credentials, are forwarded as hosted deployment secrets when `mda deploy` creates or updates the deployment. If the configured model requires a provider key, deploy fails before upload unless that key is available from `.env`, the shell environment, or LangSmith workspace secrets. When the provider key is only in the shell environment, `mda deploy` forwards it as a secret for that deploy.

Reserved platform variables, empty values, `.env`, and `.env.*` files are not copied into the compiled build archive.

For authentication key order and reserved variables, see the [CLI reference](https://docs.langchain.com/langsmith/python/managed-deep-agents-cli.md#authentication).

## Troubleshoot a deploy

For deploy troubleshooting, see the [CLI reference](https://docs.langchain.com/langsmith/python/managed-deep-agents-cli.md#troubleshooting).

If a deployment reaches `BUILD_FAILED` or `DEPLOY_FAILED`, open the printed deployment URL in LangSmith and inspect the revision logs.

## Next steps

> [card] [Agent Server](https://docs.langchain.com/langsmith/agent-server-overview.md)
>
> Explore the runtime that hosts the deployment.

> [card] [MCP endpoint](https://docs.langchain.com/langsmith/python/managed-deep-agents-mcp-endpoint.md)
>
> Expose the deployed agent as a tool to MCP clients.

> [card] [Identity](https://docs.langchain.com/langsmith/python/managed-deep-agents-identity.md)
>
> Authenticate callers and provide private threads.

> [card] [Schedules](https://docs.langchain.com/langsmith/python/managed-deep-agents-schedules.md)
>
> Run agents on managed cron schedules.

> [card] [Custom tools](https://docs.langchain.com/langsmith/python/managed-deep-agents-tools.md)
>
> Add authored LangChain tools to the agent definition.

> [card] [CLI reference](https://docs.langchain.com/langsmith/python/managed-deep-agents-cli.md)
>
> Look up every `mda` command and flag.

***

[Connect these docs](https://docs.langchain.com/use-these-docs.md) to your agent of choice via MCP for real-time answers.

[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/managed-deep-agents-deploy.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
