Documentation
¶
Index ¶
- func DefaultStopCondition(agg *AgentRunAggregator) bool
- type Agent
- func (a *Agent) AddTool(tool *core.Tool) error
- func (a *Agent) CallTool(ctx context.Context, tc *core.ToolCall) (*core.Message, error)
- func (a *Agent) GetMiddleware(name string) (core.Middleware, bool)
- func (a *Agent) GetTools() []*core.Tool
- func (a *Agent) ListMiddleware() []*core.Middleware
- func (a *Agent) RegisterMiddleware(m *core.Middleware) error
- func (a *Agent) RemoveMiddleware(name string) error
- func (a *Agent) Run(ctx context.Context, opts ...RunOptionFunc) (*AgentRunAggregator, error)
- func (a *Agent) RunStream(ctx context.Context, opts ...RunOptionFunc) *StreamRunnerResults
- func (a *Agent) SendMessageStream(ctx context.Context, m []*core.Message) (<-chan *core.Message, <-chan string, <-chan error)
- func (a *Agent) SendMessages(ctx context.Context, m []*core.Message) (*core.Message, error)
- func (a *Agent) Step(ctx context.Context, message core.Message) (*core.Message, error)
- type AgentRunAggregator
- type AgentStopCondition
- type RunOptionFunc
- type RunOptions
- type StreamRunnerResults
- type ToolMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultStopCondition ¶
func DefaultStopCondition(agg *AgentRunAggregator) bool
Example stop condition
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents a basic AI agent with its configuration and state
func NewAgent ¶
func NewAgent(opts ...bootstrap.NewAgentConfigFunc) (*Agent, error)
NewAgent creates a new agent with the given provider
func (*Agent) GetMiddleware ¶
func (a *Agent) GetMiddleware(name string) (core.Middleware, bool)
GetMiddleware returns a middleware by name
func (*Agent) ListMiddleware ¶
func (a *Agent) ListMiddleware() []*core.Middleware
ListMiddleware returns all registered middleware in priority order
func (*Agent) RegisterMiddleware ¶
func (a *Agent) RegisterMiddleware(m *core.Middleware) error
RegisterMiddleware adds a middleware to the processing chain
func (*Agent) RemoveMiddleware ¶
RemoveMiddleware removes a middleware by name
func (*Agent) Run ¶
func (a *Agent) Run(ctx context.Context, opts ...RunOptionFunc) (*AgentRunAggregator, error)
Run implements the main agent loop
func (*Agent) RunStream ¶
func (a *Agent) RunStream(ctx context.Context, opts ...RunOptionFunc) *StreamRunnerResults
RunStream supports a streaming channel from a provider
func (*Agent) SendMessageStream ¶
func (a *Agent) SendMessageStream(ctx context.Context, m []*core.Message) (<-chan *core.Message, <-chan string, <-chan error)
SendMessage sends a message to the agent and gets a response
func (*Agent) SendMessages ¶
SendMessage sends a message to the agent and gets a response
type AgentRunAggregator ¶
AgentRunAggregator represents a single step in an agent's execution
func NewAgentRunAggregator ¶
func NewAgentRunAggregator() *AgentRunAggregator
func (*AgentRunAggregator) Pop ¶
func (ama *AgentRunAggregator) Pop() *core.Message
func (*AgentRunAggregator) Push ¶
func (ama *AgentRunAggregator) Push(m ...*core.Message)
type AgentStopCondition ¶
type AgentStopCondition func(step *AgentRunAggregator) bool
StopCondition is a function that determines if the agent should stop after its completed a step (i.e., a full "start" -> "doing work" -> "done" cycle)
type RunOptionFunc ¶
type RunOptionFunc func(*RunOptions)
RunOptionFunc is a function type that modifies RunOptions
func WithImageBase64 ¶
func WithImageBase64(encoding string, mimeType string) RunOptionFunc
func WithImagePath ¶
func WithImagePath(path string) RunOptionFunc
func WithStopCondition ¶
func WithStopCondition(stopCondition AgentStopCondition) RunOptionFunc
WithStopCondition sets the stop condition option
type RunOptions ¶
type RunOptions struct {
Input string
StopCondition AgentStopCondition
Images []*core.Image
RunErrs []error
}
type StreamRunnerResults ¶
type StreamRunnerResults struct {
AggChan <-chan AgentRunAggregator
DeltaChan <-chan string
ErrChan <-chan error
}