runner

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner coordinates a stateless Agent with a SessionService. It loads conversation history from the session, forwards it to the agent, and persists every yielded message back to the session.

func New

New creates a Runner backed by the given agent and session service.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, sessionID int64, userInput model.Message) iter.Seq2[*model.Event, error]

Run handles one user turn. It fetches the session history, appends the user input, invokes the agent, and yields each produced Event to the caller. Complete events (Event.Partial=false) are persisted to the session; partial streaming fragments are forwarded to the caller for real-time display but are not persisted. The caller iterates the returned sequence and decides whether to continue the conversation by calling Run again.

userInput must contain the user's message content (via Content or Parts). Its Role is always set to RoleUser by the runner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL