✈
    TravelmodeDevelopers
    🔎/
    🔑Manage API Keys
    Feature
    🌦️Weather🛂Visa🧩Platform🧭Trips🤖Agent Runs📅Events

    Agent Runs API · v1

    📖Overview🧪API Reference (Try It)
    Guides
    🚀Getting Started🔐Authentication🔄Run Lifecycle📡Streaming & Polling📦Artifacts⚠️Errors
    ⬇️Download openapi.yaml
    Developers / Agent Runs / Run Lifecycle

    Run Lifecycle

    Last verified: 2026-06-20 (Task #390 — User APIs documentation).

    A run has a coarse status and a finer-grained phase. All endpoints here are owner-only (see authentication.md).

    Statuses

    statusMeaning
    pendingCreated, not yet started.
    runningActively executing.
    completedFinished successfully.
    failedStopped with an error (errorMessage is set).
    cancelledCancelled by the owner (cancelReason may be set).

    Phases

    While running, a run reports its current phase:

    understand → plan → retrieve → reason → act → compose → deliver → done
    

    phase is null before the run starts.

    Reading a run

    GET /v1/agent-runs/{runId}
    

    Returns the run, its artifacts, and revisionDrift — whether the trip has advanced past the run's frozen input snapshot since it started.

    {
      "run": { "id": "9f2a1c7e-…", "status": "running", "phase": "reason", "lastEventSequence": 14 },
      "artifacts": [ { "id": 5012, "artifactType": "candidates", "isPinned": false } ],
      "revisionDrift": { "hasDrift": false, "snapshotRevision": 7, "currentRevision": 7 }
    }
    

    If revisionDrift.hasDrift is true, the trip changed underneath the run; decide whether to apply its output or start a fresh run.

    Control actions

    POST /v1/agent-runs/{runId}/control
    
    actionEffect
    startBegin a pending run.
    stopHalt a running run.
    retryRe-run after a failed outcome.
    cancelCancel the run; pass an optional reason.
    curl -s -X POST "https://api.travelmode.ai/v1/agent-runs/9f2a1c7e-…/control" \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{ "action": "cancel", "reason": "User changed dates" }'
    
    { "run": { "id": "9f2a1c7e-…", "status": "cancelled", "cancelReason": "User changed dates" } }
    

    An action that is invalid for the run's current state returns 400 (for example, start on a run that is already running).

    Previous
    ← Authentication
    Next
    Streaming & Polling →