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.
Install
Install the package for the language you use to author your agent. Both packages expose themda binary. For npm, install globally or run the binary with npm exec.
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, defineIdentity, defineMcpServers, defineSchedule, and defineSandbox. The Python package provides define_deep_agent, define_identity, define_schedule, define_sandbox, the managed_deepagents.connectors module, and the mda console script.
Authentication
mda deploy reads API keys in this order:
LANGGRAPH_HOST_API_KEYLANGSMITH_API_KEYLANGCHAIN_API_KEY
.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
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
Usemda init to create a new project directory:
The command detects the language from the current directory:
The scaffold creates:
Develop locally
Usemda 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
Usemda deploy to compile and deploy a project to LangSmith:
Deploy runs these steps:
- Validate the project directory and load the agent entry file.
- Resolve the LangSmith API key and optional tenant ID.
- Collect non-reserved
.envvalues as hosted deployment secrets. - Verify the model provider API key is available from
.env, the shell environment, or LangSmith workspace secrets. - Sync deploy-owned context to Context Hub.
- Compile the project into
.mda/buildand extract optionalschedules/declarations. - Create or find a LangSmith hosted deployment by name.
- Archive the build, upload it, and trigger a remote build.
- Poll the revision until it reaches
DEPLOYEDunless--no-waitis set. - Reconcile the managed LangSmith cron jobs for schedules unless
--no-waitis set.
Project file reference
Managed Deep Agents projects use a code-first layout: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), identity (identity.*), connectors (connectors/**), 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 namedagent 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 astools/ 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.
Identity
Optionally export a namedidentity declaration from a project-root identity.ts or identity.py created with defineIdentity / define_identity (or .preset(...)).
When present, mda generates the custom auth handler, injects it into the compiled app, and scopes threads, memory, and store access from the declaration. Projects without identity keep the previous compile output. For presets, ingress modes, guest tokens, and runtime.identity, see Identity.
Instructions
Put the system prompt ininstructions.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 underskills/ 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. The runtime remounts a scoped tree as/memories/user/ (hot /memories/user/AGENTS.md plus optional cold files) and optional org facts as /memories/org/ (read-only). Deploy seeds agent memory when needed and syncs instructions.md and skills/**, but does not overwrite existing Context Hub memories/** files. For hot/cold tiers, identity remounts, org memory, and disableMemory, see Memory.
Connectors
Declare connectors as modules directly underconnectors/. Discovery is name-agnostic: each file is a connector module (package __init__.py files are ignored).
- MCP:
connectors/mcp.tsorconnectors/mcp.pymust export a namedmcpdeclaration. Supports remotehttpandsseservers; stdio is rejected. When present,mdainjects@langchain/mcp-adaptersorlangchain-mcp-adaptersand appends loaded MCP tools to authored tools. - LangSmith:
connectors/langsmith.tsorconnectors/langsmith.pydeclares constrained LangSmith capabilities for untrusted callers. Requires identity. The browser never receivesLANGSMITH_API_KEY.
Schedules
Declare managed cron schedules underschedules/. 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, exportsandbox 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:.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 ownsbackend, 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
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

