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

# Join Run

> Wait for a run to complete and return its output.

Returns a chunked ``application/json`` response. While the run is still
executing, the server sends periodic ``\n`` heartbeat bytes to keep the
connection alive through proxies and load balancers (AWS ALB, Cloudflare,
etc.). The final chunk is the JSON result. Leading whitespace is ignored
by JSON parsers, so clients can parse the concatenated body normally.

If the run is already in a terminal state, the output is returned
immediately with no heartbeat overhead.

Sessions are managed manually (not via ``Depends``) to avoid holding a
pool connection during the long wait.



## OpenAPI

````yaml /openapi.json get /threads/{thread_id}/runs/{run_id}/join
openapi: 3.1.0
info:
  title: Aegra
  description: Production-ready Agent Protocol server
  version: 0.9.24
servers: []
security: []
tags:
  - name: Assistants
    description: A configured instance of a graph.
  - name: Threads
    description: Accumulated state and outputs from a group of runs.
  - name: Thread Runs
    description: Invoke a graph on a thread, updating its persistent state.
  - name: Stateless Runs
    description: Invoke a graph without state or memory persistence.
  - name: Crons
    description: Scheduled recurring runs on a cron schedule.
  - name: Store
    description: Persistent key-value and semantic storage available from any thread.
  - name: Event Streaming
    description: Agent Protocol v2 thread event streaming and commands.
  - name: Health
    description: Server health checks and service information.
paths:
  /threads/{thread_id}/runs/{run_id}/join:
    get:
      tags:
        - Thread Runs
      summary: Join Run
      description: >-
        Wait for a run to complete and return its output.


        Returns a chunked ``application/json`` response. While the run is still

        executing, the server sends periodic ``\n`` heartbeat bytes to keep the

        connection alive through proxies and load balancers (AWS ALB,
        Cloudflare,

        etc.). The final chunk is the JSON result. Leading whitespace is ignored

        by JSON parsers, so clients can parse the concatenated body normally.


        If the run is already in a terminal state, the output is returned

        immediately with no heartbeat overhead.


        Sessions are managed manually (not via ``Depends``) to avoid holding a

        pool connection during the long wait.
      operationId: join_run_threads__thread_id__runs__run_id__join_get
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
            title: Thread Id
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentProtocolError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentProtocolError:
      properties:
        error:
          type: string
          title: Error
          description: Error type
        message:
          type: string
          title: Message
          description: Human-readable error message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Additional error details
      type: object
      required:
        - error
        - message
      title: AgentProtocolError
      description: Standard Agent Protocol error response
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````