explainx.ai0k
TrendingNewsPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

follow on google

Add explainx.ai as a preferred source

corporate training

support@explainx.ai

get started

Find your pathTake Free Evaluation

community

Join the community

learn

mind: share how you thinkpathways — start freeworkshopsbootcampscoursescompare Explainxcertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsmdx readeragentsllmsdesignsdictionarypeopleagi trackerfelony benchranks

company

aboutvisionmissionteaminstructorsteach on explainxpartnershipscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource libraryfor LLMsexplainx.ai kids

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportcontactprivacytermsdata rightshow we create contentsubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

explainx.ai

On this page

  • TL;DR
  • The minimal example
  • Project layout
  • Parameters
  • Cron cheat sheet
  • The rule that will trip you up: static declarations only
  • State across runs: ephemeral vs persistent threads
  • Deploying and testing
  • Reliability checklist for scheduled agents
  • Writing a good scheduled prompt
  • Common mistakes
  • Use cases that fit
  • What people are asking
  • Bottom line
  • Related reading
← Back to blog

explainx / blog

LangChain Managed Deep Agents Now Run on a Schedule: How define_schedule Works, With Rules and Pitfalls

LangChain, Deep Agents, LangSmith, Agent Scheduling, Agent Harness, How-To

Managed Deep Agents can run on cron with define_schedule. File layout, prompt vs input, persistent threads, deploy rules and what mda dev will not run.

Sep 24, 2026·7 min read·Yash Thakker
add explainx.ai
go deep
LangChain Managed Deep Agents Now Run on a Schedule: How define_schedule Works, With Rules and Pitfalls

Agents are more useful when they do not wait for you to type. LangChain's Managed Deep Agents now supports background scheduling: declare a cron expression in a file, deploy, and your agent runs on a schedule inside LangSmith.

This guide walks through the documented format, the strict rules that trip people up, how state works across runs, and a reliability checklist. It builds on our earlier coverage of LangChain Deep Agents 0.7 and how teams score production agent traces with LangSmith.

Weekly digest3.5k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.

TL;DR

table · 2 cols
QuestionAnswer
What is new?Cron-style schedules for Managed Deep Agents
Where are they defined?schedules/ directory, one file per schedule
Schedule name?The filename
Function?define_schedule from managed_deepagents
Cron format?Standard five-field cron; no seconds
Timezone?Optional; defaults to UTC
Payload?Exactly one of prompt or input
State?Ephemeral thread by default; persistent thread optional
Deploy?mda deploy; schedules are provisioned as LangSmith crons
Test?Schedules do not run under mda dev
AvailabilityPublic beta; LangSmith Cloud, US region only

The minimal example

From LangChain's documentation:

python
from managed_deepagents import define_schedule

schedule = define_schedule(
    cron="0 8 * * 1-5",
    timezone="America/Los_Angeles",
    prompt="Write the daily digest.",
)

Save it as, for example, schedules/daily_digest.py. The file name becomes the managed schedule name. This schedule fires at 08:00, Monday through Friday, Pacific time, and sends "Write the daily digest." to the agent as a user message.

Project layout

text
my-agent/
  agent.py              # your Deep Agent definition
  schedules/
    daily_digest.py     # one schedule per file
    weekly_review.py

One schedule per file keeps changes reviewable: a pull request that adds weekly_review.py is a pull request that adds a job. Removing a file and redeploying removes the corresponding managed cron, according to the docs.

Parameters

table · 3 cols
ParameterRequiredMeaning
cronYesFive-field cron: minute, hour, day of month, month, day of week
timezoneNoIANA timezone name; defaults to UTC
promptOne of prompt or inputText sent as a user message
inputOne of prompt or inputStructured LangGraph input data
threadNoEphemeral by default; {"mode": "persistent", "id": "<thread-uuid>"} for durable state
deliver_toNoRoutes results to Slack via channel ID

Use prompt for natural-language jobs and input when your agent expects structured fields. Never provide both.

Cron cheat sheet

Standard five-field cron. Seconds-based syntax is invalid.

table · 2 cols
ExpressionMeaning
0 8 * * 1-508:00 every weekday
*/15 * * * *Every 15 minutes
0 9 * * 109:00 every Monday
30 6 1 * *06:30 on the first day of each month
0 0 * * 0Midnight every Sunday

Set timezone explicitly for anything human-facing. UTC by default means "8 AM" may arrive at a different local hour, and daylight saving changes can surprise you when you leave timezone unspecified.

The rule that will trip you up: static declarations only

The docs are strict: "Use literals, lists, dictionaries, and references to top-level literal constants. Do not read environment variables, call functions, use **kwargs, or compute schedule values dynamically."

That means the platform reads your schedule file without executing arbitrary code, which makes deployment predictable and safe, but also means you cannot do this:

python
# Not allowed: computed value and environment lookup
import os
schedule = define_schedule(
    cron=os.environ["DIGEST_CRON"],
    prompt=build_prompt(),
)

Instead:

python
# Allowed: literals and top-level literal constants
DIGEST_PROMPT = "Write the daily digest."

schedule = define_schedule(
    cron="0 8 * * 1-5",
    timezone="America/Los_Angeles",
    prompt=DIGEST_PROMPT,
)

If you need dynamic behavior, put it inside the agent: let the agent read configuration or fetch data at run time, and keep the schedule file as a fixed trigger.

State across runs: ephemeral vs persistent threads

By default each scheduled run uses an ephemeral thread: it starts fresh, does its work and leaves no conversational memory for the next run. That is right for stateless jobs like "summarize yesterday's tickets."

For jobs that should remember, such as a weekly report that compares against last week, use a persistent thread:

python
schedule = define_schedule(
    cron="0 9 * * 1",
    timezone="America/New_York",
    prompt="Prepare the weekly review and compare with last week.",
    thread={"mode": "persistent", "id": "<thread-uuid>"},
)

Two cautions from the docs. The persistent thread must be created manually in LangSmith Studio before you deploy. And a thread that grows forever will grow context; plan for summarization or periodic rotation, as we discuss in harness engineering concepts.

Deploying and testing

Deploy with mda deploy. When you add, change or remove schedules, run it without --no-wait so the CLI can reconcile schedules once the deployment reaches DEPLOYED status. The CLI provisions each schedule as a LangSmith cron after the deployment is live.

Test carefully: schedules never execute under mda dev. To check behavior:

  1. Invoke the agent directly in LangSmith Studio with the same prompt or input.
  2. Deploy to a non-production environment and set a near-term cron, such as a few minutes ahead.
  3. Confirm the run appears in traces, the output is correct and any delivery (such as Slack) works.

Because scheduled runs are unattended, trace review matters more than usual. Pair schedules with production trace scoring and the evaluation tooling in LangChain's Jev agent evals benchmark.

Reliability checklist for scheduled agents

Design

  • Make jobs idempotent. If a run happens twice or is retried, the result should not duplicate emails or tickets.
  • Give each job a narrow purpose. One schedule, one outcome.
  • Write an explicit finish line in the prompt: what artifact must exist when done.
  • Add a stop rule: if data is missing, report and stop instead of improvising.

Safety

  • Use least-privilege tools. A scheduled agent should not hold credentials it does not need.
  • Keep write actions behind approval when stakes are high. Unattended does not mean unsupervised.
  • Treat inputs as untrusted. If the job reads email or web content, prompt injection is possible; see indirect prompt injection.

Operations

  • Alert on failures and empty outputs.
  • Set budgets. A misconfigured */1 cron with a large model is an expensive mistake. Check spending after the first week.
  • Log schedule changes in code review. They are production changes.
  • Watch beta limits. Public beta and US-only availability may affect data residency requirements.

Writing a good scheduled prompt

Unattended prompts fail in different ways from interactive ones, so write them like a runbook.

text
Role: You prepare the weekday engineering digest.
Inputs: Use your connected tools to read tickets closed since the last business day.
Output: A digest with three sections (Shipped, Blocked, Needs decision), each item one line with a link.
Rules: If a tool call fails twice, stop and report which source failed. Never invent items.
Finish line: The digest is written and, if delivery is configured, posted once.

Four habits make this work. State the inputs the agent may use. Define the output shape so downstream readers can rely on it. Add failure rules so an outage produces a clear report instead of a confident guess. Give a finish line so the run ends.

Common mistakes

  • Testing with mda dev and concluding it is broken. Schedules never run there.
  • Forgetting the timezone. A 08:00 UTC job arrives at 01:00 in Los Angeles.
  • Using */1 in production. Every minute is rarely what you meant.
  • Dynamic values in the schedule file. Computed or environment-based values are not allowed.
  • Persistent thread not created. The thread must exist in LangSmith Studio before deployment.
  • Deploying with --no-wait after schedule changes. The CLI needs to reconcile once the deployment reaches DEPLOYED.
  • No owner. Every schedule should have a named owner who reads the alerts.

Use cases that fit

  • Daily digest of support tickets, PRs or metrics.
  • Weekly review that compares against previous state on a persistent thread.
  • Monitoring agents that check dashboards and report anomalies.
  • Data hygiene jobs like deduplicating records.
  • Research briefs that collect new papers or news in a topic.

For non-LangChain equivalents, see how Claude Code loops and Cursor loops handle recurring work, how goal mode gives agents completion conditions, and how Cursor's event-driven cloud agents wake on signals instead of clocks. Schedules are the simplest trigger: time. Events are the smartest: something happened.

What people are asking

"Can I schedule more than one job?" Yes. One file per schedule, each with its own name.

"Can the schedule use my secrets?" Not in the schedule file. Keep secrets in the agent's configured environment and tools.

"Is this GA?" No. It is public beta, on LangSmith Cloud in the US region only.

"How do I stop a job?" Delete its file and redeploy without --no-wait.

Bottom line

Scheduling turns a Deep Agent from something you talk to into something that works while you sleep. The format is simple and strict: one file per schedule, static declarations, five-field cron, deploy to activate. Test outside mda dev, design for idempotence, and review traces early.

Details reflect LangChain's documentation as of September 24, 2026. Managed Deep Agents is in public beta and syntax may change.

Related reading

  • LangChain Deep Agents 0.7: a leaner harness
  • LangSmith Jev: score production agent traces
  • LangChain Jev agent evals benchmark
  • How to run loops in Claude Code
  • Goal mode for AI agents: complete guide
  • Cursor event-driven cloud agents
  • Top 10 harness engineering concepts
  • Official: Add schedules to Managed Deep Agents
Spotted something out of date? Let us know.
Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

View Yash Thakker in People in AI →

Related posts

Sep 20, 2026

Jev vs LLM-as-Judge: LangChain Benchmarks Agent Evaluation

LangChain ran the same Deep Agents weather-tool traces through four judges — TypeSafe AI's Jev, GPT-5.6 Luna, GPT-5.6 Terra, and Claude Sonnet 4.6 — and measured accuracy against a human oracle, per-case variance, cost, and latency. Jev matched the human oracle on all 500 repeated decisions at roughly 1/80,000th the cost of Claude.

Aug 26, 2026

LangSmith Engine: 2× Better Agent Issue Detection (Aug 2026)

LangChain's Aug 25, 2026 LangSmith Engine release doubles internal IssueBench performance for grouping production agent failures and improves suggested prompt/code fixes by 25% on public evals. explainx.ai covers who gets it, how it pairs with SmithDB's faster traces, and when Engine beats manual trace archaeology for LangGraph teams.

Aug 20, 2026

How to Run Loops in Codex CLI (There Is No /loop)

Claude Code's /loop is the command people keep typing into Codex. It does not exist. This guide maps the real Codex primitives: /goal for a durable, checkable objective, Codex app Automations for a schedule, and a shell loop around codex exec when you want recurrence in CI.