InMemoryRunner

An in-memory implementation of a Runner that manages the lifecycle of a BaseAgent execution.

It provides default in-memory implementations for session, artifact, and memory services. It can be constructed either directly from a root agent or from an App.

Inheritors

Constructors

Link copied to clipboard
constructor(agent: BaseAgent, appName: String = "InMemoryRunner", sessionService: SessionService = InMemorySessionService(), artifactService: ArtifactService? = InMemoryArtifactService(), memoryService: MemoryService? = InMemoryMemoryService())

Creates an InMemoryRunner from a root agent and default in-memory services.

constructor(app: App, sessionService: SessionService = InMemorySessionService(), artifactService: ArtifactService? = InMemoryArtifactService(), memoryService: MemoryService? = InMemoryMemoryService(), skipClosingPlugins: Boolean = false)
constructor(agent: BaseAgent, appName: String = "InMemoryRunner", sessionService: SessionService = InMemorySessionService(), artifactService: ArtifactService? = InMemoryArtifactService(), memoryService: MemoryService? = InMemoryMemoryService(), pluginManager: PluginManager)

Creates an InMemoryRunner with an explicit pluginManager.

constructor(agent: BaseAgent, appName: String = "InMemoryRunner", sessionService: SessionService = InMemorySessionService(), artifactService: ArtifactService? = InMemoryArtifactService(), memoryService: MemoryService? = InMemoryMemoryService(), resumabilityConfig: ResumabilityConfig)

Creates an InMemoryRunner with an explicit resumabilityConfig.

constructor(agent: BaseAgent, appName: String = "InMemoryRunner", sessionService: SessionService = InMemorySessionService(), artifactService: ArtifactService? = InMemoryArtifactService(), memoryService: MemoryService? = InMemoryMemoryService(), pluginManager: PluginManager, resumabilityConfig: ResumabilityConfig)

Creates an InMemoryRunner with both an explicit pluginManager and resumabilityConfig.

Properties

Link copied to clipboard
override val agent: BaseAgent
Link copied to clipboard
val app: App?
Link copied to clipboard
override val appName: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun applyStateDelta(event: Event, stateDelta: Map<String, Any>?)

Applies the provided stateDelta to the given event.

Link copied to clipboard
open suspend override fun rewindAsync(userId: String, sessionId: String, rewindBeforeInvocationId: String)

Rewinds the session to before the specified invocation.

Link copied to clipboard
open override fun run(userId: String, sessionId: String, newMessage: Content, runConfig: RunConfig?): Iterator<Event>

Sync interface for local testing and convenience purpose.

Link copied to clipboard
open override fun runAsync(userId: String, sessionId: String, invocationId: String?, newMessage: Content?, stateDelta: Map<String, Any>?, runConfig: RunConfig?): Flow<Event>

Main entry method to run the agent in this runner.