sequentialagent

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (agent.Agent, error)

New creates a SequentialAgent from the given Config. At least one agent must be provided.

Types

type Config

type Config struct {
	Name        string
	Description string
	Agents      []agent.Agent
}

Config holds the configuration for a SequentialAgent.

type SequentialAgent

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

SequentialAgent runs a fixed list of agents one after another in order. Each agent receives the original input messages plus all messages produced by every preceding agent, giving it full context of what happened before. All messages from all agents are yielded in the order they are produced.

Between agents, a handoff user message is injected so that each agent receives a conversation ending with a user turn, which LLMs expect.

This is useful for building multi-step pipelines where the output of one step enriches the context for the next step:

research → draft → review

func (*SequentialAgent) Description

func (s *SequentialAgent) Description() string

func (*SequentialAgent) Name

func (s *SequentialAgent) Name() string

func (*SequentialAgent) Run

func (s *SequentialAgent) Run(ctx context.Context, messages []model.Message) iter.Seq2[*model.Event, error]

Run executes the agent pipeline sequentially.

For each agent in the list:

  1. Build its input as: original messages + all complete messages produced so far.
  2. For agents after the first, inject a handoff user message.
  3. Run it and yield every event it produces (including partial streaming events).
  4. Append complete (non-partial) messages to the accumulated context for the next agent.

Iteration stops early (without error) if the caller breaks out of the loop. If any agent returns an error, the error is yielded and iteration stops.

Jump to

Keyboard shortcuts

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