GeezerVison is showing adk.dev — Context | ADK for TypeScript: API Reference - v2.5.0
The context of various callbacks within an agent run.
This class provides the context for callbacks and tool invocations, including
access to the invocation context, function call ID, event actions, and
authentication response. It also provides methods for requesting credentials,
retrieving authentication responses, loading and saving artifacts, and
searching memory.
Constructors
constructor
-
Parameters
- options: {
eventActions?: EventActions;
functionCallId?: string;
invocationContext: InvocationContext;
resumeInputs?: ResumeInputs;
toolConfirmation?: ToolConfirmation;
}
The configuration options for the Context.
-
The event actions of the current call.
-
OptionalfunctionCallId?: string
The function call id of the current tool call.
This id was returned in the function call event from LLM to identify a
function call. If LLM didn't return this id, ADK will assign one to it.
This id is used to map function call response to the original function
call.
-
-
The inputs the current tool call is being
resumed with, if it paused to ask for them, keyed by interrupt id.
Defaults to empty rather than absent, matching adk-python's
Context.resume_inputs. Carries no approval; see
ResumeInputs.
-
The tool confirmation of the current tool
call.
Returns Context
Properties
Optional ReadonlyabortSignal
abortSignal?: AbortSignal
Optional ReadonlyfunctionCallId
functionCallId?: string
ReadonlyinvocationContext
Accessors
sessionId
-
get sessionId(): string
The ID of the current session.
Returns string
state
-
The delta-aware state of the current session.
userId
-
get userId(): string
The user ID of the current session.
Returns string
Methods
getAuthResponse
-
Gets the auth credential for the given auth config.
Parameters
- authConfig: AuthConfig
The auth config to get the auth credential for.
The auth credential for the given auth config.
listArtifacts
-
listArtifacts(): Promise<string[]>
Lists the filenames of the artifacts attached to the current session.
Returns Promise<string[]>
A promise that resolves to a list of artifact filenames.
loadArtifact
-
loadArtifact(filename: string, version?: number): Promise<Part | undefined>
Loads an artifact attached to the current session.
Parameters
- filename: string
The filename of the artifact.
Optionalversion: number
The version of the artifact. If not provided, the latest
version will be used.
Returns Promise<Part | undefined>
A promise that resolves to the loaded artifact.
requestConfirmation
-
requestConfirmation( __namedParameters: { hint?: string; payload?: unknown },): void
Requests confirmation for the current tool call.
Parameters
- __namedParameters: { hint?: string; payload?: unknown }
Returns void
saveArtifact
-
saveArtifact(filename: string, artifact: Part): Promise<number>
Saves an artifact attached to the current session.
Parameters
- filename: string
The filename of the artifact.
- artifact: Part
Returns Promise<number>
A promise that resolves to the version of the saved artifact.
searchMemory
-
Searches the memory of the current user.
Parameters
- query: string
The query to search memory for.
A promise that resolves to SearchMemoryResponse containing the
matching memories.
Constructors
Properties
Accessors
Methods