Spaces method and path for this operation:
Refer to Spaces for more information.
Returns paginated, per-conversation token consumption data for a given agent. Includes input/output token counts, round counts, LLM call counts, and warnings for conversations with high token usage. Requires the manageAgents privilege.
[Required authorization] Route required privileges: agentBuilder:manageAgents.
Body
-
Filter to conversations with or without high-token warnings.
-
Free-text search filter on conversation title.
-
Cursor for pagination. Pass the search_after value from the previous response.
Not more than
10000elements. -
Number of results per page.
Minimum value is
1, maximum value is100. Default value is25. -
Field to sort results by.
Values are
updated_at,total_tokens, orround_count. Default value isupdated_at. -
Sort direction.
Values are
ascordesc. Default value isdesc. -
Filter results to conversations by these usernames.
Not more than
10000elements.
curl \
-X POST "${KIBANA_URL}/api/agent_builder/agents/elastic-ai-agent/consumption" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "Content-Type: application/json" \
-H "elastic-api-version: 2023-10-31" \
-d '{"size": 25, "sort_field": "updated_at", "sort_order": "desc"}'
POST kbn://api/agent_builder/agents/elastic-ai-agent/consumption
{"size": 25, "sort_field": "updated_at", "sort_order": "desc"}
{
"size": 25,
"sort_field": "updated_at",
"sort_order": "desc"
}
{
"size": 10,
"usernames": [
"elastic",
"admin"
],
"sort_field": "total_tokens",
"sort_order": "desc",
"has_warnings": true
}
{
"total": 2,
"results": [
{
"user": {
"id": "uid-1",
"username": "elastic"
},
"title": "Help me search my data",
"warnings": [],
"llm_calls": 8,
"created_at": "2025-03-01T10:00:00Z",
"updated_at": "2025-03-01T10:15:00Z",
"round_count": 5,
"token_usage": {
"input_tokens": 15000,
"total_tokens": 18000,
"output_tokens": 3000
},
"conversation_id": "conv-abc123"
},
{
"user": {
"id": "uid-2",
"username": "admin"
},
"title": "Analyze server logs",
"warnings": [
{
"type": "high_input_tokens",
"round_id": "round-7",
"input_tokens": 250000
}
],
"llm_calls": 20,
"created_at": "2025-03-02T14:00:00Z",
"updated_at": "2025-03-02T14:30:00Z",
"round_count": 12,
"token_usage": {
"input_tokens": 250000,
"total_tokens": 258000,
"output_tokens": 8000
},
"conversation_id": "conv-def456"
}
],
"aggregations": {
"usernames": [
"elastic",
"admin"
],
"total_with_warnings": 0
},
"search_after": [
1709391000000,
"2025-03-02T14:30:00Z"
]
}