---
title: "Cancel agent"
method: POST
path: "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/cancel"
tags: ["Agents"]
---

# Cancel agent

`POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/cancel`

## Request

- Base URL: `https://api.omnara.com/v1`
- URL: `https://api.omnara.com/v1/orgs/{orgID}/projects/{projectID}/agents/{agentID}/cancel`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-omnara_session` and API key in header `X-Omnara-Csrf`

Stops the agent's current turn: cancels its unfinished tool calls and open interactions, stops processes whose run_command hasn't returned yet, and discards pending steering messages. The agent stays active and keeps its queued messages, and processes whose run_command already returned keep running. Returns affected false and changes nothing when no turn is in progress.

## Path parameters

- `orgID` string, required
- `projectID` string, required
- `agentID` string, required

## Request body

- CancelAgentRequest
  - `actor` ExternalActorParams: External actor to attribute this cancelation to, upserted by (provider_tenant_id, provider_user_id) atomically with the cancelation; a rejected request writes no actor. Only allowed for non-user principals; requests authenticated as a user must omit it and are attributed to the user's omnara actor.
    - `provider_tenant_id` string: Your tenant or namespace for the user. With provider_user_id, identifies the actor.
    - `provider_user_id` string, required: The user's ID in your system. With provider_tenant_id, identifies the actor.
    - `display_name` string: Display name for the actor.
    - `metadata` Metadata: Key-value attributes for the actor. Replaces stored metadata when sent.

## Response `200`

Agent canceled.

- CancelAgentResponse
  - `event` union, required
    - AgentInputEvent
      - `id` string, required
      - `org_id` string, required
      - `project_id` string, required: Project ID (proj_...).
      - `agent_id` string, required
      - `agent_profile_id` string, nullable, required
      - `parent_agent_id` string, nullable, required
      - `root_agent_id` string, required: The top-level agent in the emitting agent's tree. Equals agent_id for a top-level agent.
      - `turn_id` string, required
      - `turn_sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `is_opening_event` boolean, required
      - `sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `event_kind` 'agent_input', required
      - `agent_input_id` string, required: Matches the input that produced this event, allowing clients to correlate an input submission with its durable timeline admission.
      - `input_kind` 'content' | 'control' | 'interaction_response' | 'config_change', required
      - `actor_id` string: Actor attributed to the input. Resolve details through the project actors endpoints.
      - `input_idempotency_key` string: Echoes the Idempotency-Key of a content-input request so its sender can recognize the durable admission. Absent for other input kinds.
      - `control_type` 'cancel_current'
      - `interaction_id` string: Interaction answered by an interaction_response input.
      - `agent_config_id` string: Configuration selected by a config_change input.
      - `content_blocks` AgentInputContentBlock[], required
        - union
          - TextContentBlock
            - `type` 'text', required: text: a plain-text block.
            - `text` string, required: Block text: the message in agent inputs, or text from the model or a tool in events.
            - `metadata` ContentBlockMetadata: Key-value metadata. omnara_ keys are reserved.
          - MediaRefContentBlock
            - `type` 'media_ref', required
            - `artifact_id` string, required
            - `exclude_from_model_context` boolean: Whether the referenced artifact is excluded from later model context.
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
      - `created_at` string, date-time, required
    - ModelOutputEvent
      - `id` string, required
      - `org_id` string, required
      - `project_id` string, required: Project ID (proj_...).
      - `agent_id` string, required
      - `agent_profile_id` string, nullable, required
      - `parent_agent_id` string, nullable, required
      - `root_agent_id` string, required: The top-level agent in the emitting agent's tree. Equals agent_id for a top-level agent.
      - `turn_id` string, required
      - `turn_sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `is_opening_event` false, required
      - `sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `event_kind` 'model_output', required
      - `model_call_context_id` string, required
      - `stop_reason` 'end_turn' | 'tool_use' | 'max_tokens' | 'refusal' | 'content_filter' | 'error', required: Stop reasons admitted as durable model-output events.
      - `content_blocks` ModelOutputContentBlock[], required
        - union
          - TextContentBlock
            - `type` 'text', required: text: a plain-text block.
            - `text` string, required: Block text: the message in agent inputs, or text from the model or a tool in events.
            - `metadata` ContentBlockMetadata: Key-value metadata. omnara_ keys are reserved.
          - MediaRefContentBlock
            - `type` 'media_ref', required
            - `artifact_id` string, required
            - `exclude_from_model_context` boolean: Whether the referenced artifact is excluded from later model context.
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
          - ReasoningContentBlock
            - `type` 'reasoning', required
            - `text` string, required
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
          - ModelToolCallContentBlock
            - `type` 'tool_call', required
            - `tool_call_id` string, required
            - `tool_type` 'built_in' | 'custom' | 'mcp', required: Identifies who manages execution. Built-in and MCP calls are platform-managed; custom calls wait for an external consumer to submit their result.
            - `name` string, required
            - `input` ToolInput, required: Non-null JSON object containing the arguments emitted for a tool call.
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
          - ErrorContentBlock
            - `type` 'error', required
            - `text` string, required
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
      - `usage` ModelUsage: Token counts the provider reported for one model call. Cache and reasoning counts are omitted when the provider reported none.
        - `input_tokens_total` integer
        - `uncached_input_tokens` integer
        - `output_tokens_total` integer
        - `reasoning_output_tokens` integer
        - `cache_read_input_tokens` integer
        - `cache_write_input_tokens` integer
      - `provider_metadata` object: Facts the provider reported about this call, keyed by provider (for example `openrouter.provider` names the upstream that served an OpenRouter request). Present only when the provider reported something.
      - `created_at` string, date-time, required
    - ToolResultEvent
      - `id` string, required
      - `org_id` string, required
      - `project_id` string, required: Project ID (proj_...).
      - `agent_id` string, required
      - `agent_profile_id` string, nullable, required
      - `parent_agent_id` string, nullable, required
      - `root_agent_id` string, required: The top-level agent in the emitting agent's tree. Equals agent_id for a top-level agent.
      - `turn_id` string, required
      - `turn_sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `is_opening_event` false, required
      - `sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `event_kind` 'tool_result', required
      - `tool_call_id` string, required
      - `outcome` 'succeeded' | 'failed' | 'denied' | 'canceled', required: Terminal outcome, present only when state is completed.
      - `content_blocks` ToolResultContentBlock[], required
        - union
          - TextContentBlock
            - `type` 'text', required: text: a plain-text block.
            - `text` string, required: Block text: the message in agent inputs, or text from the model or a tool in events.
            - `metadata` ContentBlockMetadata: Key-value metadata. omnara_ keys are reserved.
          - MediaRefContentBlock
            - `type` 'media_ref', required
            - `artifact_id` string, required
            - `exclude_from_model_context` boolean: Whether the referenced artifact is excluded from later model context.
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
          - StructuredDataContentBlock
            - `type` 'structured_data', required
            - `value` unknown, required
            - `metadata` ContentBlockMetadata: Arbitrary key-value labels. Keys beginning with `omnara_` are reserved for Omnara and may affect product behavior; use them only when intentionally invoking Omnara-defined behavior.
      - `created_at` string, date-time, required
    - ContextCheckpointEvent
      - `id` string, required
      - `org_id` string, required
      - `project_id` string, required: Project ID (proj_...).
      - `agent_id` string, required
      - `agent_profile_id` string, nullable, required
      - `parent_agent_id` string, nullable, required
      - `root_agent_id` string, required: The top-level agent in the emitting agent's tree. Equals agent_id for a top-level agent.
      - `turn_id` string, required
      - `turn_sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `is_opening_event` false, required
      - `sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `event_kind` 'context_checkpoint', required
      - `context_checkpoint_id` string, required
      - `summarized_through_event_sequence` integer, required: Positive per-agent event, turn, or live-frame sequence.
      - `summary` string, required
      - `created_at` string, date-time, required
  - `runtime_cancel_requested` boolean, required: Whether this request created or observed a durable runtime cancel request. Immediate delivery is best effort; runtime-lock renewal observes the durable request.
  - `affected` boolean, required: Whether this request changed any cancelable work.
  - `actor_id` string: Actor the cancelation was attributed to. Absent when the request had no actor attribution.

## Other responses

- `400`: The request was invalid.
- `401`: Authentication is required or invalid.
- `403`: The authenticated principal is not authorized.
- `404`: The requested resource was not found or is not visible.
- `409`: The request conflicts with current resource state or idempotency history.
- `503`: The service dependency required to satisfy the request is unavailable.
- `4XX`: Any other client error. The body carries the shared Error envelope restricted to client error codes; statuses with a dedicated response above are documented precisely.
- `5XX`: Any other server error. The body carries the shared Error envelope restricted to server error codes.

## Changes

- **2026-11-09** `4349dd4a98eb`: 12 info
  - added the required property `event/anyOf[#/components/schemas/AgentEvent]/oneOf[#/components/schemas/AgentInputEvent]/agent_profile_id` to the response with the `200` status
  - added the required property `event/anyOf[#/components/schemas/AgentEvent]/oneOf[#/components/schemas/AgentInputEvent]/parent_agent_id` to the response with the `200` status
  - added the required property `event/anyOf[#/components/schemas/AgentEvent]/oneOf[#/components/schemas/AgentInputEvent]/root_agent_id` to the response with the `200` status
  - added the required property `event/anyOf[#/components/schemas/AgentEvent]/oneOf[#/components/schemas/ContextCheckpointEvent]/agent_profile_id` to the response with the `200` status
  - …8 more
- **2026-10-05** `3d9e2cf46e07`: 159 info
  - added the optional property `current_digest` to the response with the `400` status
  - added the optional property `current_digest` to the response with the `401` status
  - added the optional property `current_digest` to the response with the `403` status
  - added the optional property `current_digest` to the response with the `404` status
  - …155 more
  - …this revision’s changelog is incomplete
- …earlier changes not shown

[Operation history](https://skmtc.dev/omnara/apis/omnara-api-2/changes/orgs/:orgID/projects/:projectID/agents/:agentID/cancel/post.md)

---

[API](https://skmtc.dev/omnara/apis/omnara-api-2.md) - [All operations](https://skmtc.dev/omnara/apis/omnara-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/omnara/apis/omnara-api-2/revisions/343aebb1dff1?raw)
