Key Takeaways
- Claude Managed Agents is Anthropic's new cloud-hosted service where your AI agent runs 24/7 on their infrastructure. Your laptop stays off. The agent stays on. It launched in public beta in April 2026.
- The key difference from Scheduled Tasks: managed agents can take actions with scoped permissions — pause ads, scale budgets, refresh audiences, rebalance spend — not just report on what is happening.
- This guide covers building a 7-capability Meta Ads operations agent: real-time bleed detection, winning ad auto-scaling, frequency management, budget rebalancing, placement pruning, CPM anomaly response, and morning ops briefings.
- Total cost: approximately $77-107/month (Anthropic API tokens + $0.08/session-hour runtime + free Meta API + free Slack). Compare to $3,000-10,000/month for a media buying agency.
- This is a technical build that requires some developer skill or assistance. The guide provides complete code, rules, thresholds, and permission scopes. Use Claude Code to help with setup if you are not a developer.
Introduction
Claude just launched Managed Agents — a cloud-hosted service where your AI agent runs 24/7 on Anthropic's infrastructure. Your laptop stays off. The agent stays on.
The key difference from Scheduled Tasks: a managed agent can take actions with scoped permissions. Not just alert you. Actually pause ads. Scale budgets. Refresh audiences. Rebalance spend. All within rules you define.
Scheduled Tasks read and report. Managed Agents read, decide, and act. This is the first AI employee most Meta advertisers will hire. It just happens to cost around $100/month instead of $5,000.
This guide walks you through building a complete Meta Ads operations agent with 7 autonomous capabilities, from real-time spend bleed detection to morning ops briefings.
What Are Claude Managed Agents?
Claude Managed Agents is Anthropic's fully managed cloud service for running AI agents. You define an agent once — its model, instructions, tools, and permissions — and it runs continuously on Anthropic's servers. No laptop required. No server to maintain.
Four core concepts:
Agent: The configuration — which Claude model to use, the system prompt containing your rules and thresholds, which tools the agent has access to, and what MCP servers it connects to.
Environment: A cloud container where the agent executes code. Think of it as a virtual computer in the cloud. You configure what packages are installed and what network access it has.
Session: A running instance of your agent doing work. Each session has its own conversation history and can run for minutes to hours. Sessions persist across container restarts.
Events: The communication layer. Your agent sends events (messages, tool calls, status updates) and receives events (user instructions, new data). Everything streams in real-time.
Cost: Standard Claude API token pricing plus $0.08 per session-hour of active runtime. Idle time does not count. An always-on agent running 24/7 at roughly 50% active time costs approximately $57/month in infrastructure, plus token usage. Official documentation is at platform.claude.com/docs/en/managed-agents/overview.
What Does This Agent Do?
Seven autonomous capabilities running around the clock:
- Real-Time Bleed Detection + Auto-Pause: Polls your account every 15 minutes. If an ad set spends above your threshold with zero conversions in 24 hours, it pauses it automatically. You wake up to a report, not a disaster.
- Winning Ad Auto-Scaler: When an ad hits your target ROAS for 3 consecutive days, the agent increases its budget by 20%. If ROAS drops back, it rolls the scale back. Always within your pre-defined daily spend cap.
- Frequency Cap Refresher: Watches prospecting ad sets. When frequency exceeds 3, it refreshes the audience by excluding recent converters and rebuilding lookalikes with new seeds.
- Budget Rebalancer: Every 6 hours, checks pacing across all campaigns. Shifts budget from underperformers to winners. Never exceeds your total daily cap.
- Placement Auto-Pruning: Meta distributes roughly 20% of spend on underperforming placements by default. The agent identifies placements with less than 0.5x your target ROAS and pauses them.
- CPM Anomaly Response: If CPM spikes 50%+ versus the 7-day average, the agent pauses affected ad sets, runs a diagnosis, and sends a Slack notification with the cause.
- Morning Ops Briefing: At 7 AM daily, compiles what it did overnight, what it flagged but did not touch, and today's top 3 priorities.
What Do You Need Before Starting?
Required accounts:
- Anthropic API account: Sign up at console.anthropic.com. You need API access, not just a Claude Pro subscription. Fund your account with credits ($20-50 for testing).
- Meta Business Manager: With admin access to the ad accounts you want the agent to manage. Set up at business.facebook.com.
- Meta Developer App: You need a Meta app with Marketing API access to give your agent programmatic control over your ads.
Required tools:
- Python 3.10+ (download from python.org or install via Homebrew on Mac)
- Anthropic CLI: Install on Mac with brew install anthropics/tap/ant
- Anthropic Python SDK: Install with pip install anthropic
Optional but recommended: Slack workspace for notifications (free at slack.com), VS Code for editing config files, and Claude Code for interactive setup help (install with npm install -g @anthropic-ai/claude-code).
How Do You Set Up the Meta Developer App?
Your agent needs API access to read ad data and make changes. Meta provides this through their Marketing API.
Go to developers.facebook.com, log in, click My Apps, then Create App. Select Business as the type, name it (e.g., Claude Ads Agent), and connect it to your Business Manager. Once created, go to App Settings and note your App ID and App Secret. Add the Marketing API product, then go to Graph API Explorer to generate an access token with ads_management, ads_read, and business_management permissions.
Important: The initial token expires in about 1 hour. For production, set up a System User in Business Manager at business.facebook.com > Business Settings > Users > System Users. Create an Admin-role System User and generate a token with ads_management and ads_read permissions. System User tokens do not expire.
Find your Ad Account ID by opening Meta Ads Manager and looking at the URL — it contains act_ followed by numbers.
How Do You Create the Agent?
The agent creation involves three Python scripts: one to create the agent with your rules, one to create the cloud environment, and one to start the session.
First, install the SDK and set your API key: pip install anthropic, then export ANTHROPIC_API_KEY=your-key-here (find it at console.anthropic.com > API Keys).
The agent script uses client.beta.agents.create() with your model choice (claude-sonnet-4-6 recommended), a detailed system prompt containing all your rules and thresholds, and the agent_toolset_20260401 which gives it bash, file operations, web search, and code execution.
The system prompt is the brain of your agent. It contains: bleed detection rules (pause thresholds, timing), auto-scaling rules (ROAS targets, max increase percentages, daily caps), frequency management rules, budget rebalancing parameters, placement pruning criteria, CPM anomaly thresholds, morning briefing schedule, permission boundaries (what it can and cannot do), and notification rules.
The environment script creates a cloud container with unrestricted networking and installs the requests library for API calls. The session script starts the agent with your Meta credentials and initial instructions.
Permission boundaries are critical. The agent CAN: pause ads, adjust budgets within caps, modify audiences, read all data. It CANNOT: create new campaigns, delete anything, change ad creative, modify billing, or exceed any daily budget cap. When uncertain, it flags for human review instead of acting.
The full code for all three scripts is available in the detailed guide. Complete API documentation is at platform.claude.com/docs/en/managed-agents/quickstart.
How Do You Define Your Thresholds?
The thresholds in the system prompt need to match your account. Here are starting points by account size.
Bleed detection: Under $1K/month spend, pause after $10 spent with 0 conversions in 24h. $1K-5K/month, use $20. $5K-20K/month, use $50. Over $20K/month, use $100.
ROAS targets vary by business type. E-commerce with low margins: scale up above 3.0 ROAS, roll back below 2.0, prune below 1.5. E-commerce with high margins: scale above 2.0, roll back below 1.5, prune below 1.0. Lead gen: scale above 1.5, roll back below 1.0, prune below 0.5.
Budget caps: set a hard daily cap the agent can never exceed, a maximum single adjustment of 20% per day, and a minimum ad set budget of $10/day (below this there is not enough data for meaningful optimization).
How Do You Test Before Going Live?
Do not deploy the full agent on a live account without testing. Use a three-phase approach.
Phase 1 — Read-Only Testing (Week 1): Add a testing mode flag to the system prompt that makes the agent analyze everything and recommend actions but not execute any changes. Run for a full week and review its recommendations daily. Check accuracy of bleed detection flags, scaling recommendations, and budget rebalancing suggestions.
Phase 2 — Single Capability (Week 2): Enable one capability at a time. Start with bleed detection (the safest — it only pauses things clearly wasting money). Monitor closely for the first 48 hours.
Phase 3 — Full Deployment (Week 3+): Once you trust bleed detection, enable auto-scaling. Then budget rebalancing. Then frequency management. One capability per 3-4 days until fully live.
What Does the Morning Briefing Look Like?
The morning briefing is the most important output. At 7 AM daily, the agent sends a Slack message with three sections: Overnight Actions Taken (every pause, scale, and rebalance with reasons), Flagged for Your Review (items that crossed warning thresholds but not action thresholds), and Today's Priorities (the top 3 things you should check manually).
It also includes an account summary: yesterday's spend, ROAS, conversions, CPA, and 7-day trends for each metric. This gives you a complete picture of your account's health and the agent's overnight activity in one message you can read with your morning coffee.
When Should You Use Managed Agents vs Scheduled Tasks?
Both are useful. They serve different purposes.
Use Scheduled Tasks when you want reports and alerts (read-only monitoring), a simple setup with no code and plain English prompts, you are comfortable being the one who takes action, and your budget is $20/month (Claude Pro only).
Use Managed Agents when you want the agent to take actions autonomously (pause, scale, rebalance), you need 24/7 monitoring with sub-hour response times, you want actions logged and reviewable, and you have technical skill or help to set it up. Budget: approximately $77-107/month.
The practical combination: run both. Use Scheduled Tasks for daily briefings and weekly reports (easy to set up, reliable). Use a Managed Agent for real-time response capabilities that require speed — bleed detection, CPM anomaly response, and auto-scaling.
What Does This Cost?
Anthropic API credits (token usage): approximately $20-50/month depending on volume. Session runtime at $0.08/hour with roughly 50% active time: approximately $57/month for always-on. Meta Marketing API: free. Slack for notifications: free. Total: approximately $77-107/month.
Compare that to a media buying agency at $3,000-10,000/month or a full-time media buyer at $5,000-8,000/month. The agent pays for itself the first time it catches a bleeding ad set at 2 AM that would have run until your Friday audit.
Frequently Asked Questions
Can the agent accidentally spend all my money?
No, if you set up the permission boundaries correctly. The agent has hard caps: it cannot exceed your daily budget cap, cannot increase any ad set budget by more than 20% per day, and cannot create new campaigns. Meta's own campaign budget limits still apply as an additional safety net.
Does my computer need to be on?
No. Managed Agents run on Anthropic's cloud infrastructure 24/7. Your computer can be off, asleep, or disconnected.
Is my Meta data safe?
Your Meta access token is used only within the agent's sandboxed environment. Anthropic's architecture stores credentials outside the sandbox to prevent prompt injection attacks. Review their security documentation at platform.claude.com/docs/en/managed-agents/overview.
Can I use this for Google Ads too?
Yes. The same architecture works with any API. Connect the Google Ads API instead of or alongside the Meta Marketing API. The rules, thresholds, and logic work the same way.
Do I need to be a developer?
This is a technical build. If you are a developer, it is a weekend project. If you are not, use Claude Code to help write and debug the scripts interactively (expect 4-8 hours), or hire a developer for a day. Pre-built Meta Ads agent templates are likely coming from the community soon.
Can I run multiple agents for multiple clients?
Yes. Create separate agents with separate environments for each client. Each agent has its own rules, thresholds, and Meta credentials, managed from the same Anthropic account.
What if the agent makes a bad decision?
Every action is logged with a reason. Review the full log in the morning briefing. The agent only pauses and adjusts budgets — it never deletes anything or changes creative. You can reverse any action in Ads Manager.
Is this available now?
Yes. Claude Managed Agents launched in public beta in April 2026. Available to all Anthropic API accounts. Documentation at platform.claude.com/docs/en/managed-agents/overview.
About the author
Ahad Shams
Ahad Shams is the Founder of HeyOz, an all-in-one ads and content platform built for founders and small teams. He has worked across consumer goods and technology, with experience spanning Fortune 100 companies such as Reckitt Benckiser and Apple. Ahad is a third-time founder; his previous ventures include a WebXR game engine and Moemate, a consumer AI startup that scaled to over 6 million users. HeyOz was born from firsthand experience scaling consumer products and the need for a unified, execution-focused marketing platform.

