LLMGenerationCompletedEvent
Event emitted when a generation run reaches a terminal state. The event context identifies the associated conversation.
Usage profiles
| Usage | Fields and validation |
|---|---|
| In webhook payloads | View fields |
In webhook payloads
Webhook JSON uses protobuf field names (snake_case).
| Field | Type | Presence | Meaning |
|---|---|---|---|
event_context | EventContext | Optional | Event provenance and routing metadata associated with the emitted event. |
run_id | string | Optional | Unique identifier for the workflow run |
status | string (WORKFLOW_STATUS_RUNNING, WORKFLOW_STATUS_COMPLETED, WORKFLOW_STATUS_FAILED, WORKFLOW_STATUS_TIMED_OUT, WORKFLOW_STATUS_CANCELED) or integer (int32) | Optional | Terminal status of the run |
loop_count | integer (int32) | Optional | Number of agent loops/steps executed Minimum: -2147483648. Maximum: 2147483647. |
duration_ms | string (int64) | Optional | End-to-end run duration in milliseconds Pattern: ^-?\d+$. |
usage | Usage | Optional | Optional usage accounting for the run |
error | RpcError | Optional | Structured error for FAILED/TIMED_OUT/CANCELED runs. |
usage_by_model | Array of UsageByModel | Optional | Per-model breakdown of the same usage usage aggregates. Additive: usage stays the run-level total so existing consumers are unaffected, while billing keys its charges on model. Empty when the producer predates it. |
turn_key | string | Optional | Identifies the conversation turn this run served: the message_id of the opening user message, resolved once at run start and stamped on every message the run emits as Message.source_user_message_id. Empty when the producer predates this field, or when the turn is unresolvable — never guess one, an empty key means "no turn attribution". |
Values of status
Lifecycle state of a workflow execution, distinct from the reason a terminal execution ended.
| Value | No. | Form | Meaning |
|---|---|---|---|
WORKFLOW_STATUS_RUNNING | 1 | Canonical | The workflow has started and has not reached a terminal outcome. |
WORKFLOW_STATUS_COMPLETED | 2 | Canonical | The workflow finished successfully. |
WORKFLOW_STATUS_FAILED | 3 | Canonical | The workflow ended because execution failed; inspect its error or end reason. |
WORKFLOW_STATUS_TIMED_OUT | 4 | Canonical | The workflow ended because its execution time limit elapsed. |
WORKFLOW_STATUS_CANCELED | 5 | Canonical | The workflow was cancelled before normal completion. This enum retains its existing CANCELED wire spelling. |
Where used
| Reference | Relationship |
|---|---|
| llm.generation_completed | Webhook JSON uses protobuf field names (snake_case). |
Download the public reference contract.
Document: DOC-API-MODEL-llm-generation-completed-event.