Skip to content

Commit cf63f30

Browse files
ROB-1707 Holmes Chat API docs: match start_tool_calling and token_count payloads (#2209)
* ROB-1707 Holmes Chat API docs: match start_tool_calling and token_count payloads start_tool_calling carries `id` and `tool_name`; the description arrives on tool_calling_result. token_count carries `metadata`. The streaming example now raises on an HTTP error instead of printing nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2KwgqX5jRzJiSCctf2GZd * ROB-1707 Document every token_count field the example shows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2KwgqX5jRzJiSCctf2GZd --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a254278 commit cf63f30

1 file changed

Lines changed: 39 additions & 17 deletions

File tree

‎docs/configuration/holmesgpt/holmes-chat-api.rst‎

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Events are delivered in order as the investigation progresses. A typical stream
246246
.. code-block:: text
247247
248248
event: start_tool_calling
249-
data: {"tool_call_id": "call_1", "tool_name": "kubectl_find_resource", "description": "Looking up failing pods"}
249+
data: {"tool_name": "kubectl_find_resource", "id": "call_1"}
250250
251251
event: tool_calling_result
252252
data: {"tool_call_id": "call_1", "name": "kubectl_find_resource", "result": {"status": "success", "data": "..."}}
@@ -255,13 +255,13 @@ Events are delivered in order as the investigation progresses. A typical stream
255255
data: {"content": "I found a pod stuck in ContainerCreating state. Let me investigate further."}
256256
257257
event: start_tool_calling
258-
data: {"tool_call_id": "call_2", "tool_name": "kubectl_describe_resource", "description": "Describing pod frontend-59fbcd7965-drx6w"}
258+
data: {"tool_name": "kubectl_describe_resource", "id": "call_2"}
259259
260260
event: tool_calling_result
261261
data: {"tool_call_id": "call_2", "name": "kubectl_describe_resource", "result": {"status": "success", "data": "..."}}
262262
263263
event: token_count
264-
data: {"input_tokens": 1520, "output_tokens": 305}
264+
data: {"metadata": {"usage": {"prompt_tokens": 1520, "completion_tokens": 305, "total_tokens": 1825}, ...}}
265265
266266
event: ai_answer_end
267267
data: {"analysis": "## Investigation Summary\n\nThe pod `frontend-59fbcd7965-drx6w` is stuck ..."}
@@ -301,9 +301,8 @@ Emitted when Holmes begins executing a tool.
301301
.. code-block:: json
302302
303303
{
304-
"tool_call_id": "call_abc123",
305304
"tool_name": "kubectl_find_resource",
306-
"description": "kubectl get pods -n production"
305+
"id": "call_abc123"
307306
}
308307
309308
.. list-table::
@@ -313,15 +312,14 @@ Emitted when Holmes begins executing a tool.
313312
* - Field
314313
- Type
315314
- Description
316-
* - ``tool_call_id``
315+
* - ``id``
317316
- string
318-
- Unique identifier for this tool call. Use it to correlate with the corresponding ``tool_calling_result``.
317+
- Unique identifier for this tool call. Matches the ``tool_call_id`` of the corresponding ``tool_calling_result``.
319318
* - ``tool_name``
320319
- string
321320
- Name of the tool being executed.
322-
* - ``description``
323-
- string
324-
- Human-readable description of what the tool is doing.
321+
322+
A human-readable description of the call (for example, the ``kubectl`` command it ran) arrives with the result, in the ``tool_calling_result`` event's ``description`` field.
325323

326324
``tool_calling_result``
327325
"""""""""""""""""""""""
@@ -348,10 +346,13 @@ Emitted when a tool call completes.
348346
- Description
349347
* - ``tool_call_id``
350348
- string
351-
- Matches the ``tool_call_id`` from the corresponding ``start_tool_calling`` event.
349+
- Matches the ``id`` from the corresponding ``start_tool_calling`` event.
352350
* - ``name``
353351
- string
354352
- Name of the tool that was called.
353+
* - ``description``
354+
- string
355+
- Human-readable description of the call, such as the command it ran.
355356
* - ``result``
356357
- object
357358
- Result object with a ``status`` field (``"success"``, ``"error"``, ``"no_data"``, or ``"approval_required"``) and either a ``data`` field (on success) or an ``error`` field (on failure).
@@ -437,8 +438,16 @@ Emitted with token usage statistics.
437438
.. code-block:: json
438439
439440
{
440-
"input_tokens": 1520,
441-
"output_tokens": 305
441+
"metadata": {
442+
"usage": {
443+
"prompt_tokens": 1520,
444+
"completion_tokens": 305,
445+
"total_tokens": 1825,
446+
"cached_tokens": 0
447+
},
448+
"max_tokens": 1000000,
449+
"max_output_tokens": 120000
450+
}
442451
}
443452
444453
.. list-table::
@@ -448,12 +457,24 @@ Emitted with token usage statistics.
448457
* - Field
449458
- Type
450459
- Description
451-
* - ``input_tokens``
460+
* - ``metadata.usage.prompt_tokens``
461+
- integer
462+
- Input tokens of the last LLM call.
463+
* - ``metadata.usage.completion_tokens``
464+
- integer
465+
- Output tokens of the last LLM call.
466+
* - ``metadata.usage.total_tokens``
467+
- integer
468+
- Input plus output tokens of the last LLM call.
469+
* - ``metadata.usage.cached_tokens``
470+
- integer
471+
- Optional. Input tokens of the last LLM call served from the provider's prompt cache.
472+
* - ``metadata.max_tokens``
452473
- integer
453-
- Number of input tokens consumed.
454-
* - ``output_tokens``
474+
- Context window of the model.
475+
* - ``metadata.max_output_tokens``
455476
- integer
456-
- Number of output tokens generated.
477+
- Maximum output tokens of the model.
457478

458479
.. _approval-required-event:
459480

@@ -516,6 +537,7 @@ Consuming the Stream
516537
},
517538
stream=True,
518539
)
540+
response.raise_for_status()
519541

520542
event_type = None
521543
for line in response.iter_lines(decode_unicode=True):

0 commit comments

Comments
 (0)