Skip to content

RunContext

A context object that is passed to the Runner.run() method.

Type Parameter Default type

TContext

UnknownContext

new RunContext<TContext>(context): RunContext<TContext>
Parameter Type

context

TContext

RunContext<TContext>

context: TContext;

The context object passed by you to the Runner.run()


usage: Usage;

The usage of the agent run so far. For streamed responses, the usage will be stale until the last chunk of the stream is processed.

approveTool(approvalItem, callId): void

Approve a tool call.

Parameter Type Description

approvalItem

RunToolApprovalItem

callId

{ alwaysApprove: boolean; }

The call ID of the tool call.

callId.alwaysApprove?

boolean

void


isToolApproved(__namedParameters): undefined | boolean

Check if a tool call has been approved.

Parameter Type

__namedParameters

{ callId: string; toolName: string; }

__namedParameters.callId

string

__namedParameters.toolName

string

undefined | boolean

true if the tool call has been approved, false if blocked and undefined if not yet approved or rejected.


rejectTool(approvalItem, __namedParameters): void

Reject a tool call.

Parameter Type Description

approvalItem

RunToolApprovalItem

The tool approval item to reject.

__namedParameters

{ alwaysReject: boolean; }

__namedParameters.alwaysReject?

boolean

void


toJSON(): object

object

approvals: Record<string, ApprovalRecord>;
context: any;
usage: Usage;