Answer these three questions before writing any code. Write them down — you'll paste them directly into the config.
Managed Agents stores your API keys in named vaults — no plaintext secrets in prompts. In the Anthropic Console, go to Managed Agents > Credential Vaults.
1. Create a new vault — name it after the project or client Example: "lead-research-prod" 2. Add each key your agent will use: GOOGLE_SHEETS_KEY: [your key] GMAIL_API_KEY: [your key] CRM_WEBHOOK_URL: [your URL] 3. Save and copy the vault_id — needed in Step 3.
Recommended pattern: one vault per client, or one per environment (staging vs production).
POST to the Managed Agents API with the beta header. The API returns an agent_id — save this, it's how you trigger runs.
POST https://api.anthropic.com/v1/managed-agents
Headers:
anthropic-version: 2024-01-01
anthropic-beta: managed-agents-2026-04-01
x-api-key: YOUR_API_KEY
Content-Type: application/json
Body:
{
"name": "lead-research-agent",
"model": "claude-sonnet-4-5",
"system_prompt": "[Paste your system prompt — see Step 4]",
"tools": ["web_search", "google_sheets", "gmail"],
"vault_id": "YOUR_VAULT_ID",
"guardrails": {
"max_runtime_minutes": 10,
"require_human_review": true,
"allowed_domains": ["google.com", "linkedin.com"]
}
}This is the most important step. Your system prompt defines the agent's workflow, tools and constraints. Copy this template and fill in the blanks.
You are a [role] for [Company Name].
YOUR JOB:
When triggered, you will:
1. [First task — e.g. search for the lead's company online]
2. [Second task — e.g. find context about their size/industry]
3. [Third task — e.g. draft a short, personalised intro email]
4. [Final task — e.g. log everything to the CRM sheet]
TOOLS YOU CAN USE:
- web_search: research companies and contacts
- google_sheets: read lead data, update CRM rows
- gmail: draft emails ONLY — never send directly
RULES:
- Never send emails. Set status "DRAFT_READY" when done.
- Never access data outside the leads spreadsheet.
- If you cannot verify a detail, flag: status "NEEDS_REVIEW"
- Complete the full workflow before responding.
OUTPUT FORMAT (always return this JSON):
{
"lead_name": "",
"company": "",
"research_summary": "",
"email_draft": "",
"status": "DRAFT_READY | NEEDS_REVIEW | ERROR",
"notes": ""
}POST to the runs endpoint with your input. The agent wakes up, works through the system prompt step by step, and returns the JSON output. Cost: $0.08/hour of runtime — most tasks finish in 2–4 minutes.
POST https://api.anthropic.com/v1/managed-agents/{agent_id}/runs
Body:
{
"input": {
"lead_name": "Sarah Chen",
"company": "Acme Corp",
"email": "sarah@acme.com",
"message": "Interested in CRM automation for our 200-person team"
}
}Managed Agents doesn't have native webhooks in the current beta. Pick one of these to fire the agent automatically.
In the Anthropic Console under Managed Agents > Runs, every execution is logged with timestamps, inputs, outputs and a full step-by-step trace. Filter by: COMPLETED | FAILED | RUNNING.
Rather have us build this for you?
This is exactly what OrcaScale does for SMEs — delivered in 3–7 days, before you pay a penny.