Documentation
¶
Index ¶
- func FormatExecutionPlan(plan *ExecutionPlan) string
- type Agent
- func (a *Agent) ApproveExecutionPlan(ctx context.Context, plan *ExecutionPlan) (string, error)
- func (a *Agent) CancelPlan(plan *ExecutionPlan)
- func (a *Agent) ExecutePlan(ctx context.Context, plan *ExecutionPlan) (string, error)
- func (a *Agent) GenerateExecutionPlan(ctx context.Context, input string) (*ExecutionPlan, error)
- func (a *Agent) GetPlanByTaskID(taskID string) (*ExecutionPlan, bool)
- func (a *Agent) GetPlanStatus(plan *ExecutionPlan) ExecutionPlanStatus
- func (a *Agent) GetTaskByID(taskID string) (*ExecutionPlan, bool)
- func (a *Agent) ListTasks() []*ExecutionPlan
- func (a *Agent) ModifyExecutionPlan(ctx context.Context, plan *ExecutionPlan, modifications string) (*ExecutionPlan, error)
- func (a *Agent) Run(ctx context.Context, input string) (string, error)
- type ExecutionPlan
- type ExecutionPlanStatus
- type ExecutionStep
- type Option
- func WithGuardrails(guardrails interfaces.Guardrails) Option
- func WithLLM(llm interfaces.LLM) Option
- func WithMemory(memory interfaces.Memory) Option
- func WithName(name string) Option
- func WithOrgID(orgID string) Option
- func WithRequirePlanApproval(require bool) Option
- func WithSystemPrompt(prompt string) Option
- func WithTools(tools ...interfaces.Tool) Option
- func WithTracer(tracer interfaces.Tracer) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatExecutionPlan ¶ added in v0.0.2
func FormatExecutionPlan(plan *ExecutionPlan) string
FormatExecutionPlan formats an execution plan for display to the user
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents an AI agent
func (*Agent) ApproveExecutionPlan ¶ added in v0.0.2
ApproveExecutionPlan approves an execution plan for execution
func (*Agent) CancelPlan ¶ added in v0.0.2
func (a *Agent) CancelPlan(plan *ExecutionPlan)
CancelPlan cancels an execution plan
func (*Agent) ExecutePlan ¶ added in v0.0.2
ExecutePlan executes an approved execution plan
func (*Agent) GenerateExecutionPlan ¶ added in v0.0.2
GenerateExecutionPlan generates an execution plan based on the user input
func (*Agent) GetPlanByTaskID ¶ added in v0.0.2
func (a *Agent) GetPlanByTaskID(taskID string) (*ExecutionPlan, bool)
GetPlanByTaskID returns an execution plan by its task ID
func (*Agent) GetPlanStatus ¶ added in v0.0.2
func (a *Agent) GetPlanStatus(plan *ExecutionPlan) ExecutionPlanStatus
GetPlanStatus returns the status of an execution plan
func (*Agent) GetTaskByID ¶ added in v0.0.2
func (a *Agent) GetTaskByID(taskID string) (*ExecutionPlan, bool)
GetTaskByID returns a task by its ID
func (*Agent) ListTasks ¶ added in v0.0.2
func (a *Agent) ListTasks() []*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, modifications string) (*ExecutionPlan, error)
ModifyExecutionPlan modifies an execution plan based on user input
type ExecutionPlan ¶ added in v0.0.2
type ExecutionPlan struct {
// Steps is a list of planned tool executions
Steps []ExecutionStep
// Description is a high-level description of what the plan will accomplish
Description string
// UserApproved indicates whether the user has approved the plan
UserApproved bool
// TaskID is a unique identifier for the task associated with this plan
TaskID string
// Status represents the current status of the execution plan
Status ExecutionPlanStatus
// CreatedAt is the time when the plan was created
CreatedAt time.Time
// UpdatedAt is the time when the plan was last updated
UpdatedAt time.Time
}
ExecutionPlan represents a plan of tool executions that the agent intends to perform
func NewExecutionPlan ¶ added in v0.0.2
func NewExecutionPlan(description string, steps []ExecutionStep) *ExecutionPlan
NewExecutionPlan creates a new execution plan
type ExecutionPlanStatus ¶ added in v0.0.2
type ExecutionPlanStatus string
ExecutionPlanStatus represents the status of an execution plan
const ( // StatusDraft indicates the plan is in draft state StatusDraft ExecutionPlanStatus = "draft" // StatusPendingApproval indicates the plan is waiting for user approval StatusPendingApproval ExecutionPlanStatus = "pending_approval" // StatusApproved indicates the plan has been approved StatusApproved ExecutionPlanStatus = "approved" // StatusExecuting indicates the plan is currently executing StatusExecuting ExecutionPlanStatus = "executing" // StatusCompleted indicates the plan has completed execution StatusCompleted ExecutionPlanStatus = "completed" // StatusFailed indicates the plan execution failed StatusFailed ExecutionPlanStatus = "failed" // StatusCancelled indicates the plan was cancelled StatusCancelled ExecutionPlanStatus = "cancelled" )
type ExecutionStep ¶ added in v0.0.2
type ExecutionStep struct {
// ToolName is the name of the tool to execute
ToolName string
// Input is the input to provide to the tool
Input string
// Description is a description of what this step will accomplish
Description string
// Parameters contains the parameters for the tool execution
Parameters map[string]interface{}
}
ExecutionStep represents a single step in an execution plan
type Option ¶
type Option func(*Agent)
Option represents an option for configuring an agent
func WithGuardrails ¶
func WithGuardrails(guardrails interfaces.Guardrails) Option
WithGuardrails sets the guardrails 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 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