Skip to content

Agent Runs

Agent Runs are goal-directed executions where an AI Agent decomposes a high-level objective into sub-tasks, executes them, evaluates results, and re-plans as needed. Write/send/delete actions require human approval.

Status: Planned (Phase 2, Milestone M2.1)

Endpoints

MethodPathDescriptionAuthRate Limit
POST/agent-runsCreate an agent runJWT + Entitlement10/min
GET/agent-runsList user agent runsJWT60/min
GET/agent-runs/:idGet run detail + traceJWT60/min
POST/agent-runs/:id/steps/:stepId/approveApprove a paused actionJWT30/min
POST/agent-runs/:id/steps/:stepId/rejectReject a paused actionJWT30/min
DELETE/agent-runs/:idCancel a runJWT10/min
GET/agent-runs/:id/traceFull immutable traceJWT60/min

Create Agent Run

Request

FieldTypeRequiredDescription
goalstringYesHigh-level objective for the agent
contextIdsstring[]NoContext IDs to bind to the run
budgetobjectNoBudget constraints
budget.maxCreditsnumberNoMax credits to spend
budget.maxMinutesnumberNoMax wall-time in minutes

Response

json
{
  "data": {
    "id": "run-abc123",
    "goal": "Research our top 5 competitors and add comparison to Notion",
    "status": "planning",
    "plan": [],
    "budget": { "maxCredits": 100, "maxMinutes": 30, "spent": 0 },
    "createdAt": "2026-07-15T10:00:00.000Z"
  }
}

Agent Run Status Lifecycle

pending → planning → running → completed
                   ↘ awaiting_approval → running (approved)
                   ↘ awaiting_approval → cancelled (rejected)
                   ↘ failed
         → cancelled (user-initiated)

Approval Gate

When the agent encounters a risky action (write, send, delete), it pauses and waits for human approval.

Approve

json
POST /agent-runs/:id/steps/:stepId/approve

Reject

json
POST /agent-runs/:id/steps/:stepId/reject
{ "reason": "Don't update that Notion page yet" }

Trace

The trace is an append-only log of every action the agent took, including inputs, outputs, and model decisions.

json
{
  "data": {
    "steps": [
      {
        "stepId": "step-1",
        "action": "web_search",
        "input": { "query": "competitor pricing SaaS 2026" },
        "output": { "results": [...] },
        "status": "completed",
        "startedAt": "2026-07-15T10:01:00.000Z",
        "completedAt": "2026-07-15T10:01:15.000Z"
      }
    ]
  }
}

Built with purpose.