The Runner class is used to run agents. It manages the execution of an agent within a session, handling message processing, event generation, and interaction with various services like artifact storage, session management, and memory.

Type Parameters

Hierarchy (view full)

Constructors

Properties

appName: string

The app name of the runner.

agent: T

The root agent to run.

artifactService?: BaseArtifactService

The artifact service for the runner.

sessionService: BaseSessionService

The session service for the runner.

memoryService?: BaseMemoryService

The memory service for the runner.

pluginManager: PluginManager

The plugin manager for the runner.

eventsCompactionConfig?: EventsCompactionConfig

Configuration for event compaction.

logger: Logger = ...

Methods

  • Runs the agent synchronously. NOTE: This sync interface is only for local testing and convenience purpose. Consider using runAsync for production usage.

    Parameters

    • __namedParameters: {
          userId: string;
          sessionId: string;
          newMessage: Content;
          runConfig?: RunConfig;
      }
      • userId: string
      • sessionId: string
      • newMessage: Content
      • OptionalrunConfig?: RunConfig

    Returns Generator<Event, void, unknown>

  • Main entry method to run the agent in this runner.

    Parameters

    • __namedParameters: {
          userId: string;
          sessionId: string;
          newMessage: Content;
          runConfig?: RunConfig;
      }
      • userId: string
      • sessionId: string
      • newMessage: Content
      • OptionalrunConfig?: RunConfig

    Returns AsyncGenerator<Event, void, unknown>

  • Parameters

    • args: {
          userId: string;
          sessionId: string;
          rewindBeforeInvocationId: string;
      }
      • userId: string
      • sessionId: string
      • rewindBeforeInvocationId: string

    Returns Promise<void>