Skip to content

InvocationContext

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

Handle to the request an object belongs to.

A top-level invoke() / stream() call starts a request, and the SDK attaches its handle to the objects it passes to hooks, tools, and extension points and to the call’s result. Pass it to InvokeOptions.invocationContext to run a nested call in the same request, sharing its limits and usage, for example to continue a previous call’s budget.

Only the SDK can create one; its state is read-only.

readonly [invocationContextBrand]: true;

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


readonly usage: Readonly<InvocationContextUsage>;

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

What the work in this context has used so far; it keeps growing while that work runs.