---
title: "Query agent invocations"
method: GET
path: "/agent-history/agent-invocations"
tags: ["Agent Invocations"]
---

# Query agent invocations

`GET /agent-history/agent-invocations`

## Request

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

## Query parameters

- `agentInstanceId` string
- `finished` boolean
- `id` string
- `operationKey` string
- `order` string
- `size` integer
- `sort` string
- `start` integer
- `tenantId` string
- `userId` string

## Response `200`

Indicates the request was successful.

- DataResponseAgentInvocationResponse
  - `data` AgentInvocationResponse[]
    - `id` string, required: The unique identifier for the agent invocation.
    - `agentInstanceId` string, required: The identifier for the correlating agent instance.
    - `agentDefinitionId` string: The identifier for the agent definition.
    - `agentDefinitionKey` string: The key of the agent definition.
    - `operationKey` string, required: The key of the operation that the invocation belongs to
    - `startTime` integer, required: The time when the invocation was started
    - `endTime` integer: The time when the invocation was ended
    - `duration` Duration
      - `seconds` integer
      - `zero` boolean
      - `nano` integer
      - `negative` boolean
      - `positive` boolean
      - `units` TemporalUnit[]
        - `durationEstimated` boolean
        - `duration` Duration (recursive)
        - `timeBased` boolean
        - `dateBased` boolean
    - `userId` string: The id of the user that triggered the invocation
    - `promptTokenCount` integer: The amount of tokens used for the prompt
    - `outputTokenCount` integer: The amount of tokens used for the output
    - `cachedTokenCount` integer: The amount of cached tokens used for the prompt
  - `total` integer
  - `start` integer
  - `sort` string
  - `order` string
  - `size` integer

## Other responses

- `400`: Indicates the request had some invalid arguments.
- `403`: Indicates that the user does not have access to the query agent invocations.

---

[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)
