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

# List agents

> List all agents for the authenticated organization



## OpenAPI

````yaml get /agents
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /agents:
    get:
      tags:
        - Agents
      summary: List agents
      description: List all agents for the authenticated organization
      operationId: ListAgents
      parameters:
        - name: search
          in: query
          required: false
          description: >-
            Optional search string to filter agents by name. Case-insensitive
            partial match.
          schema:
            type: string
            maxLength: 255
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/after'
        - $ref: '#/components/parameters/before'
      responses:
        '200':
          description: List of agents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentListResponse'
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Datagrid from 'datagrid-ai';

            const client = new Datagrid({
              apiKey: process.env['DATAGRID_API_KEY'], // This is the default and can be omitted
            });

            // Automatically fetches more pages as needed.
            for await (const agent of client.agents.list()) {
              console.log(agent.id);
            }
        - lang: Python
          source: |-
            import os
            from datagrid_ai import Datagrid

            client = Datagrid(
                api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
            )
            page = client.agents.list()
            page = page.data[0]
            print(page.id)
components:
  parameters:
    limit:
      name: limit
      in: query
      schema:
        type: integer
        default: 50
        minimum: 1
        maximum: 100
      required: false
      description: The limit on the number of objects to return, ranging between 1 and 100.
    after:
      name: after
      in: query
      schema:
        type: string
      required: false
      description: >-
        A cursor to use in pagination. `after` is an object ID that defines your
        place in the list. For example, if you make a list request and receive
        100 objects, ending with `obj_foo`, your subsequent call can include
        `after=obj_foo` to fetch the next page of the list.
    before:
      name: before
      in: query
      schema:
        type: string
      required: false
      description: >-
        A cursor to use in pagination. `before` is an object ID that defines
        your place in the list. For example, if you make a list request and
        receive 100 objects, starting with `obj_bar`, your subsequent call can
        include `before=obj_bar` to fetch the previous page of the list.
  schemas:
    AgentListResponse:
      type: object
      required:
        - object
        - data
        - has_more
      properties:
        object:
          type: string
          enum:
            - list
          description: The object type, always 'list'
        data:
          type: array
          items:
            $ref: '#/components/schemas/Agent'
          description: Array of agent objects
        has_more:
          type: boolean
          description: Whether there are more results available
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
    Agent:
      allOf:
        - type: object
          required:
            - object
            - id
            - name
            - emoji
            - description
            - created_at
            - agent_model
            - llm_model
            - knowledge_ids
            - corpus
            - tools
            - mcp_servers
            - system_prompt
            - custom_prompt
            - planning_prompt
          properties:
            object:
              type: string
              enum:
                - agent
              description: The object type, always 'agent'
            id:
              type: string
              description: Unique identifier for the agent
            name:
              type: string
              description: The name of the agent
            emoji:
              type: string
              description: The emoji of the agent
              nullable: true
            description:
              type: string
              description: The description of the agent
              nullable: true
            created_at:
              type: string
              format: date-time
              description: The ISO string for when the agent was created
              nullable: false
        - $ref: '#/components/schemas/AgentConfig'
    AgentConfig:
      allOf:
        - $ref: '#/components/schemas/AgentConfigShared'
        - type: object
          properties:
            agent_model:
              $ref: '#/components/schemas/AgentModel'
              nullable: false
            llm_model:
              $ref: '#/components/schemas/LlmModel'
              nullable: false
            tools:
              type: array
              items:
                $ref: '#/components/schemas/Tool'
              description: Tools that this agent can use.
              nullable: false
            mcp_servers:
              type: array
              items:
                $ref: '#/components/schemas/AgentMcpServer'
              description: Registered MCP servers enabled for this agent.
              nullable: false
    AgentConfigShared:
      type: object
      properties:
        knowledge_ids:
          type: array
          nullable: true
          deprecated: true
          description: >-
            Deprecated, use corpus instead. Array of Knowledge IDs the agent
            should use during the converse. When omitted, all knowledge is used.
          items:
            type: string
        corpus:
          type: array
          nullable: true
          description: >-
            Array of corpus items the agent should use during the converse. When
            omitted, all knowledge is used.
          items:
            oneOf:
              - $ref: '#/components/schemas/CorpusKnowledgeItem'
              - $ref: '#/components/schemas/CorpusPageItem'
        system_prompt:
          type: string
          description: Directs your AI Agent's operational behavior.
          nullable: true
        custom_prompt:
          type: string
          description: >-
            Use custom prompt to instruct the style and formatting of the
            agent's response
          nullable: true
        planning_prompt:
          type: string
          description: >-
            Define the planning strategy your AI Agent should use when breaking
            down tasks and solving problems
          nullable: true
    AgentModel:
      anyOf:
        - $ref: '#/components/schemas/AgentModelEnum'
        - type: string
      type: string
      enum:
        - magpie-1.1
        - magpie-1.1-flash
        - magpie-2.0
        - magpie-2.5
        - magpie-2.5-flash
        - llm-only
      default: magpie-2.0
      description: >
        The agent model determines the processing mode for Converse requests.
        The Datagrid web app exposes **Ask**, **Extended**, and **Execute** as
        Converse **`chat_mode`** (`llm_router`, `light_agent`, `full_agent`).
        The values below set **`config.agent_model`** (model tier and tool
        limits)—use both fields when mirroring in-app behavior.


        **Execute** (full tool use, planning, and multi-step reasoning; aligns
        with **Execute** in the web app / `full_agent`):

        - `magpie-2.0` — Default. Full agent model with proactive planning and
        reasoning.

        - `magpie-2.5` — Beta. Latest full-agent model — faster, more adaptable,
        and built to handle a broader range of real-world tasks.

        - `magpie-1.1` — Previous-generation full agent model.


        **Extended** (search-focused; aligns with **Extended** in the web app /
        `light_agent`; not **Ask**):

        - `magpie-1.1-flash` — Fast model optimized for RAG use cases. Only
        supports the `semantic_search` tool. A 400 error will be returned if
        other tools are specified.


        **Direct LLM** (no tool execution; **`agent_model` only**—**Ask** in the
        web app is `chat_mode: llm_router`, not `magpie-1.1-flash`):

        - `llm-only` — Runs a direct LLM conversation with no planning or tool
        calls. A 400 error will be returned if tools are specified.


        Can also accept any custom string value for future model versions.
      nullable: true
    LlmModel:
      anyOf:
        - $ref: '#/components/schemas/LlmModelEnum'
        - type: string
      default: gemini-2.5-flash
      description: >-
        The LLM used to generate responses. Deprecated Gemini 2.0 Flash ids are
        accepted for backward compatibility and automatically run as
        gemini-3.1-flash-lite.
    Tool:
      type: object
      required:
        - name
      properties:
        name:
          $ref: '#/components/schemas/ToolName'
        connection_id:
          type: string
          description: The ID of the connection to use for the tool.
          nullable: true
    AgentMcpServer:
      type: object
      required:
        - object
        - server_id
        - name
        - base_url
        - status
        - credential_id
      properties:
        object:
          type: string
          enum:
            - agent_mcp_server
        server_id:
          type: string
        name:
          type: string
        base_url:
          type: string
          format: uri
        status:
          type: string
        tool_count:
          type: integer
        last_synced_at:
          type: string
          format: date-time
        credential_id:
          type: string
          nullable: true
    CorpusKnowledgeItem:
      type: object
      required:
        - type
        - knowledge_id
      properties:
        type:
          type: string
          enum:
            - knowledge
          description: The type of the corpus item. Always 'knowledge' for knowledge items.
          x-stainless-const: true
        knowledge_id:
          type: string
          description: The ID of the knowledge to include in the corpus.
    CorpusPageItem:
      type: object
      required:
        - type
        - page_id
      properties:
        type:
          type: string
          enum:
            - page
          description: The type of the corpus item. Always 'page' for page items.
          x-stainless-const: true
        page_id:
          type: string
          description: The ID of the page to include in the corpus.
    AgentModelEnum:
      type: string
      enum:
        - magpie-1.1
        - magpie-1.1-flash
        - magpie-2.0
        - magpie-2.5
        - magpie-2.5-flash
        - llm-only
      description: Predefined agent model versions
    LlmModelEnum:
      type: string
      description: >-
        The LLM used to generate responses. Deprecated Gemini 2.0 Flash ids are
        accepted for backward compatibility and automatically run as
        gemini-3.1-flash-lite.
      enum:
        - gemini-3.5-flash
        - gemini-3.1-flash-lite
        - gemini-3-pro-preview
        - gemini-3.1-pro-preview
        - gemini-3-flash-preview
        - gemini-2.5-pro
        - gemini-2.5-pro-preview-05-06
        - gemini-2.5-flash
        - gemini-2.5-flash-preview-04-17
        - gemini-2.5-flash-native-audio-preview-12-2025
        - gemini-2.5-flash-lite
        - gpt-5
        - gpt-5.1
        - gemini-2.0-flash-001
        - gemini-2.0-flash
        - gemini-1.5-pro-001
        - gemini-1.5-pro-002
        - gemini-1.5-flash-002
        - gemini-1.5-flash-001
        - chatgpt-4o-latest
        - gpt-4o
        - gpt-4
        - gpt-4-turbo
        - gpt-4o-mini
        - claude-haiku-4-5@20251001
        - claude-sonnet-4-6@default
        - claude-opus-4-6@default
        - claude-opus-4-7
        - claude-opus-4-8
        - anthropic.claude-haiku-4-5-20251001-v1:0
        - anthropic.claude-sonnet-4-6
        - anthropic.claude-opus-4-6-v1
        - anthropic.claude-opus-4-7
        - anthropic.claude-opus-4-8
    ToolName:
      type: string
      description: The unique identifier for a tool.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````