VM0VM0
ReferenceAPI Reference

Runs

Agent execution and monitoring endpoints

Execute agents and monitor run status, logs, and metrics.

Run Status Values

StatusDescription
pendingRun is queued, waiting to start
runningAgent is currently executing
completedRun finished successfully
failedRun encountered an error
timeoutRun exceeded time limit
cancelledRun was cancelled by user

List Runs

GET /v1/runs

Returns a paginated list of runs.

Query Parameters

ParameterTypeDefaultDescription
limitinteger20Items per page (1-100)
cursorstring-Pagination cursor
statusstring-Filter by status

Request

curl "https://api.vm0.ai/v1/runs?status=completed&limit=10" \
  -H "Authorization: Bearer vm0_live_xxx"

Response

{
  "data": [
    {
      "id": "run_abc123",
      "agentId": "ag_xyz789",
      "agentName": "my-agent",
      "status": "completed",
      "prompt": "Research AI trends",
      "createdAt": "2024-01-15T10:00:00Z",
      "startedAt": "2024-01-15T10:00:05Z",
      "completedAt": "2024-01-15T10:15:00Z"
    }
  ],
  "pagination": {
    "hasMore": false,
    "nextCursor": null
  }
}

Create Run

POST /v1/runs

Starts a new agent execution. Returns immediately with run details; the agent executes asynchronously.

Request Body

FieldTypeRequiredDescription
agentstring*Agent name
agentIdstring*Agent ID
sessionIdstring*Continue existing session
checkpointIdstring*Resume from checkpoint
agentVersionstringNoVersion specifier (default: latest)
promptstringYesTask prompt for the agent
variablesobjectNoEnvironment variables
secretsobjectNoSecret environment variables
volumesobjectNoVolume mounts (name -> version)
artifactNamestringNoArtifact name to mount
artifactVersionstringNoArtifact version (defaults to latest)

*One of agent, agentId, sessionId, or checkpointId is required.

Request

curl https://api.vm0.ai/v1/runs \
  -H "Authorization: Bearer vm0_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": "my-agent",
    "prompt": "Research the latest AI trends and create a summary report",
    "variables": {
      "SLACK_CHANNEL_ID": "C0123456789"
    }
  }'

Response (202 Accepted)

{
  "id": "run_def456",
  "agentId": "ag_xyz789",
  "agentName": "my-agent",
  "status": "pending",
  "prompt": "Research the latest AI trends and create a summary report",
  "error": null,
  "executionTimeMs": null,
  "checkpointId": null,
  "sessionId": "sess_abc123",
  "artifactName": null,
  "artifactVersion": null,
  "createdAt": "2024-01-15T10:00:00Z",
  "startedAt": null,
  "completedAt": null
}

Get Run

GET /v1/runs/:id

Retrieves run details including execution metrics.

Path Parameters

ParameterTypeDescription
idstringRun ID

Request

curl https://api.vm0.ai/v1/runs/run_abc123 \
  -H "Authorization: Bearer vm0_live_xxx"

Response

{
  "id": "run_abc123",
  "agentId": "ag_xyz789",
  "agentName": "my-agent",
  "status": "completed",
  "prompt": "Research AI trends",
  "error": null,
  "executionTimeMs": 900000,
  "checkpointId": "chk_xyz789",
  "sessionId": "sess_abc123",
  "artifactName": "research-output",
  "artifactVersion": "v1_abc123",
  "volumes": {},
  "createdAt": "2024-01-15T10:00:00Z",
  "startedAt": "2024-01-15T10:00:05Z",
  "completedAt": "2024-01-15T10:15:00Z"
}

Cancel Run

POST /v1/runs/:id/cancel

Cancels a pending or running execution.

Path Parameters

ParameterTypeDescription
idstringRun ID

Request

curl -X POST https://api.vm0.ai/v1/runs/run_abc123/cancel \
  -H "Authorization: Bearer vm0_live_xxx"

Response

Returns the updated run object with status: "cancelled".


Stream Events

GET /v1/runs/:id/events

Streams real-time events using Server-Sent Events (SSE).

Path Parameters

ParameterTypeDescription
idstringRun ID

Query Parameters

ParameterTypeDescription
lastEventIdstringResume from event ID

Request

curl https://api.vm0.ai/v1/runs/run_abc123/events \
  -H "Authorization: Bearer vm0_live_xxx" \
  -H "Accept: text/event-stream"

Event Types

EventDescription
statusRun status changed
outputAgent produced output
errorError occurred
completeRun finished
heartbeatKeep-alive signal

Event Format

event: status
data: {"status": "running"}
id: evt_123

event: output
data: {"content": "Starting research..."}
id: evt_124

event: complete
data: {"status": "completed", "executionTimeMs": 900000}
id: evt_125

Get Logs

GET /v1/runs/:id/logs

Retrieves unified logs from the run.

Path Parameters

ParameterTypeDescription
idstringRun ID

Query Parameters

ParameterTypeDefaultDescription
typestringallLog type: all, agent, system, network
sincestring-Start time (ISO 8601)
untilstring-End time (ISO 8601)
orderstringascSort order: asc, desc
limitinteger20Items per page
cursorstring-Pagination cursor

Request

curl "https://api.vm0.ai/v1/runs/run_abc123/logs?type=agent&limit=50" \
  -H "Authorization: Bearer vm0_live_xxx"

Response

{
  "data": [
    {
      "timestamp": "2024-01-15T10:00:05Z",
      "type": "agent",
      "level": "info",
      "message": "Starting execution",
      "metadata": {}
    },
    {
      "timestamp": "2024-01-15T10:00:10Z",
      "type": "agent",
      "level": "info",
      "message": "Searching for AI trends...",
      "metadata": {"tool": "web_search"}
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "xxx"
  }
}

Get Metrics

GET /v1/runs/:id/metrics

Retrieves resource usage metrics for a run.

Path Parameters

ParameterTypeDescription
idstringRun ID

Request

curl https://api.vm0.ai/v1/runs/run_abc123/metrics \
  -H "Authorization: Bearer vm0_live_xxx"

Response

{
  "data": [
    {
      "timestamp": "2024-01-15T10:00:05Z",
      "cpuPercent": 25.5,
      "memoryUsedMb": 512,
      "memoryTotalMb": 2048,
      "diskUsedMb": 100,
      "diskTotalMb": 1000
    }
  ],
  "summary": {
    "avgCpuPercent": 30.0,
    "maxMemoryUsedMb": 1024,
    "totalDurationMs": 900000
  }
}

Run Object

FieldTypeDescription
idstringUnique run identifier (prefix: run_)
agentIdstringAgent that was executed
agentNamestringAgent name
statusstringCurrent status
promptstringTask prompt
errorstringError message (when failed)
executionTimeMsintegerTotal execution time
checkpointIdstringCheckpoint for resuming
sessionIdstringSession identifier
artifactNamestringOutput artifact name
artifactVersionstringOutput artifact version
volumesobjectInput volume versions
createdAtstringISO 8601 creation timestamp
startedAtstringISO 8601 start timestamp
completedAtstringISO 8601 completion timestamp