Skip to main content
The mda CLI tests and deploys code-first Managed Deep Agents. It is included with the managed-deepagents npm and Python packages.
Managed Deep Agents is in private beta, available on LangSmith Cloud in the US region only. Join the waitlist to request access.
For the fastest end-to-end path, see the quickstart. For workflow guidance, see Custom tools, Custom middleware, Connect MCP tools, Schedules, and Deploy an agent.

Install

Install the package for the language you use to author your agent. Both packages expose the mda binary. For npm, install globally or run the binary with npm exec.
For Python, pip install --pre managed-deepagents installs the mda CLI. A Python project generated by mda init has its own pyproject.toml; run uv sync inside that project to install project dependencies before local development or deploy. The TypeScript package provides defineDeepAgent, defineMcpServers, and defineSandbox. The Python package provides define_deep_agent, define_sandbox, the managed_deepagents.connectors module, and the mda console script.

Authentication

mda deploy reads API keys in this order:
  1. LANGGRAPH_HOST_API_KEY
  2. LANGSMITH_API_KEY
  3. LANGCHAIN_API_KEY
The CLI reads those values from the project .env file first, then from the process environment. If no key is found in an interactive terminal, mda deploy prompts for a LangSmith API key and saves it to the project .env file.
.env
To deploy with an organization-scoped key, set LANGSMITH_TENANT_ID or pass --tenant-id to mda deploy. The LangSmith API key authenticates the deploy. The agent’s model provider also needs credentials at runtime. Set the provider key in .env, export it in your shell, or configure it as a LangSmith workspace secret. For example, openai:gpt-5.5 requires OPENAI_API_KEY. mda deploy forwards non-reserved .env entries, such as OPENAI_API_KEY, MCP tokens, and custom tool credentials, as hosted deployment secrets. Reserved platform variables, including LANGSMITH_API_KEY, LANGGRAPH_HOST_API_KEY, LANGCHAIN_API_KEY, and LANGSMITH_TENANT_ID, are used for CLI authentication and deploy routing but are not uploaded as user-managed deployment secrets.

Command overview

Initialize projects

Use mda init to create a new project directory:
The command detects the language from the current directory: The scaffold creates:

Develop locally

Use mda dev to compile a project and run the local LangGraph dev server:
mda dev compiles into .mda/build, then starts the language-specific LangGraph dev server from that directory: For Python projects, install uv before running mda dev. The CLI resolves the local LangGraph dev server automatically, so you do not need to install langgraph-cli[inmem] yourself. When a sandbox is configured, mda dev tries the configured provider. If provider credentials are unavailable or provider creation fails, it falls back to a local temp-directory sandbox and prints the chosen path. For local development, mda dev stages the project .env file into .mda/build/.env so LangGraph can load model provider keys and connector tokens.

Deploy projects

Use mda deploy to compile and deploy a project to LangSmith:
Deploy runs these steps:
  1. Validate the project directory and load the agent entry file.
  2. Resolve the LangSmith API key and optional tenant ID.
  3. Collect non-reserved .env values as hosted deployment secrets.
  4. Verify the model provider API key is available from .env, the shell environment, or LangSmith workspace secrets.
  5. Sync deploy-owned context to Context Hub.
  6. Compile the project into .mda/build and extract optional schedules/ declarations.
  7. Create or find a LangSmith hosted deployment by name.
  8. Archive the build, upload it, and trigger a remote build.
  9. Poll the revision until it reaches DEPLOYED unless --no-wait is set.
  10. Reconcile the managed LangSmith cron jobs for schedules unless --no-wait is set.
On success, the CLI prints the LangSmith deployment dashboard URL. For secrets routing and deploy tips, see Deploy an agent.

Project file reference

Managed Deep Agents projects use a code-first layout:
The only required file is the agent entry: agent.py, agent.ts, or agent.tsx. It must export a named agent definition created with define_deep_agent or defineDeepAgent. The tools/ and middleware/ folders are conventions, not special registries: Managed Deep Agents packages regular project files, so any local module the agent imports works. When present, the CLI treats the remaining files as the managed system prompt (instructions.md), MCP connectors (connectors/mcp.*), cron schedules (schedules/**), skills (skills/**), and sandbox configuration (sandbox/). Only a project-root agent.ts, agent.tsx, or agent.py is required. The CLI detects the first available entry in that order.

Agent entry

The agent entry must export a named agent definition created with define_deep_agent or defineDeepAgent. For a minimal example, see the quickstart. The definition accepts the Deep Agents createDeepAgent configuration surface except managed keys. Setting a managed key is an error.

Authored tools and middleware

Put project-owned tools and middleware in local modules such as tools/ and middleware/, import them from the agent entry, and pass them through the tools and middleware fields. The CLI copies those files into the compiled build without rewriting them. For examples, see Custom tools and Custom middleware.

Instructions

Put the system prompt in instructions.md next to the project-root agent entry file. mda dev embeds the prompt in the generated entry. mda deploy syncs the prompt to Context Hub and the deployed runtime reads it from there.

Skills

Put deploy-owned skills under skills/ next to the project-root agent entry file. Deploy syncs every UTF-8 file under skills/** into Context Hub and deletes stale deployed skills that no longer exist locally.

Memory

Managed memory lives in the same Context Hub repo as the deployed instructions and skills, at /memories/AGENTS.md. Deploy creates that file if memory is enabled and it does not exist. Deploy syncs instructions.md and skills/**, but does not overwrite local or existing Context Hub memories/** files.

Connectors

Declare remote MCP servers in connectors/mcp.ts or connectors/mcp.py. The module must export a named mcp declaration. Connectors support remote http and sse MCP servers. Stdio MCP servers are rejected. When connectors are present, mda injects @langchain/mcp-adapters or langchain-mcp-adapters into the compiled build and appends loaded MCP tools to authored tools. For examples, server options, and connector defaults, see Connect MCP tools.

Schedules

Declare managed cron schedules under schedules/. Each direct child schedule file must export a named schedule declaration from defineSchedule(...) or define_schedule(...). Deploy extracts schedule declarations from static literals, arrays, objects, and top-level literal constants. After the deployment reaches DEPLOYED, mda deploy replaces the existing managed LangSmith cron jobs with the current local schedule declarations. For examples and constraints, see Schedules.

Sandbox

To configure a managed sandbox, export sandbox from sandbox/index.ts for TypeScript or sandbox/__init__.py for Python. Sandboxes are scoped per thread. sandbox/setup.sh, when present, runs once when a new managed sandbox is provisioned for a thread. For configuration examples and lifecycle behavior, see Configure a sandbox.

Ignored paths

The project loader skips these directories:
It also skips .env and .env.* files when copying files into the compiled build. mda dev stages the root .env into .mda/build/.env for local development only; deploy still forwards non-reserved .env entries as hosted secrets instead of archiving the file.

Agent definition reference

define_deep_agent and defineDeepAgent accept the full Deep Agents create_deep_agent configuration surface except the managed keys. Set author-owned fields to configure behavior.

Author-set fields

Managed fields

The managed runtime owns backend, store, checkpointer, memory, skills, and the system prompt. Do not set those fields in the agent definition. For the full field list, see the agent definition reference.

Troubleshooting