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

# Add memory and a schedule to your research assistant

> Add durable memory and a daily schedule to the research assistant from the quickstart, then deploy it.

This tutorial continues from the [quickstart](/langsmith/javascript/managed-deep-agents-quickstart). Use the `research-assistant` project you created there, with your model, instructions, search tool, and a working `mda dev` setup.

`mda init` may also scaffold files such as `identity` and `sandbox/`. Leave those as they are; this tutorial does not change them.

This guide shows you how to you enable durable memory and a daily schedule, then deploy. Optionally, you can also add a custom tool.

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

## Extend the agent

<Steps>
  <Step title="Update the instructions for memory" id="instructions">
    Extend `instructions.md` so the agent knows what shared knowledge to keep. Keep the research behavior from the quickstart and add a memory policy:

    ```markdown instructions.md theme={null}
    # Research assistant

    You are a careful research assistant. Use internet search to find sources,
    keep notes, and return concise answers with citations.

    ## Memory

    - Record reusable research procedures and project knowledge that can improve future work.
    - For release research, check the project's official changelog before secondary sources.
    - Never store personal data or secrets in memory.
    ```
  </Step>

  <Step title="Enable and use durable memory" id="memory">
    Durable memory is opt-in. Before asking the agent to remember anything, add a memory declaration at the project root:

    ```ts memory.ts theme={null}
    import { defineMemory } from "managed-deepagents";

    export const memory = defineMemory({ scope: "agent" });
    ```

    Memory is shared across the deployment and visible to all callers, so do not store personal data or secrets.

    Restart `mda dev` so it discovers the new file. In one thread, ask the agent to research a release and to record a reusable project rule, such as "For release research, check the official changelog before secondary sources." Then create a **new thread** in Studio and ask how it will research the next release. Confirm that it applies the shared rule even though the new thread has no conversation history.

    See [Memory](/langsmith/javascript/managed-deep-agents-memory) for details.
  </Step>

  <Step title="(Optional) Add a custom tool" id="add-tool">
    Provider search covers the open web. Authored tools cover your application logic: private APIs, databases, and internal data. Create a module under `tools/`, import it into the agent entry, and add it to the `tools` list next to your existing search tool.

    This example returns a placeholder project record so it runs without an external API. Replace the body with a call to your system.

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

    export const lookupTrackedProject = tool(
      async ({ project }) => {
        // Replace this stub with a call to your project catalog or database.
        return (
          `Project '${project}': status=active, owners=docs, ` +
          `changelog=https://example.com/${project}/changelog`
        );
      },
      {
        name: "lookup_tracked_project",
        description: "Look up an internally tracked project by name.",
        schema: z.object({
          project: z.string().describe("Project or product name to look up."),
        }),
      },
    );
    ```

    Append the custom tool next to your existing search tool, keep your quickstart `model`, and choose the tab that matches your search setup:

    <Tabs>
      <Tab title="Provider search">
        Open `agent.ts`:

        <CodeGroup>
          ```ts OpenAI theme={null}
          import { defineDeepAgent } from "managed-deepagents";

          import { lookupTrackedProject } from "./tools/projects";

          export const agent = defineDeepAgent({
            name: "research-assistant",
            model: "openai:gpt-5.5",
            tools: [{ type: "web_search_preview" }, lookupTrackedProject],
          });
          ```

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

          import { lookupTrackedProject } from "./tools/projects";

          export const agent = defineDeepAgent({
            name: "research-assistant",
            model: "google-genai:gemini-3.6-flash",
            tools: [{ google_search: {} }, lookupTrackedProject],
          });
          ```

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

          import { lookupTrackedProject } from "./tools/projects";

          export const agent = defineDeepAgent({
            name: "research-assistant",
            model: "anthropic:claude-sonnet-4-6",
            tools: [
              { type: "web_search_20250305", name: "web_search" },
              lookupTrackedProject,
            ],
          });
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Tavily">
        Open `agent.ts`. Keep your quickstart `model` value:

        <CodeGroup>
          ```ts theme={null}
          import { defineDeepAgent } from "managed-deepagents";

          import { lookupTrackedProject } from "./tools/projects";
          import { internetSearch } from "./tools/search";

          export const agent = defineDeepAgent({
            name: "research-assistant",
            model: "provider:model",
            tools: [internetSearch, lookupTrackedProject],
          });
          ```
        </CodeGroup>
      </Tab>
    </Tabs>

    Restart `mda dev` if it is already running. In Studio, ask for the status of a tracked project and confirm the agent calls `lookup_tracked_project`.
  </Step>

  <Step title="Schedule a daily digest" id="schedule">
    Add a `schedules/` module so the agent runs on a cron cadence without a user message. This schedule runs every weekday at 8am Pacific:

    ```ts schedules/daily-digest.ts theme={null}
    import { defineSchedule } from "managed-deepagents";

    export const schedule = defineSchedule({
      cron: "0 8 * * 1-5",
      timezone: "America/Los_Angeles",
      prompt:
        "Review durable memory for reusable research rules. " +
        "Summarize anything useful, then list open questions for today.",
    });
    ```

    If memory is empty on the first fire, the agent still returns open questions.

    `mda deploy` reconciles this schedule into a LangSmith cron job after the deployment is live. After you deploy in the next step, you should see:

    * `mda deploy` finish without schedule errors (do not pass `--no-wait`, or schedules are not reconciled).
    * A managed cron for this file on the deployment. The schedule name matches the module stem: `daily_digest` (Python) or `daily-digest` (TypeScript).
    * No immediate digest run from this cron. The first fire waits until 8:00 America/Los\_Angeles on a weekday.

    For thread behavior and constraints, see [Schedules](/langsmith/javascript/managed-deep-agents-schedules).
  </Step>

  <Step title="Deploy and inspect" id="deploy">
    Deploy the project to LangSmith:

    ```bash theme={null}
    mda deploy .
    ```

    On success, the CLI prints the deployment dashboard URL. The deploy syncs the instructions to Context Hub, uploads the compiled project, and reconciles the daily schedule.

    Open that URL and confirm:

    * The deployment is ready.
    * The `daily_digest` or `daily-digest` cron exists.
    * A test chat run shows model calls, search or custom tool calls, and memory reads or writes in the traces.

    For deploy flags and troubleshooting, see [Deploy an agent](/langsmith/javascript/managed-deep-agents-deploy) and the [CLI reference](/langsmith/javascript/managed-deep-agents-cli#deploy-projects).
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Custom middleware" icon="code" href="/langsmith/javascript/managed-deep-agents-middleware">
    Add logging, retries, limits, and guardrails around model and tool calls.
  </Card>

  <Card title="Identity" icon="fingerprint" href="/langsmith/javascript/managed-deep-agents-identity">
    Authenticate callers and use verified identity in tools and middleware.
  </Card>

  <Card title="Evals" icon="flask" href="/langsmith/javascript/managed-deep-agents-evals">
    Author Harbor tasks and compile the managed agent for Harbor.
  </Card>
</CardGroup>

***

<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-tutorial.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
