> ## 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/javascript/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.md) deployment, including the Agent Server API and [MCP endpoint](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-mcp-endpoint.md).

> [!NOTE]
>
> Managed Deep Agents is in [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/javascript/managed-deep-agents-local-development.md). For command flags, the deploy step list, and troubleshooting, see the [CLI reference](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-cli.md). To deploy a finished open-source project instead, see the [design agent](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-design-agent.md) and [paid media agent](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-paid-media-agent.md) templates.

## Prerequisites

For CLI deployments, 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 `npm install` for TypeScript 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]
>
> [Tool Gateway](https://docs.langchain.com/langsmith/tool-gateway.md) tools, including built-in [web search](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-search.md), are available only in the regions Tool Gateway supports.

## 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 npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npx mda deploy
```

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

```bash bun theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
bunx 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 npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npx mda deploy --name research-assistant
```

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

```bash bun theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
bunx 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 npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npx mda deploy --agent-server-type dedicated
```

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

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

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

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

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

```bash bun theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
bunx 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/javascript/managed-deep-agents-cli.md#deploy-projects).

## Secrets and environment files

Shell variables win over the project `.env` for every setting `mda deploy` reads, such as `LANGSMITH_API_KEY` and `LANGSMITH_ENDPOINT`. 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/javascript/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. `LANGSMITH_API_KEY` authenticates the deploy. None of them are 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/javascript/managed-deep-agents-cli.md#authentication).

## Deploy from GitHub

Build and deploy your agent from a GitHub repository in LangSmith Cloud, with optional automatic rebuilds on branch pushes. Authorize the GitHub app for your repository first. See [Manage GitHub repository access](https://docs.langchain.com/langsmith/deploy-to-cloud.md#manage-github-repository-access).

To deploy from GitHub:

1. Push your [Managed Deep Agent project](https://docs.langchain.com/langsmith/javascript/managed-deep-agents-project-structure.md) to GitHub. Do not commit `.env` or `.mda/build/`.
2. In [LangSmith](https://smith.langchain.com?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=langsmith-managed-deep-agents-deploy), open **Agent Servers** and select **+ Agent Server**. Select your repository, name the deployment, and set a branch or tag.
3. Select **This is a Managed Deep Agent project** and set **Project directory** to the path containing `agent.py` or `agent.ts` (`.` for the repository root).
4. Choose **Serverless** or **Dedicated** for the [Agent Server type](https://docs.langchain.com/langsmith/cloud-platform-features.md#deployment-types), and optionally enable automatic updates on push.
5. Add model provider keys and other secrets under **Environment Variables**, then select **Submit**.

LangSmith compiles the project during the build, syncs `instructions.md` and `skills/` from the repository to Context Hub, and sets up declared schedules and channels.

## Troubleshoot a deploy

For deploy troubleshooting, see the [CLI reference](https://docs.langchain.com/langsmith/javascript/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.md)
>
> Explore the runtime that hosts the deployment.

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

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

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

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

> [card] [CLI reference](https://docs.langchain.com/langsmith/javascript/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).
