Pods API

Manage AgentPods programmatically. Create, list, and terminate Pods through the REST API.

Endpoints

MethodPathScopeDescription
GET/podspods:readList all pods
GET/pods/:keypods:readGet pod details by key
POST/podspods:writeCreate a new pod
POST/pods/:key/terminatepods:writeTerminate a pod

Code Examples

List all running pods

curl -X GET \
  "https://your-domain.com/api/v1/ext/orgs/my-org/pods" \
  -H "X-API-Key: amk_your_api_key_here"

Create a new pod

curl -X POST \
  "https://your-domain.com/api/v1/ext/orgs/my-org/pods" \
  -H "X-API-Key: amk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_type_id": "claude-code",
    "runner_id": "runner-uuid",
    "initial_prompt": "Fix the login bug"
  }'

Endpoint Details

GET /pods

Retrieve a paginated list of pods in the organization. Supports filtering by status.

Query Parameters

ParameterTypeRequiredDefaultDescription
statusstringOptional-Filter by pod status (e.g., running, terminated)
limitintegerOptional20Maximum number of results to return
offsetintegerOptional0Number of results to skip for pagination

Response Example

{
  "pods": [
    {
      "key": "pod-abc123",
      "status": "running",
      "agent_type_id": "claude-code",
      "runner_id": "550e8400-e29b-41d4-a716-446655440000",
      "initial_prompt": "Fix the login bug",
      "repository_id": 1,
      "branch": "main",
      "created_at": "2025-01-15T10:30:00Z",
      "updated_at": "2025-01-15T10:35:00Z"
    }
  ],
  "total": 42,
  "limit": 20,
  "offset": 0
}

GET /pods/:key

Retrieve detailed information about a specific pod by its unique key.

Path Parameters

ParameterTypeRequiredDescription
keystringRequiredThe unique key identifier of the pod

Response Example

{
  "pod": {
    "key": "pod-abc123",
    "status": "running",
    "agent_type_id": "claude-code",
    "runner_id": "550e8400-e29b-41d4-a716-446655440000",
    "initial_prompt": "Fix the login bug",
    "repository_id": 1,
    "branch": "main",
    "ticket_slug": "AM-42",
    "channel_id": 5,
    "sandbox_type": "worktree",
    "auto_close": false,
    "pod_timeout_minutes": 60,
    "max_turns": 100,
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:35:00Z"
  }
}

POST /pods

Create a new AgentPod on a specified runner. The pod will be initialized with the given configuration and start executing.

Request Body

FieldTypeRequiredDescription
runner_idstringRequiredID of the runner to create the pod on
agent_type_idstringOptionalAgent type identifier (e.g., claude-code, aider)
initial_promptstringOptionalInitial prompt or task for the agent
repository_idintegerOptionalRepository to associate with the pod
branchstringOptionalGit branch to work on
ticket_slugstringOptionalTicket slug to link (e.g., AM-123)
channel_idintegerOptionalChannel to associate with the pod
sandbox_typestringOptionalSandbox type: worktree or tempdir
environment_variablesobjectOptionalKey-value pairs of environment variables
custom_agent_commandstringOptionalCustom command to launch the agent
custom_agent_argsstring[]OptionalArguments for the custom agent command
custom_mcp_configobjectOptionalCustom MCP server configuration (JSON)
auto_closebooleanOptionalWhether the pod should auto-close after task completion
auto_close_delay_secondsintegerOptionalDelay in seconds before auto-closing
pod_timeout_minutesintegerOptionalMaximum lifetime of the pod in minutes
max_turnsintegerOptionalMaximum number of agent turns

Response Example

{
  "pod": {
    "key": "pod-xyz789",
    "status": "creating",
    "agent_type_id": "claude-code",
    "runner_id": "550e8400-e29b-41d4-a716-446655440000",
    "initial_prompt": "Fix the login bug",
    "repository_id": 1,
    "branch": "feature/auth",
    "sandbox_type": "worktree",
    "auto_close": true,
    "auto_close_delay_seconds": 30,
    "pod_timeout_minutes": 60,
    "max_turns": 100,
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:30:00Z"
  }
}

POST /pods/:key/terminate

Terminate a running pod. The pod process will be stopped and resources released.

Path Parameters

ParameterTypeRequiredDescription
keystringRequiredThe unique key identifier of the pod to terminate

Response Example

{
  "message": "Pod terminated"
}