Skip to main content

formatReceipt()

formatReceipt(receipt): string

Defined in: receipts.ts:160

Format a RunReceipt into a human-readable text block.

Layout:

=== Run Receipt ===
Run: <runId>
Agent: <agentId>
Status: <status>
Duration: <totalDurationMs>ms

Summary: <attempted> attempted, <succeeded> succeeded, <failed> failed, <skipped> skipped

# | Step | Type | Status | Duration | Tokens
---|------------------|---------|-----------|----------|-------
1 | fetch-data | tool | completed | 120ms | 450
...

Total token cost: 1 250

Shows '---' for missing duration and '---' for missing cost data per step. Shows 'no cost data' for the totals line when no cost information is available.

Parameters

ParameterTypeDescription
receiptRunReceiptA run receipt produced by toReceipt.

Returns

string

Multi-line formatted string.