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 (*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.