Skip to content

API reference

Agents API

Run a coding agent (Claude Code, Codex, or Pi) inside a running machine: prompt it, follow its events, steer or interrupt a running turn, and resume conversations.

On this page

Prompt an agent

POST /v1/machines/{machine_id}/agents/prompt

Starts a turn of a coding agent in the machine, in a new conversation or one you resume. The agent's provider keys are the machine's environment variables, so a machine created without an environment gives it none. Follow the turn with GET /v1/machines/{machine_id}/agents/events.

  • API key: Authorization: Bearer vmy_… with preset use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie and the x-csrf-token header.
  • Who: Owner, Admin, or Operator.
  • Idempotency: send a unique Idempotency-Key; replaying the same key and body returns the same operation.

Parameters

NameInTypeRequiredDescription
machine_idpathstring (uuid)Yes
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.

Request body (application/json, AgentPromptRequest)

FieldTypeRequiredDescription
attachmentsAgentAttachmentRequest[]NoAt most 16 files, 16 MiB together, written to the machine for the agent to read.
conversation_idstring (uuid) | nullNoContinue this conversation; omit to start a new one.
modelstring | nullNoA model the agent accepts (see GET /v1/provider-models); the agent's default when omitted. Pi takes provider/model.
providernull | AgentProviderDtoNoRequired for a new conversation; a conversation keeps its provider.
reasoning_effortnull | ReasoningEffortDtoNo
textstringNoThe prompt, at most 256 KiB. A prompt needs text or an attachment.

Responses

StatusDescriptionBody
202The turn runs in the machine; follow events_urlAgentTurnDto
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403forbidden, insufficient_scope, or organization_suspendedProblemDetails
404Unknown machine, or conversation_not_foundProblemDetails
409agent_turn_running, provider_mismatch, idempotency_conflict, machine_not_running, machine_not_created, or machine_deletedProblemDetails
413The request body is too large (body_too_large).ProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
502guest_action_failed: the machine could not start the turn (the turn is failed)ProblemDetails
503agents_unavailable, or runtime_unavailable (retry with the same key)ProblemDetails
Request
curl -X POST "$VMYARD_API_URL/v1/machines/$MACHINE_ID/agents/prompt" \
  -H "Authorization: Bearer $VMYARD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
Response 202
{
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "created_at": "2026-10-12T05:51:01Z",
  "error_code": "string",
  "events_url": "string",
  "exit_code": 0,
  "finished_at": "2026-10-12T05:51:01Z",
  "interrupt_requested": false,
  "machine_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "model": "string",
  "provider": "claude",
  "reasoning_effort": "minimal",
  "resume": false,
  "started_at": "2026-10-12T05:51:01Z",
  "status": "starting",
  "turn_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
}

Follow an agent's events

GET /v1/machines/{machine_id}/agents/events

JSON by cursor (with wait_seconds to long-poll), or server-sent events with Accept: text/event-stream. Each SSE event's id is the cursor after it: reconnect with Last-Event-ID to resume without repeats. The stream ends with an idle event once no turn is running.

  • API key: Authorization: Bearer vmy_… with preset use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie.
  • Who: Owner, Admin, or Operator.

Parameters

NameInTypeRequiredDescription
machine_idpathstring (uuid)Yes
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.
Last-Event-IDheaderinteger | nullNoSSE: resume after this event's cursor (overrides cursor)
conversation_idquerystring (uuid)Yes
cursorqueryintegerNoThe cursor of an earlier answer (or an SSE event's id); events after it are returned. Default 0, the conversation's first event.
wait_secondsqueryintegerNoJSON only: wait up to this many seconds (0-30, default 0) for an event when none is ready.

Responses

StatusDescriptionBody
200With Accept: text/event-stream: an SSE stream of agent events (id is the cursor after the event), ending with an idle event once no turn is running and every event was sent. Otherwise JSON: the events after cursor, waiting up to wait_seconds for one.AgentEventsDto
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403Refused for this caller: role, key preset, CSRF token, or organization (forbidden, insufficient_scope, csrf_invalid, organization_mismatch, session_required).ProblemDetails
404Unknown machine, or conversation_not_foundProblemDetails
409machine_not_running, machine_not_created, or machine_deletedProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
502The machine's host or a provider failed to answer.ProblemDetails
503Not available on this server.ProblemDetails
Request
curl "$VMYARD_API_URL/v1/machines/$MACHINE_ID/agents/events?conversation_id=conversation_id" \
  -H "Authorization: Bearer $VMYARD_API_KEY"
Response 200
{
  "active": false,
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "cursor": 0,
  "events": [
    {
      "code": "string",
      "id": "string",
      "input": "string",
      "input_id": "string",
      "is_error": false,
      "kind": "prompt",
      "message": "string",
      "model": "string",
      "name": "dev",
      "outcome": "completed",
      "output": "string",
      "provider": "claude",
      "reasoning_effort": "minimal",
      "restarted": false,
      "result": "string",
      "resumed": false,
      "seq": 0,
      "session_id": "string",
      "text": "string",
      "time_ms": 0,
      "turn_id": "string",
      "type": "turn_started",
      "usage": {
        "cached_input_tokens": 0,
        "cost_micro_usd": 0,
        "input_tokens": 0,
        "output_tokens": 0
      }
    }
  ],
  "latest_turn": {
    "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
    "created_at": "2026-10-12T05:51:01Z",
    "error_code": "string",
    "events_url": "string",
    "exit_code": 0,
    "finished_at": "2026-10-12T05:51:01Z",
    "interrupt_requested": false,
    "machine_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
    "model": "string",
    "provider": "claude",
    "reasoning_effort": "minimal",
    "resume": false,
    "started_at": "2026-10-12T05:51:01Z",
    "status": "starting",
    "turn_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
  }
}

List agent conversations

GET /v1/machines/{machine_id}/agents/conversations

  • API key: Authorization: Bearer vmy_… with preset use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie.
  • Who: Owner, Admin, or Operator.

Parameters

NameInTypeRequiredDescription
machine_idpathstring (uuid)Yes
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.
limitqueryintegerNo1-100 (default 50).
cursorquerystring (uuid)NoThe next_cursor of the previous page.

Responses

StatusDescriptionBody
200—AgentConversationListDto
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403Refused for this caller: role, key preset, CSRF token, or organization (forbidden, insufficient_scope, csrf_invalid, organization_mismatch, session_required).ProblemDetails
404Not found in this organization (resource_not_found).ProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
Request
curl "$VMYARD_API_URL/v1/machines/$MACHINE_ID/agents/conversations" \
  -H "Authorization: Bearer $VMYARD_API_KEY"
Response 200
{
  "conversations": [
    {
      "created_at": "2026-10-12T05:51:01Z",
      "events_url": "string",
      "id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
      "latest_turn": {
        "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
        "created_at": "2026-10-12T05:51:01Z",
        "error_code": "string",
        "events_url": "string",
        "exit_code": 0,
        "finished_at": "2026-10-12T05:51:01Z",
        "interrupt_requested": false,
        "machine_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
        "model": "string",
        "provider": "claude",
        "reasoning_effort": "minimal",
        "resume": false,
        "started_at": "2026-10-12T05:51:01Z",
        "status": "starting",
        "turn_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
      },
      "machine_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
      "provider": "claude",
      "status": "idle",
      "turn_count": 0,
      "updated_at": "2026-10-12T05:51:01Z"
    }
  ],
  "next_cursor": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
}

Steer a running agent

POST /v1/machines/{machine_id}/agents/steer

Adds instructions to the running turn. The agent confirms when it takes them with an input_accepted event carrying the answer's input_id.

  • API key: Authorization: Bearer vmy_… with preset use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie and the x-csrf-token header.
  • Who: Owner, Admin, or Operator.
  • Idempotency: send a unique Idempotency-Key; replaying the same key and body returns the same operation.

Parameters

NameInTypeRequiredDescription
machine_idpathstring (uuid)Yes
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.

Request body (application/json, AgentSteerRequest)

FieldTypeRequiredDescription
conversation_idstring (uuid)Yes
textstringYesMore instructions for the running turn, at most 256 KiB.

Responses

StatusDescriptionBody
202Written to the running turn's inbox; the agent confirms it with an input_accepted eventAgentInputAccepted
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403Refused for this caller: role, key preset, CSRF token, or organization (forbidden, insufficient_scope, csrf_invalid, organization_mismatch, session_required).ProblemDetails
404Unknown machine, or conversation_not_foundProblemDetails
409no_active_turn, idempotency_conflict, or the machine is not runningProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
502The machine's host or a provider failed to answer.ProblemDetails
503Not available on this server.ProblemDetails
Request
curl -X POST "$VMYARD_API_URL/v1/machines/$MACHINE_ID/agents/steer" \
  -H "Authorization: Bearer $VMYARD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "text": "string"
}'
Response 202
{
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "input_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "kind": "steer",
  "stopped": false,
  "turn_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
}

Interrupt a running agent

POST /v1/machines/{machine_id}/agents/interrupt

Asks the running turn to stop; with force the agent is killed at once. The turn ends with outcome interrupted.

  • API key: Authorization: Bearer vmy_… with preset use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie and the x-csrf-token header.
  • Who: Owner, Admin, or Operator.
  • Idempotency: send a unique Idempotency-Key; replaying the same key and body returns the same operation.

Parameters

NameInTypeRequiredDescription
machine_idpathstring (uuid)Yes
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.

Request body (application/json, AgentInterruptRequest)

FieldTypeRequiredDescription
conversation_idstring (uuid)Yes
forcebooleanNoAlso kill the runner and the agent at once instead of letting the agent stop on its own (it gets 10 s, then SIGTERM, then SIGKILL).

Responses

StatusDescriptionBody
202The running turn is asked to stop (or, with force, killed); it ends with outcome interruptedAgentInputAccepted
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403Refused for this caller: role, key preset, CSRF token, or organization (forbidden, insufficient_scope, csrf_invalid, organization_mismatch, session_required).ProblemDetails
404Unknown machine, or conversation_not_foundProblemDetails
409no_active_turn, idempotency_conflict, or the machine is not runningProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
502The machine's host or a provider failed to answer.ProblemDetails
503Not available on this server.ProblemDetails
Request
curl -X POST "$VMYARD_API_URL/v1/machines/$MACHINE_ID/agents/interrupt" \
  -H "Authorization: Bearer $VMYARD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
}'
Response 202
{
  "conversation_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "input_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
  "kind": "steer",
  "stopped": false,
  "turn_id": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
}

List agent models

GET /v1/provider-models

  • API key: Authorization: Bearer vmy_… with preset read_only, use_existing, create_and_use, full_access.
  • Browser session: the vmyard_session cookie.
  • Who: Any member.

Parameters

NameInTypeRequiredDescription
X-Organization-IDheaderstring (uuid)NoRequired with a browser session. Optional with an API key, which fixes the organization; when sent it must match.

Responses

StatusDescriptionBody
200—ProviderModelsDto
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
404Not found in this organization (resource_not_found).ProblemDetails
Request
curl "$VMYARD_API_URL/v1/provider-models" \
  -H "Authorization: Bearer $VMYARD_API_KEY"
Response 200
{
  "providers": [
    {
      "models": [
        {
          "attachments": false,
          "context_tokens": 0,
          "id": "string",
          "name": "dev",
          "provider": "anthropic",
          "reasoning": false,
          "release_date": "string"
        }
      ],
      "provider": "claude",
      "reasoning_efforts": [
        "minimal"
      ]
    }
  ],
  "source": "live"
}