llm.generation_completed
A generation run reaches a terminal outcome. Inspect status and correlate run_id.
Owner: Conversations. Direction: Travila → your endpoint (outgoing).
The receiver gets an HTTP POST webhook request whose body is the event payload itself. JSON uses protobuf field names (snake_case). See delivery headers and signature verification before accepting it.
Operations that can produce this event
These operations can start the generation workflow that emits this event. Receiving a successful API response does not establish that every event will be produced or delivered.
- Send a message to a conversation —
POST /api/v1/llm/send-message - Send a message and wait for the result —
POST /api/v1/llm/send-message-sync
Payload fields
| 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. |
Full payload model: LLMGenerationCompletedEvent.
Example
Illustrative payload, not a captured delivery. Identifiers, tool names and outcomes are examples; omitted fields depend on the event.
{
"event_context": {
"event_name": "llm.generation_completed",
"version": "1.0",
"event_id": "d3b842c8-b19a-4205-a06f-c57cbf313582",
"correlation_id": "9d4c2e1f-27b1-4304-ae54-af7fe876df31",
"emitted_at": "2026-09-16T12:00:00Z",
"caller_key": "tenant-demo:b81d5345-c1f9-4fb9-b558-a6327c75b842",
"tenant_id": "tenant-demo",
"project_id": "default"
},
"run_id": "9d4c2e1f-27b1-4304-ae54-af7fe876df31",
"status": "WORKFLOW_STATUS_COMPLETED",
"loop_count": 1,
"duration_ms": "1250",
"usage": {
"prompt_tokens": 412,
"completion_tokens": 88,
"total_tokens": 500
}
}
Related payloads and delivery
- Event context and identity
- Webhook event catalog and signing
- Receive and process events
- Recover a failed delivery
Download the public reference contract for this event schema and its named example.
Document: DOC-API-EVENT-llm-generation-completed.