flow

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeepAgent

func NewDeepAgent(config DeepConfig) (blades.Agent, error)

NewDeepAgent constructs and returns a "deep agent" using the provided configuration. A deep agent is an advanced agent capable of managing complex tasks, maintaining a list of todos, and delegating work to subagents. Unlike a regular agent, a deep agent supports hierarchical delegation, allowing it to break down tasks and assign them to specialized subagents as needed. The returned agent can manage its own todos, utilize custom tools, and coordinate with subagents to accomplish multi-step or collaborative objectives.

func NewLoopAgent

func NewLoopAgent(config LoopConfig) blades.Agent

NewLoopAgent creates a new LoopAgent.

func NewParallelAgent

func NewParallelAgent(config ParallelConfig) blades.Agent

NewParallelAgent creates a new ParallelAgent.

func NewRoutingAgent

func NewRoutingAgent(config RoutingConfig) (blades.Agent, error)

func NewSequentialAgent

func NewSequentialAgent(config SequentialConfig) blades.Agent

NewSequentialAgent creates a new SequentialAgent.

Types

type DeepConfig

type DeepConfig struct {
	Name                       string
	Model                      blades.ModelProvider
	Description                string
	Instruction                string
	Tools                      []tools.Tool
	SubAgents                  []blades.Agent
	MaxIterations              int
	WithoutGeneralPurposeAgent bool
	Middlewares                []blades.Middleware
}

DeepConfig defines the configuration options for creating a deep agent.

type LoopAgent

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

LoopAgent is an agent that runs sub-agents in a loop.

func (*LoopAgent) Description

func (a *LoopAgent) Description() string

func (*LoopAgent) Name

func (a *LoopAgent) Name() string

func (*LoopAgent) Run

Run runs the sub-agents in a loop. After each message yielded by a sub-agent the loop checks message.Actions for an ActionLoopExit signal set by ExitTool. Context compression across iterations is delegated to the ContextCompressor configured on the Session (via blades.WithContextCompressor).

type LoopCondition

type LoopCondition func(ctx context.Context, state LoopState) (bool, error)

LoopCondition is called once after every complete iteration. Return true to run another iteration, false to stop normally, or a non-nil error (e.g. blades.ErrLoopEscalated) to abort with an error.

type LoopConfig

type LoopConfig struct {
	Name          string
	Description   string
	MaxIterations int
	// Condition is evaluated after every iteration. It takes priority over ExitTool signals.
	Condition LoopCondition
	SubAgents []blades.Agent
}

LoopConfig is the configuration for a LoopAgent.

type LoopState

type LoopState struct {
	// Iteration is the 0-based index of the iteration that just completed.
	Iteration int
	// Input is the original input message to the LoopAgent.
	Input *blades.Message
	// Output is the last message produced in the current iteration.
	Output *blades.Message
}

LoopState captures the observable state available to a LoopCondition.

type ParallelAgent

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

ParallelAgent is an agent that runs sub-agents in parallel.

func (*ParallelAgent) Description

func (p *ParallelAgent) Description() string

Description returns the description of the agent.

func (*ParallelAgent) Name

func (p *ParallelAgent) Name() string

Name returns the name of the agent.

func (*ParallelAgent) Run

Run runs the sub-agents in parallel.

type ParallelConfig

type ParallelConfig struct {
	Name        string
	Description string
	SubAgents   []blades.Agent
}

ParallelConfig is the configuration for a ParallelAgent.

type RoutingAgent

type RoutingAgent struct {
	blades.Agent
	// contains filtered or unexported fields
}

func (*RoutingAgent) Run

type RoutingConfig

type RoutingConfig struct {
	Name        string
	Description string
	Model       blades.ModelProvider
	SubAgents   []blades.Agent
	Middlewares []blades.Middleware
}

type SequentialAgent

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

SequentialAgent is an agent that runs sub-agents sequentially.

func (*SequentialAgent) Description

func (a *SequentialAgent) Description() string

Description returns the description of the agent.

func (*SequentialAgent) Name

func (a *SequentialAgent) Name() string

Name returns the name of the agent.

func (*SequentialAgent) Run

Run runs the sub-agents sequentially.

type SequentialConfig

type SequentialConfig struct {
	Name        string
	Description string
	SubAgents   []blades.Agent
}

SequentialConfig is the configuration for a SequentialAgent.

Jump to

Keyboard shortcuts

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