Managed Deep Agents is in public beta on LangSmith Cloud and Bring Your Own Cloud (BYOC). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.
tools/, import them into the agent entry, and pass them to the agent definition:
tools/ as well, so the tools/mcp.py file name is reserved for that declaration.
Add a tool
Use authored tools for business logic, private APIs, database access, and other code that belongs in your agent project.1
Define a tool module
tools/customer.py
2
Attach the tool to the agent
Import the tool into the project-root agent entry and pass it in the Your imports should work the same way they do in a normal local Python project.
tools list:agent.py
3
Add human-in-the-loop (Optional)
Pause the agent before sensitive tool calls so a person can approve, edit, or reject them.Set The
interrupt_on in the agent definition, and optionally set permissions to gate tool and filesystem access:agent.py
interrupt_on field applies the same interrupt behavior as LangChain’s human-in-the-loop middleware.For decision types (approve, edit, reject), conditional interrupts, and permission rules, see the Deep Agents Human-in-the-loop and Permissions guides.To resume a paused run, see Respond to an interrupt.To pause on a form your own tool posts in Slack instead, see Agent-owned interrupts.For a full project that pauses campaign changes for Slack approval, see the paid media agent template.Use secrets and context
A tool reads fixed configuration, such as a region or an endpoint URL, from an environment variable. Put local values in.env for mda dev. mda deploy forwards non-reserved .env values as hosted deployment secrets.
Credentials belong in a connection instead. A connection keeps the value in your LangSmith workspace rather than the project. It can also resolve a different credential for each caller. See Use tools that require authentication.
For per-run values such as request metadata or feature flags, see Access runtime context.
Deployment
mda dev and mda deploy copy project files into the compiled build, including modules under tools/. Tools are not synced to Context Hub; they ship with the agent code.
When to use tools
For more information, see Project structure.
Respond to an interrupt
When a run hits an interrupt, it pauses and waits for a human response before continuing.- During local development,
mda devruns the agent in LangSmith Studio, which surfaces the interrupt so you can inspect the pending tool call and resume the run. - On a deployed agent, resume the paused run through the LangGraph server API with a
Command(resume=...)payload. See Human-in-the-loop using server API.
Use tools that require authentication
If a tool requires an API key or an OAuth token, resolve it at runtime with a connection.connections.get(...) takes the connection slug and the credential owner, and returns the credential as a string.
The second argument selects the owner. Pass {"type": "agent"} for one credential that the whole deployment shares, such as a team search key. Pass {"type": "user"} for the calling person’s own credential, so the agent acts as them. For more information, see Choose a credential owner.
This tool resolves the caller’s own GitHub credential:
tools/get_github_user.py
credential_authorization_required interrupt. Slack and LangSmith Studio complete that interrupt for the caller.
Create the connection itself with mda connections create. For create modes, local development, and the authorization interrupt, see Manage connections.
Access runtime context
For per-run values such as request metadata or feature flags, use the normal LangChain runtime context patterns for tools. See how to access context from within your tools. For the caller, channel, and sandbox fields that Managed Deep Agents adds, see Runtime. To read or write files in the thread’s sandbox from a tool, useruntime.backend. See Read and write sandbox files from code.
Connect these docs to your agent of choice via MCP for real-time answers.

