Skip to main content
Managed Deep Agents runs the same Deep Agents harness you already build against, so moving an existing agent is a repackaging job rather than a rewrite. Your tools, middleware, and subagents carry over as they are. The agent entry changes, and the system prompt, skills, and memory move into project files.
Managed Deep Agents is in public beta and available on LangSmith Cloud in the US region only.

Decide whether to move

Managed Deep Agents runs the same harness, so the agent itself behaves the same. Tools, middleware, and subagents work as they do today. Moving adds the layer around the agent: Slack and other chat surfaces, OAuth for end users, scheduled runs, a managed sandbox, and durable memory become declarations in a project file rather than services you build and operate. Move an agent when you want that layer without running it. Stay on Deep Agents when you need to own it. The harness is the same either way, so building on Deep Agents first and moving when the agent is ready for production is a normal path. See Going to production.

Understand what changes

create_deep_agent compiles an agent in your process, so it takes the backend, store, and checkpointer as parameters. define_deep_agent returns a definition instead, and the managed runtime compiles it. The definition is configuration rather than a runnable agent: the mda CLI consumes it on mda dev and mda deploy, and the runtime supplies the managed pieces at that point. For the full picture, see Relationship to Deep Agents.

Check what does not carry over

Most agents move without changes beyond the entry file. Four cases need a decision first:
  • Custom backends: A hand-written BackendProtocol implementation has no equivalent. The runtime owns the backend, and the managed sandbox is the only choice for giving the agent a filesystem and shell.
  • Your own store or checkpointer: Threads, runs, and persistence come from Agent Server. An agent that depends on a specific store implementation needs that logic moved into a tool or middleware.
  • Custom application code and routes: Managed Deep Agents hosts the agent, not an arbitrary web application. For custom routes, advanced authentication, or application code around the agent, use a LangSmith deployment instead.
  • Custom state schemas in Python: define_deep_agent does not accept state_schema, so an agent that extends DeepAgentState cannot move as is. The TypeScript defineDeepAgent does accept stateSchema.
If none of these apply, the agent logic transfers as written.

Convert a Deep Agents project into a Managed Deep Agents project.

Map the parameters

Most of the surface transfers to define_deep_agent unchanged, under the same names: model, tools, middleware, subagents, interrupt_on, response_format, context_schema, cache, and debug. Leave the tool and middleware modules where they already live and keep importing them from the agent entry. define_deep_agent adds one required parameter. Pass name a static string that starts with a letter and contains only letters, numbers, underscores, or hyphens. Managed Deep Agents uses it as the agent’s graph ID and the default deployment name. The rest move to a project file or become the runtime’s job: Deep Agents backends are pluggable, and the managed runtime supplies its own. A project that declares sandbox/ gets a managed sandbox for the agent filesystem and shell. A project without one gets thread-scoped agent state, alongside read-only Context Hub mounts for instructions, skills, and memory. There is no other choice of backend, so an agent that depends on a specific one stays on Deep Agents.

Move an agent

Convert the project in place. The existing layout, module structure, and dependencies stay as they are: mda build merges the dependencies it needs into the project manifest rather than replacing it. To install the mda CLI first, see the quickstart.
1

Add the SDK to the project

Pin the version to match the CLI, which mda --version reports.If the project builds with Hatchling, allow direct references in pyproject.toml:
pyproject.toml
mda build rewrites the managed-deepagents requirement into a path reference to the runtime it stages, and Hatchling rejects that by default. Without the setting, mda build still succeeds and mda dev fails while installing the project, with Dependency #N of field project.dependencies cannot be a direct reference. Projects scaffolded by mda init declare no build backend, so the setting only comes up when converting an existing project.Leave every dependency the project already declares in place. Tools and middleware keep importing what they always did.
2

Rewrite the agent entry

Convert the call site using the table above, in a file named agent.py at the project root:
agent.py (before)
agent.py (after)
The entry must export a variable named agent, and the definition call itself has to live in this file. A root entry that re-exports the definition from another module fails, and the error names name rather than the real problem.A src/ layout is otherwise fine. Keep the packages where they are and import them from the root entry.
3

Move the prompt, skills, and memory into files

Put the system prompt in instructions.md at the project root. Give each skill its own directory under skills/ with a SKILL.md.If the agent needs memory that persists across threads, declare it in a root file exporting a variable named memory:
memory.py
Durable memory is opt-in, and a project without the file mounts none. The scope is the only knob: "agent" mounts one tree that every caller of the deployment shares. To control what the agent keeps there, write a memory policy into instructions.md. See Guide what to remember.
define_memory mounts an empty memory tree. Content from the files the old memory parameter pointed at does not transfer, so move anything the agent still needs into instructions.md or a skill before deleting those files.
4

Declare a sandbox

An agent that passed a sandbox backend needs a managed sandbox declaration instead. Create the directory and declare it:
sandbox/__init__.py
Declaring a sandbox clears permissions. A filesystem permission rule disables the sandbox execute tool, so the runtime drops the rules rather than the shell. Restrict a sandboxed agent through the tools you give it instead.
To provision a snapshot, add sandbox/setup.sh. Skip this step for an agent that had no sandbox backend. See Sandboxes.
5

Declare identity

(Optional) To give each caller private threads and downstream credentials, add a root identity declaration:
identity.py
Without the file the deployment runs with no managed auth, which mda dev reports as Identity none. See Identity.
6

Set credentials and ignore the build output

Put the model and tool API keys in a .env file at the project root. A value exported in your shell is not read. For shared workspace secrets and OAuth, use connections instead.Add the build directory to .gitignore:
.gitignore
mda build copies the whole project root into .mda/build, and mda deploy uploads it. Anything sitting next to the agent entry ships with the agent, so move what the deployment does not need out of the project root.
7

Compile, then run

Compile without deploying:
Then start it locally:
mda build does not inspect the definition call, so it exits 0 even when a managed parameter is still there. A leftover parameter surfaces when the graph loads under mda dev.
See Local development.
8

Deploy

Upload the project and let LangSmith build and host it:
See Deploy.
Starting a new agent rather than moving one? Scaffold the whole project, including the identity, sandbox, .env, and .gitignore files above:
The install channel selects the authoring language: the npm package scaffolds TypeScript, and the PyPI package scaffolds Python. The command creates a new directory and does not run in place, so it suits a greenfield project rather than a migration. See the quickstart.

See also