Skip to content

InvocationContextUsage

Defined in: src/agent/invocation-context.ts:29

What the work in an InvocationContext has used: its turns and the token usage of every model call, including nested and auxiliary calls.

turnsTaken: number;

Defined in: src/agent/invocation-context.ts:31

Turns taken in this context, including its nested calls.


inputTokens: number;

Defined in: src/models/streaming.ts:497

Number of tokens in the input (prompt).

Usage.inputTokens


outputTokens: number;

Defined in: src/models/streaming.ts:502

Number of tokens in the output (completion).

Usage.outputTokens


totalTokens: number;

Defined in: src/models/streaming.ts:507

Total number of tokens (input + output).

Usage.totalTokens


optional cacheReadInputTokens?: number;

Defined in: src/models/streaming.ts:513

Number of input tokens read from cache. This can reduce latency and cost.

Usage.cacheReadInputTokens


optional cacheWriteInputTokens?: number;

Defined in: src/models/streaming.ts:519

Number of input tokens written to cache. These tokens can be reused in future requests.

Usage.cacheWriteInputTokens