Table of Contents

Class AgentUsage

Namespace
Emissary
Assembly
Emissary.dll

Token usage accumulated across all turns of a run.

public sealed record AgentUsage : IEquatable<AgentUsage>
Inheritance
AgentUsage
Implements
Inherited Members

Constructors

AgentUsage(long, long, long, long)

Token usage accumulated across all turns of a run.

public AgentUsage(long InputTokens, long OutputTokens, long CacheCreationInputTokens = 0, long CacheReadInputTokens = 0)

Parameters

InputTokens long

Total input tokens (cache reads and writes counted separately).

OutputTokens long

Total output tokens.

CacheCreationInputTokens long

Input tokens written to the prompt cache.

CacheReadInputTokens long

Input tokens served from the prompt cache.

Properties

CacheCreationInputTokens

Input tokens written to the prompt cache.

public long CacheCreationInputTokens { get; init; }

Property Value

long

CacheReadInputTokens

Input tokens served from the prompt cache.

public long CacheReadInputTokens { get; init; }

Property Value

long

InputTokens

Total input tokens (cache reads and writes counted separately).

public long InputTokens { get; init; }

Property Value

long

OutputTokens

Total output tokens.

public long OutputTokens { get; init; }

Property Value

long

Zero

No usage.

public static AgentUsage Zero { get; }

Property Value

AgentUsage

Methods

Add(long, long, long, long)

Returns this usage plus one turn's tokens.

public AgentUsage Add(long inputTokens, long outputTokens, long cacheCreationInputTokens = 0, long cacheReadInputTokens = 0)

Parameters

inputTokens long

The turn's input tokens.

outputTokens long

The turn's output tokens.

cacheCreationInputTokens long

The turn's cache-write tokens.

cacheReadInputTokens long

The turn's cache-read tokens.

Returns

AgentUsage