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

# Wait for an execution's status to change

> Wait up to timeoutSeconds for an execution's status to change.
Returns 200 with the result once the execution completes, fails or is cancelled.
Returns 202 as soon as its status differs from the one it had when the call began,
at once when it is paused, paused_by_agent or awaiting_confirmation, and otherwise
when timeoutSeconds passes. returnReason says which. On awaiting_confirmation, awaitingConfirmation names
the node the execution holds at. Call it again to keep waiting.



## OpenAPI

````yaml https://odyssey.asteroid.ai/agents/v2/openapi.yaml get /agents/v2/executions/{executionId}/sync
openapi: 3.1.0
info:
  title: Agent Service
  version: v1
servers:
  - url: https://odyssey.asteroid.ai
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
  - name: Environments
  - name: Schedules
  - name: Execution
  - name: Files
  - name: Profiles
  - name: Profile Groups
  - name: Agent Profiles
  - name: Agent Profile Pools
  - name: Workflows
  - name: Execution Batches
  - name: Scheduled Executions
  - name: Schema
  - name: Documentation
  - name: Context
  - name: API Keys
  - name: Integrations
  - name: Billing
  - name: Admin Customer Activity
  - name: Reference
  - name: Workflow Tags
  - name: Secrets
  - name: Vault
  - name: Catalog
  - name: Chats
  - name: Insights
  - name: Portal Skills
  - name: Skills
  - name: Workflow Versions
paths:
  /agents/v2/executions/{executionId}/sync:
    get:
      tags:
        - Execution
      summary: Wait for an execution's status to change
      description: >-
        Wait up to timeoutSeconds for an execution's status to change.

        Returns 200 with the result once the execution completes, fails or is
        cancelled.

        Returns 202 as soon as its status differs from the one it had when the
        call began,

        at once when it is paused, paused_by_agent or awaiting_confirmation, and
        otherwise

        when timeoutSeconds passes. returnReason says which. On
        awaiting_confirmation, awaitingConfirmation names

        the node the execution holds at. Call it again to keep waiting.
      operationId: ExecutionSync_get
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            $ref: '#/components/schemas/Common.uuid'
        - description: Seconds to wait for a change before returning 202. Defaults to 25.
          explode: false
          in: query
          name: timeoutSeconds
          schema:
            format: int32
            maximum: 25
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agents.Agent.ExecuteAgentSyncResponse'
          description: The request has succeeded.
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agents.Agent.ExecuteAgentSyncResponse'
          description: >-
            The request has been accepted for processing, but processing has not
            yet completed.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Common.Error'
          description: An unexpected error response.
components:
  schemas:
    Common.uuid:
      format: uuid
      type: string
    Agents.Agent.ExecuteAgentSyncResponse:
      properties:
        awaitingConfirmation:
          allOf:
            - $ref: '#/components/schemas/Agents.Agent.ConfirmationHold'
          description: >-
            Present when status is awaiting_confirmation: the node the execution
            holds at. Resume the execution to approve it.
        executionId:
          $ref: '#/components/schemas/Common.uuid'
        executionResult:
          allOf:
            - $ref: '#/components/schemas/Agents.Execution.ExecutionResult'
          description: >-
            Outcome, reasoning and result data. Present on 200 when the
            execution recorded a result.
        returnReason:
          allOf:
            - $ref: '#/components/schemas/Agents.Agent.SyncReturnReason'
          description: >-
            Why the call returned. After status_change or timed_out, follow the
            execution with GET /executions/{executionId}/sync. Never repeat an
            execute call: it starts another execution.
        status:
          allOf:
            - $ref: '#/components/schemas/Agents.Execution.Status'
          description: >-
            The execution's status when the call returned: terminal on 200, the
            current status on 202
      required:
        - executionId
        - status
        - returnReason
      type: object
    Common.Error:
      properties:
        code:
          format: int32
          type: integer
        detail:
          description: Explanation of this occurrence. Same text as message
          type: string
        errors:
          description: The parameters that failed validation, when known
          items:
            $ref: '#/components/schemas/Common.FieldError'
          type: array
        instance:
          description: The request path that produced the problem
          type: string
        message:
          type: string
        status:
          format: int32
          type: integer
        title:
          description: Short summary of the problem type
          type: string
        type:
          description: >-
            A URI that identifies the problem type. about:blank when the status
            says it all
          type: string
      required:
        - code
        - message
      type: object
    Agents.Agent.ConfirmationHold:
      description: The node an execution awaiting confirmation holds at
      properties:
        nodeId:
          $ref: '#/components/schemas/Common.uuid'
        nodeName:
          type: string
      required:
        - nodeId
        - nodeName
      type: object
    Agents.Execution.ExecutionResult:
      description: Execution result containing outcome, reasoning, and result data
      properties:
        createdAt:
          format: date-time
          type: string
        executionId:
          $ref: '#/components/schemas/Common.uuid'
        id:
          $ref: '#/components/schemas/Common.uuid'
        outcome:
          description: Outcome of the execution (success or failure)
          type: string
        reasoning:
          type: string
        result: {}
      required:
        - id
        - executionId
        - outcome
        - reasoning
        - result
        - createdAt
      type: object
    Agents.Agent.SyncReturnReason:
      description: >-
        Why a wait call returned. ended: the execution completed, failed or was
        cancelled.

        needs_person: it is paused, paused_by_agent or awaiting_confirmation and
        will not

        continue without a person.

        status_change: its status changed from the one it had when the call
        began.

        timed_out: the call stopped waiting before anything changed, normally
        because

        timeoutSeconds passed.
      enum:
        - ended
        - needs_person
        - status_change
        - timed_out
      type: string
    Agents.Execution.Status:
      enum:
        - queued
        - starting
        - running
        - paused
        - awaiting_confirmation
        - completed
        - cancelled
        - failed
        - paused_by_agent
      type: string
    Common.FieldError:
      description: A problem with one request parameter
      properties:
        detail:
          description: What is wrong with it
          type: string
        parameter:
          description: The query or path parameter name
          type: string
      required:
        - parameter
        - detail
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: X-Api-Key
      type: apiKey

````

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