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

# Update State



## OpenAPI

````yaml openapi.json PUT /states/{state_id}
openapi: 3.1.0
info:
  title: Sb0 API
  version: 0.1.0
servers: []
security: []
paths:
  /states/{state_id}:
    put:
      tags:
        - States
      summary: Update Task State
      operationId: states_update
      parameters:
        - in: path
          name: state_id
          required: true
          schema:
            title: State Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateStateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/State'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    UpdateStateRequest:
      properties:
        agent_id:
          title: The unique id of the agent to update the state of
          type: string
        state:
          additionalProperties: true
          title: The state to update the state with.
          type: object
        task_id:
          title: The unique id of the task to update the state of
          type: string
      required:
        - task_id
        - agent_id
        - state
      title: UpdateStateRequest
      type: object
    State:
      description: >-
        Represents a state in the agent system. A state is associated uniquely
        with a task and an agent.


        This entity is used to store states in MongoDB, with each state

        associated with a specific task and agent. The combination of task_id
        and agent_id is globally unique.


        The state is a dictionary of arbitrary data.
      properties:
        agent_id:
          title: The unique id of the agent to send the state to
          type: string
        created_at:
          description: The timestamp when the state was created
          format: date-time
          title: Created At
          type: string
        id:
          description: The task state's unique id
          title: Id
          type: string
        state:
          additionalProperties: true
          title: The state to send to the task.
          type: object
        task_id:
          title: The unique id of the task to send the state to
          type: string
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: The timestamp when the state was last updated
          title: Updated At
      required:
        - task_id
        - agent_id
        - state
        - id
        - created_at
      title: State
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object

````