chain

package
v0.3.50 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package chain registers agent/chain: run one inbound turn through several agents in sequence, sharing the session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, deps Deps) (agentkit.Agent, error)

New registers agent/chain: sequential agent pipeline; every node runs a full turn on the shared session.

Best practices:

  • Nodes are regular agents (agent/coding, another agent/chain) injected via deps.agents.
  • All nodes share the session: node N sees node N-1's messages via DeriveMessages.
  • The inbound user message is recorded once, on the first node's turn; later nodes receive an empty message, so agents that require a non-empty prompt (agent/acp-remote) can only be the first node.
  • Keep routing-style nodes small (own model, few maxSteps); skip/repeat policies belong to wrapper plugins, not chain.

Types

type Config

type Config struct {
	// ID is the chain agent id referenced by loop.defaultAgent or /agent use.
	ID agentkit.AgentID `json:"id"`
	// Nodes lists node agent ids (from deps.agents) executed in order for every turn.
	Nodes []agentkit.AgentID `json:"nodes"`
	// ContinueOnError keeps running later nodes after a node fails; default aborts the chain.
	ContinueOnError bool `json:"continueOnError,omitempty"`
}

Config configures agent/chain.

type Deps

type Deps struct {
	Agents []agentkit.Agent `json:"agents"`
}

Deps holds the node agents; config.nodes references their ids.

type Runtime

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

Runtime is a composite Agent that runs nodes sequentially within one dispatch.

func (*Runtime) AgentCatalogEntry

func (c *Runtime) AgentCatalogEntry() string

AgentCatalogEntry describes the chain for /agent help output.

func (*Runtime) ID

func (c *Runtime) ID() agentkit.AgentID

func (*Runtime) RunTurn

func (c *Runtime) RunTurn(ctx context.Context, input agentkit.TurnInput) error

Jump to

Keyboard shortcuts

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