ADK for TypeScript: API Reference
    Preparing search index...

    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)

    Constructors

    Properties

    "[RUNNER_SIGNATURE_SYMBOL]": true

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

    appName: string
    credentialService?: BaseCredentialService
    memoryService?: BaseMemoryService
    pluginManager: PluginManager
    resumabilityConfig?: ResumabilityConfig
    sessionService: BaseSessionService

    Methods

    • 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>

      The events generated by the agent.

    • 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>

      The Events generated by the agent.

    • 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>

      The events generated by the agent.