Documentation
¶
Index ¶
- func NewDeepAgent(config DeepConfig) (blades.Agent, error)
- func NewLoopAgent(config LoopConfig) blades.Agent
- func NewParallelAgent(config ParallelConfig) blades.Agent
- func NewRoutingAgent(config RoutingConfig) (blades.Agent, error)
- func NewSequentialAgent(config SequentialConfig) blades.Agent
- type DeepConfig
- type LoopAgent
- type LoopCondition
- type LoopConfig
- type LoopState
- type ParallelAgent
- type ParallelConfig
- type RoutingAgent
- type RoutingConfig
- type SequentialAgent
- type SequentialConfig
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 (*LoopAgent) Run ¶
func (a *LoopAgent) Run(ctx context.Context, input *blades.Invocation) blades.Generator[*blades.Message, error]
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 ¶
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.
type ParallelConfig ¶
ParallelConfig is the configuration for a ParallelAgent.
type RoutingAgent ¶
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.