From latestaiagents
Use Anthropic's Managed Agents API (/v1/agents, /v1/sessions) — server-side agent runtime that handles the tool loop, compaction, memory, and scaling for you. Covers when to pick Managed over SDK, request shape, and cost model. Use this skill when building production agents at scale, deciding between SDK vs Managed, or migrating from self-hosted agent loops. Activate when: Managed Agents API, /v1/agents, /v1/sessions, server-side agent, Anthropic agent runtime.
npx claudepluginhub latestaiagents/agent-skills --plugin skills-authoringThis skill uses the workspace's default tool permissions.
**The Managed Agents API lets Anthropic run the agent loop server-side. You POST a user message; they run the tool loop, manage context, and stream results. You lose control but gain simplicity and durability.**
Manages AI agent lifecycle with AI Maestro CLI: create, list, delete, rename, hibernate/wake, plugin install, export. For agent operations in Claude Code.
Manages Claude AI sub-agent sessions via agent-deck CLI: launch child sessions, check status, retrieve outputs, attach MCP tools like exa.
Guides creation and configuration of autonomous agents for Claude Code plugins, covering frontmatter, triggering descriptions, system prompts, tools, teams, permissions, and best practices.
Share bugs, ideas, or general feedback.
The Managed Agents API lets Anthropic run the agent loop server-side. You POST a user message; they run the tool loop, manage context, and stream results. You lose control but gain simplicity and durability.
/v1/agents) — a template: name, system prompt, tools, model/v1/sessions) — a live conversation bound to an agentconst agent = await client.beta.agents.create({
name: "support-bot",
description: "Customer support for ACME",
model: "claude-sonnet-4-6",
system_prompt: "You are ACME's support agent. Be concise and accurate.",
tools: [
{ type: "search_tickets", name: "search_tickets", /* schema */ },
{ type: "create_escalation", name: "create_escalation" },
],
mcp_servers: [
{ type: "url", url: "https://mcp.acme.com/sse", name: "acme" },
],
});
// Returns: { id: "agt_...", name: "support-bot", ... }
Agents are versionable — update without breaking live sessions.
const session = await client.beta.sessions.create({
agent_id: agent.id,
metadata: { user_id: "u-42", ticket_id: "T-1001" },
});
// Returns: { id: "ses_...", agent_id: "agt_...", status: "idle", ... }
Metadata is yours to use for filtering, auditing, linking to your domain.
const stream = client.beta.sessions.messages.stream({
session_id: session.id,
content: "My order #12345 is stuck — can you help?",
});
for await (const event of stream) {
if (event.type === "text") console.log(event.delta);
if (event.type === "tool_use") console.log("TOOL:", event.name);
if (event.type === "done") break;
}
Managed runs the tool loop server-side. You see streamed text, tool calls, and final response. You don't execute tools — Managed does (either built-in tools or via MCP).
Sessions are durable. A day later:
const next = await client.beta.sessions.messages.create({
session_id: session.id,
content: "Any update on my issue?",
});
Server-side compaction keeps context in budget. You don't manage history — it's stored and pruned automatically.
const sessions = await client.beta.sessions.list({
agent_id: agent.id,
metadata: { user_id: "u-42" },
limit: 50,
});
Use metadata filters to scope sessions by user, tenant, or workflow instance.
Tools are declared on the Agent. Managed executes them by:
tools: [
{
type: "url",
name: "ship_order",
description: "Ship an order",
input_schema: { /* ... */ },
url: "https://api.acme.com/tools/ship",
auth: { type: "bearer", token: "${ACME_TOKEN}" },
},
]
Your endpoint must return the tool result JSON. Managed handles retries and the loop.
Typically 5-15% more expensive than self-hosted agents in exchange for zero ops.
const events = await client.beta.sessions.events.list({ session_id, limit: 100 });
// Returns loop events: tool_use, tool_result, thinking, compaction, etc.
Every step is logged. You can audit, replay, and debug without running infrastructure.
Incremental:
Or parallel for critical flows — run both and A/B test.