> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracecat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Control Session

> Steer, withdraw from, or cancel the active turn without waiting for it.



## OpenAPI

````yaml https://platform.tracecat.com/api/openapi.json post /workspaces/{workspace_id}/agent/sessions/{session_id}/control
openapi: 3.1.0
info:
  title: Tracecat API
  summary: Tracecat API
  description: The open source AI automation platform for security teams and agents.
  termsOfService: >-
    https://docs.google.com/document/d/e/2PACX-1vQvDe3SoVAPoQc51MgfGCP71IqFYX_rMVEde8zC4qmBCec5f8PLKQRdxa6tsUABT8gWAR9J-EVs2CrQ/pub
  contact:
    name: Tracecat Founders
    email: founders@tracecat.com
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1'
servers:
  - url: /api
security: []
tags:
  - name: public
    description: Public facing endpoints
  - name: workflows
    description: Workflow management
  - name: actions
    description: Action management
  - name: triggers
    description: Workflow triggers
  - name: secrets
    description: Secret management
  - name: variables
    description: Workspace variable management
paths:
  /workspaces/{workspace_id}/agent/sessions/{session_id}/control:
    post:
      tags:
        - agent-sessions
      summary: Control Session
      description: Steer, withdraw from, or cancel the active turn without waiting for it.
      operationId: agent-sessions-control_session
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Session Id
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentControlRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentControlReceipt'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyCookie: []
        - ServiceAccountApiKeyBearer: []
components:
  schemas:
    AgentControlRequest:
      oneOf:
        - $ref: '#/components/schemas/AgentSteerControl'
        - $ref: '#/components/schemas/AgentWithdrawControl'
        - $ref: '#/components/schemas/AgentCancelControl'
      discriminator:
        propertyName: type
        mapping:
          cancel: '#/components/schemas/AgentCancelControl'
          steer: '#/components/schemas/AgentSteerControl'
          withdraw: '#/components/schemas/AgentWithdrawControl'
    AgentControlReceipt:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        type:
          $ref: '#/components/schemas/AgentControlType'
        run_id:
          type: string
          format: uuid
          title: Run Id
        status:
          $ref: '#/components/schemas/AgentControlStatus'
        withdrawn:
          items:
            type: string
            format: uuid
          type: array
          title: Withdrawn
          description: Withdrawn message IDs in send order; set only for `withdraw`
        too_late:
          items:
            type: string
            format: uuid
          type: array
          title: Too Late
          description: >-
            Message IDs the model already read, which stay in the transcript;
            set only for `withdraw`
      type: object
      required:
        - id
        - type
        - run_id
        - status
      title: AgentControlReceipt
      description: The running turn's outcome for a control request.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentSteerControl:
      properties:
        type:
          type: string
          const: steer
          title: Type
        id:
          type: string
          format: uuid
          title: Id
          description: >-
            Client-generated message ID. It reaches at most one turn of the
            session; a retry returns the first outcome.
        text:
          type: string
          maxLength: 100000
          minLength: 1
          title: Text
      type: object
      required:
        - type
        - id
        - text
      title: AgentSteerControl
      description: A message for the running turn to take into account before it answers.
    AgentWithdrawControl:
      properties:
        type:
          type: string
          const: withdraw
          title: Type
        id:
          type: string
          format: uuid
          title: Id
          description: Client-generated request ID; a retry returns the first outcome
        target_ids:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Target Ids
          description: >-
            Message IDs to withdraw. Null withdraws all of the session's pending
            steers and queued messages.
      type: object
      required:
        - type
        - id
      title: AgentWithdrawControl
      description: Take back pending user messages the model has not read yet.
    AgentCancelControl:
      properties:
        type:
          type: string
          const: cancel
          title: Type
        id:
          type: string
          format: uuid
          title: Id
          description: Client-generated request ID
      type: object
      required:
        - type
        - id
      title: AgentCancelControl
      description: Cancel the running turn.
    AgentControlType:
      type: string
      enum:
        - steer
        - withdraw
        - cancel
    AgentControlStatus:
      type: string
      enum:
        - accepted
        - rejected
        - withdrawn
        - too_late
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: fastapiusersauth
    ServiceAccountApiKeyBearer:
      type: http
      description: Tracecat service account API key.
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.