---
title: "Query agent instances"
method: GET
path: "/agent-runtime/agent-instances"
tags: ["Agent Instances"]
---

# Query agent instances

`GET /agent-runtime/agent-instances`

## Request

- Base URL: `http://localhost:8090/agent-api`
- URL: `http://localhost:8090/agent-api/agent-runtime/agent-instances`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/flowable/apis/flowable-agent-engine-rest-api/docs/agent-runtime/agent-instances/get.ts> (a function with typed inputs; its response is checked against the schema)

## Query parameters

- `agentDefinitionId` string
- `agentDefinitionKey` string
- `id` string
- `order` string
- `referenceId` string
- `referenceType` string
- `size` integer
- `sort` string
- `start` integer
- `startUserId` string
- `tenantId` string
- `tenantIdLike` string

## Response `200`

Indicates the request was successful.

- DataResponseAgentInstanceResponse
  - `data` AgentInstanceResponse[]
    - `id` string, required: The unique identifier of an agent instance
    - `agentDefinitionId` string, required: The id of the agent definition that was used to start the agent instance.
    - `agentDefinitionKey` string, required: The key of the agent definition that was used to start the agent instance.
    - `agentDefinitionName` string, required: The name of the agent definition that was used to start the agent instance.
    - `referenceId` string: The id of the CMMN or BPMN model backing the agent instance behavior.
    - `referenceType` string: The type of the model that backs the agent instance behavior (e.g. CMMN or BPMN).
    - `callbackId` string: The id of the CMMN or BPMN instance that should be called back when the agent is done.
    - `callbackType` string: The type of the callback (e.g. CMMN or BPMN).
    - `callbackScopeId` string: The callback scope id for this agent instance.
    - `startTime` integer, required: The time the instance was started.
    - `startUserId` string: The user that started the agent instance.
    - `tenantId` string: The tenant id of the instance
    - `jsonInvocationResult` JsonNode
      - `string` boolean
      - `valueNode` boolean
      - `missingNode` boolean
      - `short` boolean
      - `double` boolean
      - `bigDecimal` boolean
      - `bigInteger` boolean
      - `textual` boolean
      - `boolean` boolean
      - `container` boolean
      - `object` boolean
      - `binary` boolean
      - `number` boolean
      - `nodeType` 'ARRAY' | 'BINARY' | 'BOOLEAN' | 'MISSING' | 'NULL' | 'NUMBER' | 'OBJECT' | 'POJO' | 'STRING'
      - `long` boolean
      - `pojo` boolean
      - `int` boolean
      - `integralNumber` boolean
      - `floatingPointNumber` boolean
      - `array` boolean
      - `empty` boolean
      - boolean
      - `float` boolean
      - `embeddedValue` boolean
    - `plainTextInvocationResult` string
    - `durationMs` integer: Wall-clock duration of the invocation in milliseconds.
    - `promptTokenCount` integer: Aggregated prompt tokens used by the invocation.
    - `outputTokenCount` integer: Aggregated output tokens produced by the invocation.
    - `executionTrace` AgentInstanceTimelineResponse: Complete timeline view of an agent instance with all its invocations, exchanges and parts
      - `id` string, required: The unique identifier of the agent instance
      - `definitionId` string, required: The ID of the agent definition that was used to start this instance
      - `definitionName` string: The name of the agent definition
      - `definitionKey` string: The key of the agent definition
      - `invocations` AgentInvocationTimelineResponse[]: List of all invocations that occurred within this agent instance
        - `id` string, required: The unique identifier of the invocation
        - `startTime` integer: The time when the invocation started
        - `endTime` integer: The time when the invocation ended
        - `operationKey` string: The key of the operation that was invoked
        - `promptTokenCount` integer: The number of prompt tokens consumed during this invocation
        - `outputTokenCount` integer: The number of output tokens generated during this invocation
        - `exchanges` AgentExchangeTimelineResponse[]: List of all exchanges that occurred during this invocation
          - `id` string, required: The unique identifier of the exchange
          - `startTime` integer: The time when the exchange started
          - `endTime` integer: The time when the exchange ended
          - `duration` Duration
            - `seconds` integer
            - `zero` boolean
            - `nano` integer
            - `negative` boolean
            - `positive` boolean
            - `units` TemporalUnit[]
              - …
          - `type` 'user' | 'assistant' | 'tool' | 'chatModel', required: The type of the exchange
          - `subType` string, required: The sub-type providing additional context based on the type (e.g., tool name, model name)
          - `userId` string: The ID of the user who initiated the exchange
          - `promptTokenCount` integer: The number of prompt tokens consumed during this exchange
          - `outputTokenCount` integer: The number of output tokens generated during this exchange
          - `transactionOrder` integer: The sequence number of this exchange within the invocation
          - `parts` AgentExchangePartTimelineResponse[]: List of all parts that make up this exchange
            - `id` string, required: The unique identifier of the exchange part
            - `type` 'input' | 'output' | 'toolInput' | 'toolOutput', required: The type of the part
            - `subType` 'request' | 'response' | 'technical' | 'system' | 'toolCall' | 'arguments': The sub-type providing additional context based on the type
            - `content` string: The content of the part, which can be a string or JSON object depending on the type
            - `invocationSequence` integer: The sequence number of this part within the invocation
  - `total` integer
  - `start` integer
  - `sort` string
  - `order` string
  - `size` integer

## Other responses

- `400`: Indicates the request had some invalid arguments.

---

[API](https://skmtc.dev/flowable/apis/flowable-agent-engine-rest-api.md) - [All operations](https://skmtc.dev/flowable/apis/flowable-agent-engine-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flowable/apis/flowable-agent-engine-rest-api/revisions/54fc1189496f?raw)
