Source: ai-research/claude-dev-blog-building-effective-agent-automations-2026-10-28.md
Author: Lance Martin and CJ Avilla (Anthropic) · URL: https://claude.dev/blog/building-effective-agent-automations/ · Published: October 8, 2026
Anthropic’s reference implementation for a scheduled background agent: a daily brief that reads Slack channels and GitHub pull requests every weekday morning, tracks what changed since the last run, and posts a short summary to Slack. It runs on Claude Managed Agents (beta), so nothing stays running on your machine. The value is less the brief itself than six rules for the failure modes every scheduled agent hits: gaps between runs, silent source failures, duplicate posts, and stale preferences.
Get the code
- Reference implementation:
anthropics/claude-quickstarts, foldermanaged-agents/daily-brief. - Guided setup in Claude Code:
/claude-api managed-agents-onboard https://claude.dev/blog/building-effective-agent-automations/. Theclaude-apiskill reads the post, proposes a setup, writes the files to anagents/folder and creates the resources withant apply. - You need a Slack app (created from the repo’s manifest, scopes
channels:historyandchat:write) and a GitHub token.
Files:
| File | What it holds |
|---|---|
agent.md | Model, tools, MCP servers and eight run steps |
deployment.md | Schedule, time zone, budget, vault IDs, memory stores, and the first message of each run |
environment.yaml | Network allowlist |
memory_store_preferences.yaml | Your preferences (read-only to the agent) |
memory_store_state.yaml | The agent’s bookmarks, ledger, notes and run records |
vault.yaml | The vault that holds credentials |
claude-lock.json | Resource IDs, written by ant apply |
ant apply <file> reads a file, creates the resource in your Claude API workspace and records its ID in claude-lock.json. Test without waiting for the schedule with ant beta:deployments run --deployment-id <id>.
The six components
- Sources — Slack channels and GitHub PRs, listed in the preferences file.
- Destination — one Slack channel, one dated post per run.
- Agent —
claude-sonnet-5-5with the agent toolset (web search and web fetch off) and the GitHub MCP server set toalways_allowwith a read-only token. - Schedule — cron
32 7 * * 1-5,America/New_York. - Memory — a read-only
preferencesstore and a read-writestatestore, mounted under/mnt/memory/. - Guardrails — read-only access wherever it only reads, plus a per-run budget.
Credentials stay outside the sandbox
- MCP (GitHub): tools are called through a proxy outside the sandbox that matches the vault credential to the server URL.
- Shell (Slack): the sandbox holds only the placeholder
$SLACK_BOT_TOKEN; the platform swaps in the real token as the request leaves, for allowed hosts only (allowed_hosts: ["slack.com"], injected as a header).
The six rules
- Read from a bookmark, not a fixed window. “The last 24 hours” leaves a gap after a late run and repeats items after an early one. The agent writes the newest timestamp per source to
bookmarks.jsonand starts the next run there. - A failed read is not a quiet day. A down MCP server or expired token means the run starts without those tools and reports “nothing new”. The rules: keep that source’s bookmark where it is, write the brief from the other sources, and end with one line naming what couldn’t be read.
- Re-check every item just before posting. Resolved since reading → drop it; changed → fix the line; can’t confirm → drop it and note it. “One stale ‘still waiting on you’ costs more trust than ten missing items.” Links are copied from the source’s own link field, never assembled by hand.
- Count a post as sent only when Slack confirms it. Check for today’s title first and skip if it’s already posted; treat it as sent only on
"ok": truewith a messagets; update the ledger and bookmarks only after that. If unclear, mark the run “maybe posted” and change nothing else. - Re-read preferences every run, from a store the agent can’t edit. A copy baked into the prompt keeps applying rules you’ve already changed. If the file can’t be read, stop and say so instead of running on defaults.
- Read-only wherever it only reads, and cap spend per run. Text other people wrote can act as instructions; limit what following them could do. Slack is the exception, since one token both reads and posts, so invite the bot only where it needs to be.
Two more fixes from the post:
- Keep a ledger (
ledger.md) of every reported item with a stable ID (Slack message timestamp, PR number) and last known status, so open items are carried as one line (“still waiting, day 3”) and closed ones dropped. - Compute dates in your own time zone. Set
timezonein the deployment and say the zone in the first message, or the agent calls this morning “yesterday”.
Budget
budget:
type: limit
max_list_cost:
amount: "500" # cents, so $5.00
currency: USDStart at three to five times the cost of a normal run and tighten it from real numbers. A run that hits the cap pauses with budget_reached instead of failing, so a cap set too low looks like a brief that went quiet.
Key Takeaways
- Scheduled agents fail quietly; most of the six rules exist to make a failure visible rather than look like “nothing new”.
- Bookmarks plus a ledger replace fixed time windows and stop both gaps and repeats.
- Treat the post as an unconfirmed write until the destination says it landed, and only then move state forward.
- Keep the agent’s instructions (preferences) in a read-only store and its working state in a separate read-write store.
- Set the budget from measured runs, at three to five times a normal run.
Try It
- Run the
/claude-api managed-agents-onboardcommand above against your own Slack and GitHub, then change the sources to the ones your team watches. - Apply rules 1, 2 and 4 to any existing cron or
/schedulejob, even one not on Managed Agents: add a bookmark file, a “couldn’t read” line, and a confirm-before-recording step - For a client-facing version, swap Slack for email or a CRM note and keep the same confirmation rule
Implementation
Tool/Service: Claude Managed Agents (beta), ant CLI, TypeScript SDK for vault credentials.
Setup: create the Slack app and GitHub token → ant apply vault.yaml and add credentials → seed preferences with scripts/seed-preferences.sh → ant apply deployment.md → test with a manual run.
Cost: Managed Agents usage at list rates, capped per run by the deployment budget; the post gives no per-run figure.
Integration notes: the GitHub MCP toolset must be always_allow because nobody is there to approve tool calls; keep its token read-only.
Related
- Claude Managed Agents — the platform, budgets, vaults and scheduled deployments.
- Agents That Remember — memory stores in depth.
- Managed Agents in Production — Lance Martin’s earlier production talk.
- Claude Code Routines — the Claude Code equivalent for scheduled work.
- Scheduled Tasks — desktop and cloud scheduled tasks.
- Agent Guardrails — approval gates and limits more broadly.
- Claude Duet — Anthropic’s consumer product built on the same morning-brief idea