GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — Context | ADK for TypeScript: API Reference - v2.5.0

  • Context

Class Context

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.

Hierarchy (View Summary)

  • ReadonlyContext
    • Context
  • Defined in core/src/agents/context.ts:30

Constructors

constructor

  • new Context(
        options: {
            eventActions?: EventActions;
            functionCallId?: string;
            invocationContext: InvocationContext;
            resumeInputs?: ResumeInputs;
            toolConfirmation?: ToolConfirmation;
        },
    ): Context

    Parameters

    • options: {
          eventActions?: EventActions;
          functionCallId?: string;
          invocationContext: InvocationContext;
          resumeInputs?: ResumeInputs;
          toolConfirmation?: ToolConfirmation;
      }

      The configuration options for the Context.

      • OptionaleventActions?: EventActions

        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.

      • invocationContext: InvocationContext

        The invocation context.

      • OptionalresumeInputs?: ResumeInputs

        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.

      • OptionaltoolConfirmation?: ToolConfirmation

        The tool confirmation of the current tool call.

    Returns Context

    Overrides ReadonlyContext.constructor

    • Defined in core/src/agents/context.ts:56

Properties

Optional ReadonlyabortSignal

abortSignal?: AbortSignal
  • Defined in core/src/agents/context.ts:37

ReadonlyeventActions

eventActions: EventActions
  • Defined in core/src/agents/context.ts:33

Optional ReadonlyfunctionCallId

functionCallId?: string
  • Defined in core/src/agents/context.ts:34

ReadonlyinvocationContext

invocationContext: InvocationContext

Inherited from ReadonlyContext.invocationContext

  • Defined in core/src/agents/readonly_context.ts:17

ReadonlyresumeInputs

resumeInputs: ResumeInputs
  • Defined in core/src/agents/context.ts:36

OptionaltoolConfirmation

toolConfirmation?: ToolConfirmation
  • Defined in core/src/agents/context.ts:35

Accessors

a2aMetadata

  • get a2aMetadata(): Record<string, unknown> | undefined

    Request-level metadata passed from an incoming A2A request or caller.

    Returns Record<string, unknown> | undefined

    Inherited from ReadonlyContext.a2aMetadata

    • Defined in core/src/agents/readonly_context.ts:67

actions

  • get actions(): EventActions

    Returns EventActions

    • Defined in core/src/agents/context.ts:82

agentName

  • get agentName(): string

    The current agent name.

    Returns string

    Inherited from ReadonlyContext.agentName

    • Defined in core/src/agents/readonly_context.ts:50

invocationId

  • get invocationId(): string

    The current invocation id.

    Returns string

    Inherited from ReadonlyContext.invocationId

    • Defined in core/src/agents/readonly_context.ts:29

sessionId

  • get sessionId(): string

    The ID of the current session.

    Returns string

    Inherited from ReadonlyContext.sessionId

    • Defined in core/src/agents/readonly_context.ts:43

state

  • get state(): State

    The delta-aware state of the current session.

    Returns State

    Overrides ReadonlyContext.state

    • Defined in core/src/agents/context.ts:78

userContent

  • get userContent(): Content | undefined

    The user content that started this invocation.

    Returns Content | undefined

    Inherited from ReadonlyContext.userContent

    • Defined in core/src/agents/readonly_context.ts:22

userId

  • get userId(): string

    The user ID of the current session.

    Returns string

    Inherited from ReadonlyContext.userId

    • Defined in core/src/agents/readonly_context.ts:36

Methods

getAuthResponse

  • getAuthResponse(authConfig: AuthConfig): AuthCredential | undefined

    Gets the auth credential for the given auth config.

    Parameters

    • authConfig: AuthConfig

      The auth config to get the auth credential for.

    Returns AuthCredential | undefined

    The auth credential for the given auth config.

    • Defined in core/src/agents/context.ts:142

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.

    • Defined in core/src/agents/context.ts:153

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.

    • Defined in core/src/agents/context.ts:94

requestConfirmation

  • requestConfirmation(
        __namedParameters: { hint?: string; payload?: unknown },
    ): void

    Requests confirmation for the current tool call.

    Parameters

    • __namedParameters: { hint?: string; payload?: unknown }

    Returns void

    • Defined in core/src/agents/context.ts:183

requestCredential

  • requestCredential(authConfig: AuthConfig): void

    Parameters

    • authConfig: AuthConfig

    Returns void

    • Defined in core/src/agents/context.ts:126

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

      The artifact to save.

    Returns Promise<number>

    A promise that resolves to the version of the saved artifact.

    • Defined in core/src/agents/context.ts:112

searchMemory

  • searchMemory(query: string): Promise<SearchMemoryResponse>

    Searches the memory of the current user.

    Parameters

    • query: string

      The query to search memory for.

    Returns Promise<SearchMemoryResponse>

    A promise that resolves to SearchMemoryResponse containing the matching memories.

    • Defined in core/src/agents/context.ts:168
Constructors
constructor
Properties
abortSignaleventActionsfunctionCallIdinvocationContextresumeInputstoolConfirmation
Accessors
a2aMetadataactionsagentNameinvocationIdsessionIdstateuserContentuserId
Methods
getAuthResponselistArtifactsloadArtifactrequestConfirmationrequestCredentialsaveArtifactsearchMemory
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.