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

# List Agent Sessions

> List all sessions. Optionally filter by agent_id or status.

Required scope: `agent_sessions:read`, `agent_sessions:all`, or `all:all`



## OpenAPI

````yaml api-reference/openapi.json get /api/v1/agent-sessions
openapi: 3.0.0
info:
  title: OpenSink API
  description: API documentation for OpenSink
  version: 1.0.0
servers:
  - url: https://api.opensink.com
    description: Production Server
security:
  - bearerAuth: []
tags:
  - name: Sink
    description: Sink management endpoints
  - name: Sink Item
    description: Sink item endpoints
  - name: Cron Job
    description: Cron job scheduling endpoints
  - name: Cron Job Run
    description: Cron job execution history
  - name: Agent
    description: Agent management endpoints
  - name: Agent Config
    description: Agent configuration endpoints
  - name: Agent Session
    description: Agent session endpoints
  - name: Agent Session Input Request
    description: Agent session input request endpoints
  - name: Agent Session Activity
    description: Agent session activity log endpoints
paths:
  /api/v1/agent-sessions:
    get:
      tags:
        - Agent Session
      summary: List Agent Sessions
      description: >-
        List all sessions. Optionally filter by agent_id or status.


        Required scope: `agent_sessions:read`, `agent_sessions:all`, or
        `all:all`
      operationId: listAgentSessions
      parameters:
        - schema:
            type: string
            format: uuid
          in: query
          name: agent_id
          required: false
          description: Filter by agent ID
        - schema:
            type: string
            enum:
              - running
              - waiting_for_input
              - processing_input
              - completed
              - failed
          in: query
          name: status
          required: false
          description: Filter by status
        - schema:
            type: array
            items:
              type: string
              enum:
                - running
                - waiting_for_input
                - processing_input
                - completed
                - failed
          in: query
          name: status_in
          required: false
          description: Filter by multiple statuses
        - schema:
            type: number
          in: query
          name: $limit
          required: false
          description: 'Maximum items to return (default: 50, max: 100)'
        - schema:
            type: string
          in: query
          name: $trail
          required: false
          description: Pagination trail from previous response
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      description: An agent execution session
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Unique identifier
                        agent_id:
                          type: string
                          format: uuid
                          description: Parent agent ID
                        workspace_id:
                          type: string
                          format: uuid
                          description: Workspace ID
                        status:
                          type: string
                          enum:
                            - running
                            - waiting_for_input
                            - processing_input
                            - completed
                            - failed
                          description: Session status
                        state:
                          type: object
                          additionalProperties: true
                          description: Session state data
                        metadata:
                          type: object
                          additionalProperties: true
                          description: Session metadata
                        error_message:
                          type: string
                          nullable: true
                          description: Error message if session failed
                        created_at:
                          type: string
                          format: date-time
                          description: Creation timestamp
                        updated_at:
                          type: string
                          format: date-time
                          description: Last update timestamp
                  trail:
                    type: string
                    nullable: true
                    description: Pagination trail for next page
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Unauthorized
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Insufficient permissions
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication

````