Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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:
- Build its input as: original messages + all complete messages produced so far.
- For agents after the first, inject a handoff user message.
- Run it and yield every event it produces (including partial streaming events).
- 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.