OperationReceipt
type OperationReceipt = | RemoteReceipt | { attemptId: string; billing: "unknown" | "reported"; costUsd?: number; id: string; kind: "model"; purpose?: "compaction"; source?: Turn["source"]; status: "running" | "completed" | "interrupted" | "context_rejected"; usage: TokenUsage;} | { attemptId: string; callId: string; costUsd?: number; id: string; kind: "tool" | "delegation" | "handoff"; parentOperationId?: string; result?: ToolResult; status: "running" | "completed" | "interrupted" | "asked";};Defined in: agents/src/types.ts:1076
Stable operation identity; an attempt changes on resume, an operation does not. A model receipt’s usage may be partial if the stream failed.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ attemptId: string; billing: "unknown" | "reported"; costUsd?: number; id: string; kind: "model"; purpose?: "compaction"; source?: Turn["source"]; status: "running" | "completed" | "interrupted" | "context_rejected"; usage: TokenUsage;}attemptId
Section titled “attemptId”attemptId: string;billing
Section titled “billing”billing: "unknown" | "reported";reported means a stream with usage ended, not that the SDK verified the vendor’s bill.
costUsd?
Section titled “costUsd?”optional costUsd?: number;The host’s price for this usage, saved when it arrived.
id: string;kind: "model";purpose?
Section titled “purpose?”optional purpose?: "compaction";source?
Section titled “source?”optional source?: Turn["source"];status
Section titled “status”status: "running" | "completed" | "interrupted" | "context_rejected";usage: TokenUsage;Type Literal
Section titled “Type Literal”{ attemptId: string; callId: string; costUsd?: number; id: string; kind: "tool" | "delegation" | "handoff"; parentOperationId?: string; result?: ToolResult; status: "running" | "completed" | "interrupted" | "asked";}attemptId
Section titled “attemptId”attemptId: string;callId
Section titled “callId”callId: string;costUsd?
Section titled “costUsd?”optional costUsd?: number;What this attempt reported through context.reportCost.
id: string;kind: "tool" | "delegation" | "handoff";parentOperationId?
Section titled “parentOperationId?”optional parentOperationId?: string;result?
Section titled “result?”optional result?: ToolResult;status
Section titled “status”status: "running" | "completed" | "interrupted" | "asked";asked: the attempt reported a cost, then stopped to ask the person. The answer runs the
tool again as a new attempt with its own receipt, so the charge stays on this one. An
attempt that asked without reporting a cost gets no receipt.