agents.cost-entry-record ​
Append a token-cost ledger row for a single LLM step within an agent session
Append an immutable cost ledger entry for one LLM step within a session.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-agents |
| Version | 1.0 |
Triggers ​
| Source | Endpoint / Event | Description |
|---|---|---|
| INTERNAL | internal.invocation | Internal — called by the runner agent during a session |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
session_uuid | string | Yes | — | — |
model_name | string | Yes | — | — |
organization_uuid | string | Yes | — | — |
tokens_prompt | integer | No | — | — |
tokens_completion | integer | No | — | — |
tokens_cache_read | integer | No | — | — |
tokens_cache_write | integer | No | — | — |
tokens_reasoning | integer | No | — | — |
step_metric_uuid | string | No | — | — |
unit | string | No | — | — |
quantity | float | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
cost_usd | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
failed_at | string | No | — | — |
failed_at_state | string | No | — | — |
failed_layer | json | No | — | — |
failed_step | string | No | — | — |
failure_reason | string | No | — | — |
session_uuid | json | No | — | — |
model_name | json | No | — | — |
organization_uuid | json | No | — | — |
tokens_prompt | json | No | — | — |
tokens_completion | json | No | — | — |
tokens_cache_read | json | No | — | — |
tokens_cache_write | json | No | — | — |
tokens_reasoning | json | No | — | — |
step_metric_uuid | json | No | — | — |
unit | json | No | — | — |
quantity | json | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | run | — |
run | No | No | — | complete | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
initiated | run | run | — |
run | complete | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "agents.cost-entry-record",
"initial_data": {
"session_uuid": "value",
"model_name": "value",
"organization_uuid": "value"
}
}