PublisherRunner

Java-friendly wrapper around a Runner. A run is exposed as a Reactive Streams Publisher of events, so Java callers never touch Flow; collect it with AsyncJavaHelpers.collect/forEach or any Reactive Streams consumer. Session management is not a runner concern: to call the session service from Java, create it wrapped in a CompletableFutureSessionService and build the runner with the wrapper's asKotlinSessionService().

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard

The wrapped engine runner, for code that has dropped into Kotlin.

Link copied to clipboard
open override fun close()

Closes the runner and cancels pending rewinds, but not runs in flight; cancel their subscriptions first.

Link copied to clipboard
fun rewindAsync(userId: String, sessionId: String, rewindBeforeInvocationId: String): CompletableFuture<Void?>

Rewinds the session to before rewindBeforeInvocationId; see Runner.rewindAsync. The returned future completes once the rewind has been applied.

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

Runs the agent, streaming its events. Set invocationId to resume an interrupted invocation.

Link copied to clipboard
fun runLive(userId: String, sessionId: String, liveRequestQueue: LiveRequestQueue, runConfig: RunConfig? = null): Publisher<Event>

Experimental: runs the agent over a live connection, streaming the whole conversation's events (see Runner.runLive). Each subscription starts its own run, which ends when liveRequestQueue is closed or the model ends the session; cancelling the subscription closes the connection and leaves the queue open. Events arrive on Dispatchers.IO, never on the thread that sends to the queue; hand slow work in onNext to your own executor.