Documentation
¶
Overview ¶
Package composition provides agent composition patterns.
Index ¶
- type AgentResult
- type Condition
- func And(conditions ...Condition) Condition
- func ContentContains(substr string) Condition
- func MetadataEquals(key string, value interface{}) Condition
- func MetadataHasKey(key string) Condition
- func Not(condition Condition) Condition
- func Or(conditions ...Condition) Condition
- func RoleEquals(role string) Condition
- type ConditionalAgent
- func (c *ConditionalAgent) AddRoute(condition Condition, agent agenkit.Agent)
- func (c *ConditionalAgent) Capabilities() []string
- func (c *ConditionalAgent) GetDefaultAgent() agenkit.Agent
- func (c *ConditionalAgent) GetRoutes() []ConditionalRoute
- func (c *ConditionalAgent) Introspect() *agenkit.IntrospectionResult
- func (c *ConditionalAgent) Name() string
- func (c *ConditionalAgent) Process(ctx context.Context, message *agenkit.Message) (*agenkit.Message, error)
- type ConditionalRoute
- type FallbackAgent
- func (f *FallbackAgent) Capabilities() []string
- func (f *FallbackAgent) GetAgents() []agenkit.Agent
- func (f *FallbackAgent) Introspect() *agenkit.IntrospectionResult
- func (f *FallbackAgent) Name() string
- func (f *FallbackAgent) Process(ctx context.Context, message *agenkit.Message) (*agenkit.Message, error)
- type ParallelAgent
- func (p *ParallelAgent) Capabilities() []string
- func (p *ParallelAgent) GetAgents() []agenkit.Agent
- func (p *ParallelAgent) Introspect() *agenkit.IntrospectionResult
- func (p *ParallelAgent) Name() string
- func (p *ParallelAgent) Process(ctx context.Context, message *agenkit.Message) (*agenkit.Message, error)
- type SequentialAgent
- func (s *SequentialAgent) Capabilities() []string
- func (s *SequentialAgent) GetAgents() []agenkit.Agent
- func (s *SequentialAgent) Introspect() *agenkit.IntrospectionResult
- func (s *SequentialAgent) Name() string
- func (s *SequentialAgent) Process(ctx context.Context, message *agenkit.Message) (*agenkit.Message, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentResult ¶
AgentResult holds the result from a single agent execution.
type Condition ¶
Condition is a function that determines whether to use an agent.
func ContentContains ¶
ContentContains returns a condition that checks if message content contains a substring.
func MetadataEquals ¶
MetadataEquals returns a condition that checks if metadata key equals value.
func MetadataHasKey ¶
MetadataHasKey returns a condition that checks if metadata contains a key.
func RoleEquals ¶
RoleEquals returns a condition that checks if message role equals the given role.
type ConditionalAgent ¶
type ConditionalAgent struct {
// contains filtered or unexported fields
}
ConditionalAgent routes messages to different agents based on conditions.
func NewConditionalAgent ¶
func NewConditionalAgent(name string, defaultAgent agenkit.Agent) *ConditionalAgent
NewConditionalAgent creates a new conditional agent.
func (*ConditionalAgent) AddRoute ¶
func (c *ConditionalAgent) AddRoute(condition Condition, agent agenkit.Agent)
AddRoute adds a conditional route.
func (*ConditionalAgent) Capabilities ¶
func (c *ConditionalAgent) Capabilities() []string
Capabilities returns combined capabilities of all agents.
func (*ConditionalAgent) GetDefaultAgent ¶
func (c *ConditionalAgent) GetDefaultAgent() agenkit.Agent
GetDefaultAgent returns the default agent.
func (*ConditionalAgent) GetRoutes ¶
func (c *ConditionalAgent) GetRoutes() []ConditionalRoute
GetRoutes returns the conditional routes.
func (*ConditionalAgent) Introspect ¶
func (c *ConditionalAgent) Introspect() *agenkit.IntrospectionResult
Introspect returns introspection result for the conditional agent.
func (*ConditionalAgent) Name ¶
func (c *ConditionalAgent) Name() string
Name returns the name of the conditional agent.
type ConditionalRoute ¶
ConditionalRoute represents a condition-agent pair.
type FallbackAgent ¶
type FallbackAgent struct {
// contains filtered or unexported fields
}
FallbackAgent tries agents in order until one succeeds. This implements the Fallback/Retry pattern for reliability.
func NewFallbackAgent ¶
func NewFallbackAgent(name string, agents ...agenkit.Agent) (*FallbackAgent, error)
NewFallbackAgent creates a new fallback agent.
func (*FallbackAgent) Capabilities ¶
func (f *FallbackAgent) Capabilities() []string
Capabilities returns combined capabilities of all agents.
func (*FallbackAgent) GetAgents ¶
func (f *FallbackAgent) GetAgents() []agenkit.Agent
GetAgents returns the list of fallback agents.
func (*FallbackAgent) Introspect ¶
func (f *FallbackAgent) Introspect() *agenkit.IntrospectionResult
Introspect returns introspection result for the fallback agent.
func (*FallbackAgent) Name ¶
func (f *FallbackAgent) Name() string
Name returns the name of the fallback agent.
type ParallelAgent ¶
type ParallelAgent struct {
// contains filtered or unexported fields
}
ParallelAgent executes multiple agents concurrently and combines their results.
func NewParallelAgent ¶
func NewParallelAgent(name string, agents ...agenkit.Agent) (*ParallelAgent, error)
NewParallelAgent creates a new parallel agent.
func (*ParallelAgent) Capabilities ¶
func (p *ParallelAgent) Capabilities() []string
Capabilities returns combined capabilities of all agents.
func (*ParallelAgent) GetAgents ¶
func (p *ParallelAgent) GetAgents() []agenkit.Agent
GetAgents returns the list of agents that run in parallel.
func (*ParallelAgent) Introspect ¶
func (p *ParallelAgent) Introspect() *agenkit.IntrospectionResult
Introspect returns introspection result for the parallel agent.
func (*ParallelAgent) Name ¶
func (p *ParallelAgent) Name() string
Name returns the name of the parallel agent.
type SequentialAgent ¶
type SequentialAgent struct {
// contains filtered or unexported fields
}
SequentialAgent executes multiple agents in sequence, passing output from one agent as input to the next.
func NewSequentialAgent ¶
func NewSequentialAgent(name string, agents ...agenkit.Agent) (*SequentialAgent, error)
NewSequentialAgent creates a new sequential agent.
func (*SequentialAgent) Capabilities ¶
func (s *SequentialAgent) Capabilities() []string
Capabilities returns combined capabilities of all agents.
func (*SequentialAgent) GetAgents ¶
func (s *SequentialAgent) GetAgents() []agenkit.Agent
GetAgents returns the list of agents in the sequence.
func (*SequentialAgent) Introspect ¶
func (s *SequentialAgent) Introspect() *agenkit.IntrospectionResult
Introspect returns introspection result for the sequential agent.
func (*SequentialAgent) Name ¶
func (s *SequentialAgent) Name() string
Name returns the name of the sequential agent.