Documentation
¶
Index ¶
- func FormatSystemPromptFromConfig(config AgentConfig, variables map[string]string) string
- func GenerateConfigFromSystemPrompt(ctx context.Context, llm interfaces.LLM, systemPrompt string) (AgentConfig, []TaskConfig, error)
- func GetAgentForTask(taskConfigs TaskConfigs, taskName string) (string, error)
- func SaveAgentConfigsToFile(configs AgentConfigs, file *os.File) error
- func SaveTaskConfigsToFile(configs TaskConfigs, file *os.File) error
- type Agent
- func CreateAgentForTask(taskName string, agentConfigs AgentConfigs, taskConfigs TaskConfigs, ...) (*Agent, error)
- func NewAgent(options ...Option) (*Agent, error)
- func NewAgentFromConfig(agentName string, configs AgentConfigs, variables map[string]string, ...) (*Agent, error)
- func NewAgentWithAutoConfig(ctx context.Context, options ...Option) (*Agent, error)
- func (a *Agent) ApproveExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan) (string, error)
- func (a *Agent) ExecuteTaskFromConfig(ctx context.Context, taskName string, taskConfigs TaskConfigs, ...) (string, error)
- func (a *Agent) GenerateExecutionPlan(ctx context.Context, input string) (*executionplan.ExecutionPlan, error)
- func (a *Agent) GetGeneratedAgentConfig() *AgentConfig
- func (a *Agent) GetGeneratedTaskConfigs() TaskConfigs
- func (a *Agent) GetTaskByID(taskID string) (*executionplan.ExecutionPlan, bool)
- func (a *Agent) ListTasks() []*executionplan.ExecutionPlan
- func (a *Agent) ModifyExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan, modifications string) (*executionplan.ExecutionPlan, error)
- func (a *Agent) Run(ctx context.Context, input string) (string, error)
- type AgentConfig
- type AgentConfigs
- type Option
- func WithAgentConfig(config AgentConfig, variables map[string]string) Option
- func WithGuardrails(guardrails interfaces.Guardrails) Option
- func WithLLM(llm interfaces.LLM) Option
- func WithLLMConfig(config interfaces.LLMConfig) Option
- func WithMCPServers(mcpServers []interfaces.MCPServer) Option
- func WithMemory(memory interfaces.Memory) Option
- func WithName(name string) Option
- func WithOrgID(orgID string) Option
- func WithRequirePlanApproval(require bool) Option
- func WithResponseFormat(formatType interfaces.ResponseFormat) Option
- func WithSystemPrompt(prompt string) Option
- func WithTools(tools ...interfaces.Tool) Option
- func WithTracer(tracer interfaces.Tracer) Option
- type TaskConfig
- type TaskConfigs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSystemPromptFromConfig ¶ added in v0.0.3
func FormatSystemPromptFromConfig(config AgentConfig, variables map[string]string) string
FormatSystemPromptFromConfig formats a system prompt based on the agent configuration
func GenerateConfigFromSystemPrompt ¶ added in v0.0.3
func GenerateConfigFromSystemPrompt(ctx context.Context, llm interfaces.LLM, systemPrompt string) (AgentConfig, []TaskConfig, error)
GenerateConfigFromSystemPrompt uses the LLM to generate agent and task configurations from a system prompt
func GetAgentForTask ¶ added in v0.0.3
func GetAgentForTask(taskConfigs TaskConfigs, taskName string) (string, error)
GetAgentForTask returns the agent name for a given task
func SaveAgentConfigsToFile ¶ added in v0.0.3
func SaveAgentConfigsToFile(configs AgentConfigs, file *os.File) error
SaveAgentConfigsToFile saves agent configurations to a YAML file
func SaveTaskConfigsToFile ¶ added in v0.0.3
func SaveTaskConfigsToFile(configs TaskConfigs, file *os.File) error
SaveTaskConfigsToFile saves task configurations to a YAML file
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents an AI agent
func CreateAgentForTask ¶ added in v0.0.3
func CreateAgentForTask(taskName string, agentConfigs AgentConfigs, taskConfigs TaskConfigs, variables map[string]string, options ...Option) (*Agent, error)
CreateAgentForTask creates a new agent for a specific task
func NewAgentFromConfig ¶ added in v0.0.3
func NewAgentFromConfig(agentName string, configs AgentConfigs, variables map[string]string, options ...Option) (*Agent, error)
NewAgentFromConfig creates a new agent from a YAML configuration
func NewAgentWithAutoConfig ¶ added in v0.0.3
NewAgentWithAutoConfig creates a new agent with automatic configuration generation based on the system prompt if explicit configuration is not provided
func (*Agent) ApproveExecutionPlan ¶ added in v0.0.2
func (a *Agent) ApproveExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan) (string, error)
ApproveExecutionPlan approves an execution plan for execution
func (*Agent) ExecuteTaskFromConfig ¶ added in v0.0.3
func (a *Agent) ExecuteTaskFromConfig(ctx context.Context, taskName string, taskConfigs TaskConfigs, variables map[string]string) (string, error)
ExecuteTaskFromConfig executes a task using its YAML configuration
func (*Agent) GenerateExecutionPlan ¶ added in v0.0.2
func (a *Agent) GenerateExecutionPlan(ctx context.Context, input string) (*executionplan.ExecutionPlan, error)
GenerateExecutionPlan generates an execution plan
func (*Agent) GetGeneratedAgentConfig ¶ added in v0.0.3
func (a *Agent) GetGeneratedAgentConfig() *AgentConfig
GetGeneratedAgentConfig returns the automatically generated agent configuration, if any
func (*Agent) GetGeneratedTaskConfigs ¶ added in v0.0.3
func (a *Agent) GetGeneratedTaskConfigs() TaskConfigs
GetGeneratedTaskConfigs returns the automatically generated task configurations, if any
func (*Agent) GetTaskByID ¶ added in v0.0.2
func (a *Agent) GetTaskByID(taskID string) (*executionplan.ExecutionPlan, bool)
GetTaskByID returns a task by its ID
func (*Agent) ListTasks ¶ added in v0.0.2
func (a *Agent) ListTasks() []*executionplan.ExecutionPlan
ListTasks returns a list of all tasks
func (*Agent) ModifyExecutionPlan ¶ added in v0.0.2
func (a *Agent) ModifyExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan, modifications string) (*executionplan.ExecutionPlan, error)
ModifyExecutionPlan modifies an execution plan based on user input
type AgentConfig ¶ added in v0.0.3
type AgentConfig struct {
Role string `yaml:"role"`
Goal string `yaml:"goal"`
Backstory string `yaml:"backstory"`
}
AgentConfig represents the configuration for an agent loaded from YAML
type AgentConfigs ¶ added in v0.0.3
type AgentConfigs map[string]AgentConfig
AgentConfigs represents a map of agent configurations
func LoadAgentConfigsFromDir ¶ added in v0.0.3
func LoadAgentConfigsFromDir(dirPath string) (AgentConfigs, error)
LoadAgentConfigsFromDir loads all agent configurations from YAML files in a directory
func LoadAgentConfigsFromFile ¶ added in v0.0.3
func LoadAgentConfigsFromFile(filePath string) (AgentConfigs, error)
LoadAgentConfigsFromFile loads agent configurations from a YAML file
type Option ¶
type Option func(*Agent)
Option represents an option for configuring an agent
func WithAgentConfig ¶ added in v0.0.3
func WithAgentConfig(config AgentConfig, variables map[string]string) Option
WithAgentConfig sets the agent configuration from a YAML config
func WithGuardrails ¶
func WithGuardrails(guardrails interfaces.Guardrails) Option
WithGuardrails sets the guardrails for the agent
func WithLLMConfig ¶ added in v0.0.11
func WithLLMConfig(config interfaces.LLMConfig) Option
func WithMCPServers ¶ added in v0.0.13
func WithMCPServers(mcpServers []interfaces.MCPServer) Option
WithMCPServers sets the MCP servers for the agent
func WithMemory ¶
func WithMemory(memory interfaces.Memory) Option
WithMemory sets the memory for the agent
func WithRequirePlanApproval ¶ added in v0.0.2
WithRequirePlanApproval sets whether execution plans require user approval
func WithResponseFormat ¶ added in v0.0.4
func WithResponseFormat(formatType interfaces.ResponseFormat) Option
WithResponseFormat sets the response format for the agent
func WithSystemPrompt ¶
WithSystemPrompt sets the system prompt for the agent
func WithTools ¶
func WithTools(tools ...interfaces.Tool) Option
WithTools sets the tools for the agent
func WithTracer ¶
func WithTracer(tracer interfaces.Tracer) Option
WithTracer sets the tracer for the agent
type TaskConfig ¶ added in v0.0.3
type TaskConfig struct {
Description string `yaml:"description"`
ExpectedOutput string `yaml:"expected_output"`
Agent string `yaml:"agent"`
OutputFile string `yaml:"output_file,omitempty"`
}
TaskConfig represents a task definition loaded from YAML
type TaskConfigs ¶ added in v0.0.3
type TaskConfigs map[string]TaskConfig
TaskConfigs represents a map of task configurations
func LoadTaskConfigsFromDir ¶ added in v0.0.3
func LoadTaskConfigsFromDir(dirPath string) (TaskConfigs, error)
LoadTaskConfigsFromDir loads all task configurations from YAML files in a directory
func LoadTaskConfigsFromFile ¶ added in v0.0.3
func LoadTaskConfigsFromFile(filePath string) (TaskConfigs, error)
LoadTaskConfigsFromFile loads task configurations from a YAML file