Class UsageTools
Tools for tracking token usage and costs across the session.
[ToolPlugin("usage", RequiresInjection = true)]
public sealed class UsageTools
- Inheritance
-
UsageTools
- Inherited Members
Constructors
UsageTools(ICostEstimator?)
public UsageTools(ICostEstimator? costEstimator = null)
Parameters
costEstimatorICostEstimator
Methods
GetUsage()
[KernelFunction("get_usage")]
[ToolSafetyTier(SafetyTier.AutoApprove)]
public string GetUsage()
Returns
RecordUsage(long, long, int)
Records token usage for a turn. Called by the agent loop after each response.
public void RecordUsage(long promptTokens, long completionTokens, int toolCalls)
Parameters
ResetUsage()
[KernelFunction("reset_usage")]
[ToolSafetyTier(SafetyTier.ConfirmOnce)]
public string ResetUsage()
Returns
SetModel(ProviderModelInfo)
Sets the current model for accurate cost calculation when metadata is available.
public void SetModel(ProviderModelInfo model)
Parameters
modelProviderModelInfo