Managed Agent Runtime SDK β API Contract
The SDK exposes a single Anthropic-shaped surface for every runtime (Claude Managed Agents, Cursor, Gemini Antigravity, and any future runtime). Callers use the same four-step flow regardless of which runtime is active. Provider differences are fully encapsulated insidesdk/providers/<provider>/runtime/.
Reference shape: Anthropic Managed Agents API
Public flow
match runtime or if runtime == X blocks appear in calling code.
Input types
CreateAgentParams
| Field | Type | Notes |
|---|---|---|
lap_agent_runtime | AgentRuntime | Required. Selects the runtime adapter. |
name | String | Agent display name. |
model | AgentModel | AgentModel::Id("claude-opus-4-8") or AgentModel::Config { id, speed }. |
system | String | System prompt. Cursor uses this as prompt.text; Gemini sends it as system_instruction. |
description | Option<String> | Optional description. |
tools | Vec<Value> | Tool definitions. Cursor ignores this field. Gemini accepts code_execution, google_search, and url_context. |
mcp_servers | Vec<Value> | MCP server configs. Cursor maps these to mcpServers. |
workspace | Option<AgentWorkspace> | Repository + PR intent. Cursor maps to repos/autoCreatePR; Gemini maps the repository to base_environment.sources. |
env_vars | Option<HashMap<String, String>> | Runtime environment variables. Reserved for future vault support. |
metadata | Option<HashMap<String, String>> | Stored in provider metadata. Anthropic includes it; Cursor ignores. |
AgentWorkspace
| Field | Type | Notes |
|---|---|---|
repository | String | Repository URL. |
ref_name | Option<String> | Branch or commit ref. Defaults to "main". |
auto_create_pr | bool | Whether to open a PR when the run completes. |
CreateEnvironmentParams
| Field | Type | Notes |
|---|---|---|
lap_agent_runtime | AgentRuntime | Required. |
name | String | Environment name. Cursor returns this as the synthetic environment ID. |
config | Value | Anthropic environment config ({ "type": "cloud", "networking": {...} }). Cursor ignores. |
description | Option<String> | |
scope | Option<String> |
CreateSessionParams
| Field | Type | Notes |
|---|---|---|
agent | String | Agent ID from agents.create. |
environment_id | String | Environment ID from environments.create. |
title | String | Session title. |
lap_agent_runtime | Option<AgentRuntime> | Inferred from client config if only one runtime is configured. |
metadata | Option<HashMap<String, String>> | Anthropic stores; Cursor ignores. |
resources | Option<Value> | Reserved. |
SendEventsParams
Agent CRUD
Gemini Antigravity additionally supports saved-agent management through the normalizedagents resource:
Output types
ManagedAgent
Anthropic-shaped. All fields extracted from the raw response where available.
| Field | Type | Notes |
|---|---|---|
id | String | Provider agent ID. Always present. |
version | Option<u64> | Anthropic only. |
name | Option<String> | |
description | Option<String> | |
model | Option<String> | Model ID string. |
system | Option<String> | |
tools | Vec<Value> | |
mcp_servers | Vec<Value> | |
metadata | Option<Value> | |
created_at | Option<i64> | Unix timestamp. |
updated_at | Option<i64> | Unix timestamp. |
raw | Value | Full unmodified provider response. Escape hatch. |
Environment
| Field | Type | Notes |
|---|---|---|
id | String | Provider environment ID. Always present. |
raw | Value | Full provider response. Cursor returns { "id": "<name>" }. |
Session
Anthropic-shaped.
| Field | Type | Notes |
|---|---|---|
id | String | Provider session ID. Always present. |
agent | Option<String> | Agent ID. |
environment_id | Option<String> | Environment ID. |
status | Option<String> | Session status string. |
metadata | Option<Value> | |
created_at | Option<i64> | Unix timestamp. |
updated_at | Option<i64> | Unix timestamp. |
raw | Value | Full provider response. |
AgentEvent
Anthropic-shaped. Cursor events are normalized to this shape by the cursor adapter before the stream is returned to the caller.
| Field | Type | Notes |
|---|---|---|
event_type | String | Anthropic event type string (e.g. "agent.message", "session.status_idle"). |
data | Map<String, Value> | Event payload. |
event.kind() β AgentEventKind and event.payload() β AgentEventPayload for typed access.
Key event types:
| Event | Meaning |
|---|---|
session.status_running | Session is processing. |
agent.message | Assistant reply. data.content is an array of content blocks. |
agent.tool_use | Agent called a tool. |
agent.tool_result | Tool returned a result. |
session.status_idle | Session is done. Terminal event β stop reading the stream. |
Provider normalization
Each runtime maps its native response shape to the Anthropic-shaped outputs above. Callers never see provider-specific fields unless they inspect.raw.
| Concern | Anthropic | Cursor | Gemini Antigravity |
|---|---|---|---|
agents.create HTTP path | POST /v1/agents | POST /v1/agents | POST /v1beta/agents |
| Agent CRUD | Create only | Create only | Create, list, get, delete |
environments.create | POST /v1/environments | Synthetic ({ id: name }) | Synthetic (remote or supplied ID) |
sessions.create | POST /v1/sessions | Synthetic (uses agent ID) | Synthetic conversation handle |
send_events | POST /v1/sessions/{id}/events | POST /v1/agents/{id}/runs | POST /v1beta/interactions |
stream_events | GET /v1/sessions/{id}/events/stream | GET /v1/agents/{id}/runs/{run_id}/stream | GET /v1beta/interactions/{id} |
| Event normalization | Native Anthropic SSE | Cursor events -> Anthropic shape | Interaction steps -> Anthropic shape |
| Initial run on create | No β send first prompt via send_events | Yes β agents.create starts a run immediately | No β send first prompt via send_events |
Adapter contract
Each runtime implementsRuntimeAdapter in sdk/providers/<runtime>/runtime/mod.rs. Required methods:
None):
sdk/providers/<name>/runtime/mod.rs, implement RuntimeAdapter, add RUNTIME_ID/RUNTIME_NAME/DEFAULT_API_BASE constants, and call registry.register(...) in the providerβs mod.rs. No other files change.