Skip to main content

LLMGenerationCompletedEvent

Event emitted when a generation run reaches a terminal state. The event context identifies the associated conversation.

Usage profiles​

UsageFields and validation
In webhook payloadsView fields

In webhook payloads​

Webhook JSON uses protobuf field names (snake_case).

FieldTypePresenceMeaning
event_contextEventContextOptionalEvent provenance and routing metadata associated with the emitted event.
run_idstringOptionalUnique identifier for the workflow run
statusstring (WORKFLOW_STATUS_RUNNING, WORKFLOW_STATUS_COMPLETED, WORKFLOW_STATUS_FAILED, WORKFLOW_STATUS_TIMED_OUT, WORKFLOW_STATUS_CANCELED) or integer (int32)OptionalTerminal status of the run
loop_countinteger (int32)OptionalNumber of agent loops/steps executed Minimum: -2147483648. Maximum: 2147483647.
duration_msstring (int64)OptionalEnd-to-end run duration in milliseconds Pattern: ^-?\d+$.
usageUsageOptionalOptional usage accounting for the run
errorRpcErrorOptionalStructured error for FAILED/TIMED_OUT/CANCELED runs.
usage_by_modelArray of UsageByModelOptionalPer-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_keystringOptionalIdentifies 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.

ValueNo.FormMeaning
WORKFLOW_STATUS_RUNNING1CanonicalThe workflow has started and has not reached a terminal outcome.
WORKFLOW_STATUS_COMPLETED2CanonicalThe workflow finished successfully.
WORKFLOW_STATUS_FAILED3CanonicalThe workflow ended because execution failed; inspect its error or end reason.
WORKFLOW_STATUS_TIMED_OUT4CanonicalThe workflow ended because its execution time limit elapsed.
WORKFLOW_STATUS_CANCELED5CanonicalThe workflow was cancelled before normal completion. This enum retains its existing CANCELED wire spelling.

Where used​

ReferenceRelationship
llm.generation_completedWebhook JSON uses protobuf field names (snake_case).

Download the public reference contract.

Document: DOC-API-MODEL-llm-generation-completed-event.