> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-harris-1786029617-6b0a55e.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add custom tools to Managed Deep Agents

> Define authored tools for Managed Deep Agents projects.

Managed Deep Agents support the normal Deep Agents `tools` configuration surface. Define LangChain tools in your project, import them into `agent.py` or `agent.ts`, and pass them to `define_deep_agent` or `defineDeepAgent`.

<Note>
  Managed Deep Agents is in **public [beta](/langsmith/release-stages)** and available on [LangSmith Cloud](/langsmith/cloud) in the US region only.
</Note>

## Add authored tools

Use authored tools for business logic, private APIs, database access, and other code that belongs in your agent project. Managed Deep Agents copies the source into the compiled build and passes the tools to Deep Agents.

For more about LangChain tool definitions, see [Tools](/oss/python/langchain/tools).

## Add a tool module

Put custom tool code under `tools/` in your project and import it from the agent entry. For the full project layout, see [Project structure](/langsmith/managed-deep-agents-project-structure).

<CodeGroup>
  ```python tools/customer.py theme={null}
  from langchain.tools import tool


  @tool(parse_docstring=True)
  def lookup_customer(customer_id: str) -> str:
      """Look up a customer record by ID.

      Args:
          customer_id: Customer ID from the CRM.
      """
      return f"Customer {customer_id} is on the enterprise plan."
  ```

  ```ts tools/customer.ts theme={null}
  import { tool } from "langchain";
  import { z } from "zod";

  export const lookupCustomer = tool(
    async ({ customerId }) => `Customer ${customerId} is on the enterprise plan.`,
    {
      name: "lookup_customer",
      description: "Look up a customer record by ID.",
      schema: z.object({
        customerId: z.string().describe("Customer ID from the CRM."),
      }),
    },
  );
  ```
</CodeGroup>

## Attach tools to the agent

Import the tools into the project-root agent entry and pass them in the `tools` list.

<CodeGroup>
  ```python agent.py theme={null}
  from managed_deepagents import define_deep_agent

  from tools.customer import lookup_customer

  agent = define_deep_agent(
      name="support-agent",
      model="openai:gpt-5.5",
      tools=[lookup_customer],
  )
  ```

  ```ts agent.ts theme={null}
  import { defineDeepAgent } from "managed-deepagents";

  import { lookupCustomer } from "./tools/customer";

  export const agent = defineDeepAgent({
    name: "support-agent",
    model: "openai:gpt-5.5",
    tools: [lookupCustomer],
  });
  ```
</CodeGroup>

`mda dev` and `mda deploy` copy the project files into the compiled build. Your imports should work the same way they do in a normal local Python or TypeScript project.

Use clear, unique tool names to avoid collisions.

## Use secrets and context

Tools can read deployment secrets from environment variables. Put local values in `.env` for `mda dev`; `mda deploy` forwards non-reserved `.env` values as hosted deployment secrets.

When the project declares [identity](/langsmith/managed-deep-agents-identity), tools and middleware receive a frozen `runtime.identity` envelope for the authenticated caller. Prefer that over client-supplied configurable keys for user ids.

For other 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](/oss/python/langchain/tools#access-context).

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/managed-deep-agents-tools.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
