AgentPrismToolUsage
AgentPrism.Core.dllLets a tool report non-token usage from its own body.
public static class AgentPrismToolUsageInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
Section titled “Examples”AgentPrismToolUsage.Report(new ToolCallUsage{ Unit = ToolUsageUnits.Characters, Quantity = audio.CharactersBilled ?? request.Text.Length, Cost = price, Currency = "USD", IsEstimated = audio.CharactersBilled is null,});Remarks
Section titled “Remarks”Speech synthesis is billed by character and speech recognition by second. Neither
is a token and cannot be written to the cost columns of the runs table.
The measurement attaches to the current call’s ToolInvocationRecord.
It reads the call identifier from FunctionInvokingChatClient.CurrentContext.
This was verified by measurement on 2026-08-05. The AIFunctionArguments.Context
dictionary is null and does not carry the call identifier, while the
static context is populated in the tool body. Dependencies resolve through AIFunctionArguments.Services.
Methods
Section titled “Methods”Report(ToolCallUsage)
Section titled “ Report(ToolCallUsage)”Reports usage for the current tool call.
public static bool Report(ToolCallUsage usage)Parameters
Section titled “Parameters”usage ToolCallUsage
The usage measurement.
Returns
Section titled “Returns”true when the measurement is attached to a call. Returns false when run recording is disabled or the call is not in a tool context.
Remarks
Section titled “Remarks”This method never throws, except for an empty argument. A false result does not interrupt the tool. Observability does not break functionality. This is the same rule that prevents a store error from stopping a run.
Exceptions
Section titled “Exceptions”usage is null.