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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Direct Query API (POST /query) with the Newton Fusion model (text, image, and video reasoning) or the Newton Omega encoder (time-series embeddings). ATAI_API_ENDPOINT must include the version path: /v0.5 for most APIs, /v0.6 for the Fine-Tuning Service. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# List Agents

> Page through agent runs, filtered by status, bundle, or blueprint

<Callout icon="clock" color="#3064E3" iconType="solid">
  Requires [version 1.1.9](/release-notes/1.1.x#v1-1-9) or later of the Archetype platform.
</Callout>

## Overview

This endpoint returns a cursor-paginated page of agents (bundle runs), newest first.

An agent exists only as a run, so lifecycle status lives on the agent itself. Filter by status, by the bundle a run came from, or by the blueprint that bundle pinned.

## Request

<ParamField query="limit" type="integer" default="100">
  Page size. Minimum `1`, maximum `1000`.
</ParamField>

<ParamField query="after" type="string">
  Forward cursor: return agents older than the one with this id. Pass the `next_cursor` of the previous page (or the id of its last agent) to fetch the next page. Mutually exclusive with `before`.
</ParamField>

<ParamField query="before" type="string">
  Backward cursor: return agents newer than the one with this id. Pass the id of the first agent of the current page to walk back. Mutually exclusive with `after`.
</ParamField>

<ParamField query="status" type="string">
  Filter to a single lifecycle status (e.g. `running`). Omit for all statuses. One of `running`, `paused`, `completed`, `failed`, `canceled`.
</ParamField>

<ParamField query="query" type="string">
  Case-insensitive substring match over the agent name, id, bundle id, and blueprint key. Omit for no search filter.
</ParamField>

<ParamField query="bundle_id" type="string">
  Restrict to runs of this bundle (`bnd_` id, exact match).
</ParamField>

<ParamField query="blueprint_id" type="string">
  Restrict to runs whose bundle pins this blueprint (`blp_` id, exact match).
</ParamField>

## Response

<ResponseField name="data" type="array" required>
  The page, newest first. Each entry is an agent.
</ResponseField>

<ResponseField name="has_more" type="boolean" required>
  True when more results exist beyond this page in the direction of travel.
</ResponseField>

<ResponseField name="next_cursor" type="string">
  Cursor for the next page in the same direction — pass it as `after` when paging forward, or as `before` when you supplied `before`. `null` when `has_more` is false.
</ResponseField>

### Agent object

<ResponseField name="id" type="string" required>
  TypeID-encoded agent identifier (`agt_` prefix).
</ResponseField>

<ResponseField name="name" type="string" required>
  Name of the agent (a run's name is its bundle's name).
</ResponseField>

<ResponseField name="org_id" type="string" required>
  Organization identifier the agent belongs to.
</ResponseField>

<ResponseField name="bundle_id" type="string" required>
  The bundle this agent was run from (provenance).
</ResponseField>

<ResponseField name="blueprint" type="string" required>
  Human-readable pinned blueprint reference (its key), e.g. `osm`.
</ResponseField>

<ResponseField name="blueprint_id" type="string" required>
  Immutable blueprint id the bundle pinned.
</ResponseField>

<ResponseField name="status" type="string" required>
  Agent lifecycle status: `running`, `paused`, `completed`, `failed`, or `canceled`.
</ResponseField>

<ResponseField name="created_at" type="string" required>
  Creation timestamp (date-time).
</ResponseField>

<ResponseField name="connectors" type="object">
  The I/O binding this run was started with; `null` when none is recorded.
</ResponseField>

<ResponseField name="job_id" type="string">
  External executor's job id for the current run (a JOS `job_` id). Present once the run has been dispatched; lets clients query JOS for run progress.
</ResponseField>

<ResponseField name="started_at" type="string">
  When the run started; `null` before then.
</ResponseField>

<ResponseField name="completed_at" type="string">
  When the run finished; `null` while unfinished.
</ResponseField>

<ResponseField name="error" type="string">
  Failure detail; `null` unless the run failed.
</ResponseField>

<RequestExample>
  ```bash cURL - First Page theme={"system"}
  curl "$ATAI_API_URL/agents/instances?limit=20" \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```bash cURL - Running Only theme={"system"}
  curl "$ATAI_API_URL/agents/instances?status=running" \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```bash cURL - Runs Of One Bundle theme={"system"}
  curl "$ATAI_API_URL/agents/instances?bundle_id=bnd_01jc9pd42kzq7v8n3h5m6rtx0w" \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```python Python theme={"system"}
  import os
  import requests

  base_url = os.environ["ATAI_API_URL"]
  api_key = os.environ["ATAI_API_KEY"]
  headers = {"Authorization": f"Bearer {api_key}"}

  cursor = None
  while True:
      params = {"limit": 100, "status": "running"}
      if cursor:
          params["after"] = cursor

      response = requests.get(f"{base_url}/agents/instances", headers=headers, params=params)
      page = response.json()

      for agent in page["data"]:
          print(f"{agent['id']} {agent['name']} [{agent['status']}] blueprint={agent['blueprint']}")

      if not page["has_more"]:
          break
      cursor = page["next_cursor"]
  ```

  ```javascript JavaScript theme={"system"}
  const params = new URLSearchParams({ limit: '20', status: 'running' });

  const response = await fetch(
    `${process.env.ATAI_API_URL}/agents/instances?${params}`,
    {
      headers: {
        'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
      }
    }
  );

  const page = await response.json();

  page.data.forEach(agent => {
    console.log(`${agent.id} ${agent.name} [${agent.status}] blueprint=${agent.blueprint}`);
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={"system"}
  {
    "data": [
      {
        "id": "agt_01jc9q8v5nm3ry7t2bkz4dhs6f",
        "name": "Pump A monitor",
        "org_id": "org_01jc8m5r2vq9xt4bn7h3kdzs6w",
        "bundle_id": "bnd_01jc9pd42kzq7v8n3h5m6rtx0w",
        "blueprint": "osm",
        "blueprint_id": "blp_01jc9n7k3xf8mbq2v5t0ary6de",
        "connectors": {
          "source": [
            {"type": "file", "id": "file_abc123", "format": "csv"}
          ],
          "sink": null
        },
        "status": "running",
        "job_id": "job_01jc9q9k4t8v2mnr5xh7bdzy3s",
        "created_at": "2026-08-11T15:10:00Z",
        "started_at": "2026-08-11T15:10:04Z",
        "completed_at": null,
        "error": null
      }
    ],
    "has_more": true,
    "next_cursor": "agt_01jc9q8v5nm3ry7t2bkz4dhs6f"
  }
  ```

  ```json 200 - Empty page theme={"system"}
  {
    "data": [],
    "has_more": false,
    "next_cursor": null
  }
  ```
</ResponseExample>

## Important Notes

<Note>
  * `after` and `before` are mutually exclusive — send at most one of them.
  * Results are ordered newest first in both cursor directions, so render `data` as returned.
  * `query` matches the agent name, id, bundle id, and blueprint key; `bundle_id` and `blueprint_id` are exact-match filters.
</Note>
