Deploy your agents in an afternoon

Alternative implementation of the Claude Managed Agents API.

Run agents with sandboxed execution, durable sessions, message queuing, context compaction, subagents, secrets, memory stores, and budgets, all built in.

session_01h9k2running

Review PR 412 and flag anything risky.


How it works

Already on Claude Managed Agents? Migrate off with one line change.

1Create an agent

A name, a model, a system prompt, and the tools it may use. Any provider, billed to your own keys.

from anthropic import Anthropic

client = Anthropic(base_url="https://coreloop.run/anthropic")

agent = client.beta.agents.create(
    name="Code Reviewer",
    model="openrouter/moonshotai/kimi-k3",
    system="You review pull requests.",
    tools=[{"type": "agent_toolset_20260401"}],
)

2Create a session and send a message

Start a session with the task. It runs in a sandbox and keeps going after your request returns.

session = client.beta.sessions.create(
    agent=agent.id,
    environment_id=ENV_ID,
    initial_events=[{
        "type": "user.message",
        "content": [{"type": "text", "text": "Review PR 412."}],
    }],
)

3Read the stream

Every message, tool call, and status change arrives as an event. Send more messages at any time.

for event in client.beta.sessions.events.stream(session.id):
    print(event.type)

Features

The runtime is the same whichever model a session uses.

Sandboxed execution

Each session runs in an isolated container with bash and a filesystem.

Persistent sessions

Event history is stored, so you can disconnect and resume later.

Event streaming

Server-sent events for messages, tool calls, and status.

MCP servers

Connect your own tools over MCP.

Steer mid-run

Send a message while the agent works. It reads it on the next turn.

Subagents

An agent can open a thread and hand part of the task to another agent.

Secrets

Store credentials once. Sessions get them at runtime, and they never appear in the transcript.

Memory stores

Mount a store into a session. What the agent learns is there next time.

Budgets

Set a cost cap per session. The agent stops when it is reached.


Deploy your first agent

Create an agent, start a session, read the stream.

Deploy an Agent