DELETE
/
v1
/
teams
/
{teamId}
/
agents
/
{agentId}
/
runs
/
{runId}
TypeScript client
import { OctosparkClient } from '@octospark/sdk'

const client = new OctosparkClient({
  token: process.env.OCTOSPARK_TOKEN
})

const response = await client.agents.cancelAgentRun({
  teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
  agentId: process.env.OCTOSPARK_AGENT_ID ?? "agentId",
  runId: process.env.OCTOSPARK_RUN_ID ?? "runId",
})
{
  "cancelled": true,
  "run": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "agentVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "scheduleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "workflowScheduleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "firingId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "decisionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "prompt": "<string>",
    "overrides": {
      "timeLimitSeconds": 10800,
      "strategy": "<string>"
    },
    "chatSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "chatId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "langfuseTraceId": "<string>",
    "langfuseTraceUrl": "<string>",
    "costDecimillicents": 123,
    "error": "<string>",
    "result": {},
    "startedAt": "<string>",
    "finishedAt": "<string>",
    "createdAt": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

idempotency-key
string

Optional. Accepted for consistency with other mutations; repeating a cancel is already safe.

Required string length: 1 - 200

Path Parameters

teamId
string
required

Team (workspace) id (UUID). Discover ids via the list teams endpoint or the agent context.

agentId
string
required

Managed agent id (UUID), as returned by the list/create agents endpoints.

runId
string
required

Agent run id (UUID), as returned by the start/list runs endpoints.

Response

CancelAgentRunResponse

cancelled
boolean
required

true when the run was in flight on this instance and its loop was told to stop; false when it was queued or running elsewhere and was only marked cancelled.

run
object
required