> ## 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 to finish

> Wait for an execution that is already running to finish, up to timeoutSeconds.
Returns 200 with the result once the execution completes, fails or is cancelled.
Returns 202 when it has not finished in time, or when it is paused or awaiting
confirmation. 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: Admin Customer Activity
  - name: Reference
  - name: Workflow Tags
  - name: Secrets
  - name: Vault
  - 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 to finish
      description: >-
        Wait for an execution that is already running to finish, up to
        timeoutSeconds.

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

        Returns 202 when it has not finished in time, or when it is paused or
        awaiting

        confirmation. 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 the execution to finish 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:
        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.
        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
      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.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.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.