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

# Get Next Task

> Iterate through tasks based on filters. Useful for task queue processing and navigation.



## OpenAPI

````yaml get /agent-tasks/iterate
openapi: 3.0.0
info:
  title: Public API
  description: Public endpoints to interact with agents and orchestrate tasks
  version: '1.0'
  contact: {}
servers:
  - url: https://api.beamstudio.ai
security: []
tags: []
paths:
  /agent-tasks/iterate:
    get:
      tags:
        - Agent Task
      summary: Get Next Task
      description: >-
        Iterate through tasks based on filters. Useful for task queue processing
        and navigation.
      operationId: AgentTaskController_getNextTask
      parameters:
        - name: agentId
          required: false
          in: query
          schema:
            type: string
        - name: taskId
          required: false
          in: query
          schema:
            type: string
        - name: statuses
          required: false
          in: query
          schema:
            type: string
        - name: searchQuery
          required: false
          in: query
          schema:
            type: string
        - name: createdAt
          required: false
          in: query
          schema:
            type: string
        - name: updatedAt
          required: false
          in: query
          schema:
            type: string
        - name: grouping
          required: false
          in: query
          schema:
            enum:
              - status
              - agent
            type: string
        - name: current-workspace-id
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Next task retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NavigationResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    NavigationResponseDto:
      type: object
      properties:
        previous:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/NavigationNode'
        next:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/NavigationNode'
      required:
        - previous
        - next
    NavigationNode:
      type: object
      properties:
        id:
          type: string
        agentGraph:
          $ref: '#/components/schemas/IterateGraphResponseDto'
      required:
        - id
        - agentGraph
    IterateGraphResponseDto:
      type: object
      properties:
        agentId:
          type: string
      required:
        - agentId
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````