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 — InMemoryRunner | ADK for TypeScript: API Reference - v2.5.0

  • InMemoryRunner

Class InMemoryRunner

A Runner pre-configured with in-memory services.

Suitable for local development, testing, and prototyping. All session, artifact, and memory data is stored in-process and is not persisted between runs.

Example:

const runner = new InMemoryRunner({agent: myAgent});

for await (const event of runner.runEphemeral({
userId: 'user1',
newMessage: {parts: [{text: 'Hello'}]},
})) {
console.log(event);
}

Hierarchy (View Summary)

  • Runner
    • InMemoryRunner
  • Defined in core/src/runner/in_memory_runner.ts:36

Constructors

constructor

  • new InMemoryRunner(
        params: {
            agent?: RunnableRoot;
            app?: App;
            appName?: string;
            plugins?: BasePlugin[];
            resumabilityConfig?: ResumabilityConfig;
        },
    ): InMemoryRunner

    Creates a new InMemoryRunner instance.

    Parameters

    • params: {
          agent?: RunnableRoot;
          app?: App;
          appName?: string;
          plugins?: BasePlugin[];
          resumabilityConfig?: ResumabilityConfig;
      }

      The configuration for the runner.

      • Optionalagent?: RunnableRoot

        The root agent to run.

      • Optionalapp?: App

        An optional application instance to run.

      • OptionalappName?: string

        The application name. Defaults to app.name when app is provided, or 'InMemoryRunner' otherwise.

      • Optionalplugins?: BasePlugin[]

        An optional list of plugins.

      • OptionalresumabilityConfig?: ResumabilityConfig

        An optional resumability configuration.

    Returns InMemoryRunner

    Overrides Runner.constructor

    • Defined in core/src/runner/in_memory_runner.ts:48

Properties

Readonly[RUNNER_SIGNATURE_SYMBOL]

"[RUNNER_SIGNATURE_SYMBOL]": true

Inherited from Runner.[RUNNER_SIGNATURE_SYMBOL]

  • Defined in core/src/runner/runner.ts:187

Readonlyagent

agent: RunnableRoot

The root being run: an agent, or a bare node (a Workflow) that the runner drives directly.

Inherited from Runner.agent

  • Defined in core/src/runner/runner.ts:193

ReadonlyappName

appName: string

Inherited from Runner.appName

  • Defined in core/src/runner/runner.ts:188

Optional ReadonlyartifactService

artifactService?: BaseArtifactService | SessionArtifactService

Inherited from Runner.artifactService

  • Defined in core/src/runner/runner.ts:195

ReadonlyautoCreateSession

autoCreateSession: boolean

Inherited from Runner.autoCreateSession

  • Defined in core/src/runner/runner.ts:200

Optional ReadonlycredentialService

credentialService?: BaseCredentialService

Inherited from Runner.credentialService

  • Defined in core/src/runner/runner.ts:198

Optional ReadonlymemoryService

memoryService?: BaseMemoryService

Inherited from Runner.memoryService

  • Defined in core/src/runner/runner.ts:197

ReadonlypluginManager

pluginManager: PluginManager

Inherited from Runner.pluginManager

  • Defined in core/src/runner/runner.ts:194

Optional ReadonlyresumabilityConfig

resumabilityConfig?: ResumabilityConfig

Inherited from Runner.resumabilityConfig

  • Defined in core/src/runner/runner.ts:199

ReadonlysessionService

sessionService: BaseSessionService

Inherited from Runner.sessionService

  • Defined in core/src/runner/runner.ts:196

Methods

close

  • close(): Promise<void>

    Closes the runner and cleans up all toolsets reachable from the root agent or workflow.

    Returns Promise<void>

    Inherited from Runner.close

    • Defined in core/src/runner/runner.ts:471

runAsync

  • runAsync(
        params: {
            abortSignal?: AbortSignal;
            customMetadata?: Record<string, unknown>;
            newMessage: Content;
            runConfig?: RunConfig;
            sessionId: string;
            stateDelta?: Record<string, unknown>;
            userId: string;
        },
    ): AsyncGenerator<Event, void, undefined>

    Runs the agent with the given message, and returns an async generator of events.

    Parameters

    • params: {
          abortSignal?: AbortSignal;
          customMetadata?: Record<string, unknown>;
          newMessage: Content;
          runConfig?: RunConfig;
          sessionId: string;
          stateDelta?: Record<string, unknown>;
          userId: string;
      }
      • OptionalabortSignal?: AbortSignal
      • OptionalcustomMetadata?: Record<string, unknown>
      • newMessage: Content

        A new message to append to the session.

      • OptionalrunConfig?: RunConfig

        The run config for the agent.

      • sessionId: string

        The session ID of the session.

      • OptionalstateDelta?: Record<string, unknown>

        An optional state delta to apply to the session.

      • userId: string

        The user ID of the session.

    Returns AsyncGenerator<Event, void, undefined>

    Yields

    The events generated by the agent.

    Inherited from Runner.runAsync

    • Defined in core/src/runner/runner.ts:300

runEphemeral

  • runEphemeral(
        params: {
            customMetadata?: Record<string, unknown>;
            newMessage: Content;
            runConfig?: RunConfig;
            stateDelta?: Record<string, unknown>;
            userId: string;
        },
    ): AsyncGenerator<Event, void, undefined>

    Runs the agent with a new, ephemeral session.

    Parameters

    • params: {
          customMetadata?: Record<string, unknown>;
          newMessage: Content;
          runConfig?: RunConfig;
          stateDelta?: Record<string, unknown>;
          userId: string;
      }
      • OptionalcustomMetadata?: Record<string, unknown>
      • newMessage: Content

        A new message to append to the session.

      • OptionalrunConfig?: RunConfig

        The run config for the agent.

      • OptionalstateDelta?: Record<string, unknown>

        An optional state delta to apply to the session.

      • userId: string

        The user ID of the session.

    Returns AsyncGenerator<Event, void, undefined>

    Yields

    The Events generated by the agent.

    Inherited from Runner.runEphemeral

    • Defined in core/src/runner/runner.ts:257

runLive

  • runLive(
        params: {
            abortSignal?: AbortSignal;
            liveRequestQueue: LiveRequestQueue;
            liveSessionResumptionHandle?: string;
            runConfig?: RunConfig;
            sessionId: string;
            userId: string;
        },
    ): AsyncGenerator<Event, void, undefined>

    Runs the agent in the live (bidirectional streaming) mode.

    Model media events that carry raw inline bytes (audio, video, or image) are yielded but not appended to the session to avoid persisting large blobs; events with fileData references and most other live events (transcriptions, tool calls, usage) are persisted as in runAsync.

    This feature is experimental and its API may change.

    Parameters

    • params: {
          abortSignal?: AbortSignal;
          liveRequestQueue: LiveRequestQueue;
          liveSessionResumptionHandle?: string;
          runConfig?: RunConfig;
          sessionId: string;
          userId: string;
      }
      • OptionalabortSignal?: AbortSignal

        Optional signal to abort the live run.

      • liveRequestQueue: LiveRequestQueue

        The queue used to feed the live model.

      • OptionalliveSessionResumptionHandle?: string

        Optional session resumption handle observed from a prior runLive cycle on the same conversation. When set, the agent's live flow opens the connection with liveConnectConfig.sessionResumption.handle so the server restores its state instead of relying on client-side history replay.

      • OptionalrunConfig?: RunConfig

        The run config for the agent.

      • sessionId: string

        The session ID of the session.

      • userId: string

        The user ID of the session.

    Returns AsyncGenerator<Event, void, undefined>

    Yields

    The events generated by the agent.

    Inherited from Runner.runLive

    • Defined in core/src/runner/runner.ts:824
Constructors
constructor
Properties
[RUNNER_SIGNATURE_SYMBOL]agentappNameartifactServiceautoCreateSessioncredentialServicememoryServicepluginManagerresumabilityConfigsessionService
Methods
closerunAsyncrunEphemeralrunLive
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.