Docs
coreloop is an open implementation of the Claude Managed Agents API: a pre-built, configurable agent harness that runs in managed infrastructure. The wire contract is Anthropic's, so the Anthropic SDKs work against it with the base URL changed.
These pages are a work in progress.
Quickstart
Create an API key on your organization's API keys page, then point the SDK at https://coreloop.run/anthropic. The SDK appends /v1 itself.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://coreloop.run/anthropic",
apiKey: process.env.CORELOOP_API_KEY,
});An agent is the configuration. An environment is where a session runs. A session is one run of an agent in an environment.
const agent = await client.beta.agents.create({
name: "Code Reviewer",
model: "openrouter/z-ai/glm-5.2",
system: "You review pull requests.",
tools: [{ type: "agent_toolset_20260401" }],
});
const environment = await client.beta.environments.create({
name: "reviews",
config: { type: "cloud" },
});
const session = await client.beta.sessions.create({
agent: agent.id,
environment_id: environment.id,
initial_events: [
{
type: "user.message",
content: [{ type: "text", text: "Review PR 412." }],
},
],
});Then read the transcript as it is written.
const stream = await client.beta.sessions.events.stream(session.id);
for await (const event of stream) {
console.log(event.type);
}Authentication
Every request carries x-api-key with a coreloop key. Keys belong to one organization, and the key is what selects it — there is no organization parameter on these routes.
The SDK also sends anthropic-version and anthropic-beta. coreloop accepts both and requires neither.
curl https://coreloop.run/anthropic/v1/agents \
-H "x-api-key: $CORELOOP_API_KEY"Models and provider keys
Tokens bill to your own provider accounts. Add an OpenRouter, OpenAI, or Anthropic key to your organization, and coreloop uses the first one that can serve the model on the agent.
claude-sonnet-5— the Anthropic key if there is one, otherwise OpenRouter.gpt-5.6— the OpenAI key if there is one, otherwise OpenRouter.openrouter/moonshotai/kimi-k3— OpenRouter, always.
A session fails at creation with invalid_request_error when no configured key serves its model.
Endpoints
All paths are relative to https://coreloop.run/anthropic.
- POST/v1/agents
- GET/v1/agents
- GET/v1/agents/:id
- POST/v1/agents/:id
- GET/v1/agents/:id/versions
- POST/v1/agents/:id/archive
- POST/v1/environments
- GET/v1/environments
- GET/v1/environments/:id
- POST/v1/environments/:id
- POST/v1/environments/:id/archive
- POST/v1/sessions
- GET/v1/sessions
- GET/v1/sessions/:id
- POST/v1/sessions/:id
- POST/v1/sessions/:id/archive
- DELETE/v1/sessions/:id
- POST/v1/sessions/:id/events
- GET/v1/sessions/:id/events
- GET/v1/sessions/:id/events/stream
Events
A session's transcript is an append-only log. Read it as a page with GET /v1/sessions/:id/events, or as server-sent events with /events/stream. The SSE id is the sequence number, and the SSE event name is the event type.
Write to a running session with POST /v1/sessions/:id/events. A user.message is picked up on the next turn; a user.interrupt stops the current one.
Differences from Anthropic's API
The model is yours to choose, and the tokens are billed to your provider account rather than to an Anthropic workspace. Sessions run in coreloop's sandboxed containers. Anthropic's own model ids keep working; every other id is served through the provider that has it.
coreloop is an independent product and is not affiliated with Anthropic.