executionplan

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExecutionPlanPrompt

func CreateExecutionPlanPrompt(input string, tools []interfaces.Tool) string

CreateExecutionPlanPrompt creates a prompt for the LLM to generate an execution plan

func FormatExecutionPlan

func FormatExecutionPlan(plan *ExecutionPlan) string

FormatExecutionPlan formats an execution plan for display to the user

Types

type ExecutionPlan

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

func NewExecutionPlan(description string, steps []ExecutionStep) *ExecutionPlan

NewExecutionPlan creates a new execution plan

func ParseExecutionPlanFromResponse

func ParseExecutionPlanFromResponse(response string) (*ExecutionPlan, error)

ParseExecutionPlanFromResponse parses an execution plan from the LLM response

type ExecutionPlanStatus

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

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 Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor handles execution of execution plans

func NewExecutor

func NewExecutor(tools []interfaces.Tool) *Executor

NewExecutor creates a new execution plan executor

func (*Executor) CancelPlan

func (e *Executor) CancelPlan(plan *ExecutionPlan)

CancelPlan cancels an execution plan

func (*Executor) ExecutePlan

func (e *Executor) ExecutePlan(ctx context.Context, plan *ExecutionPlan) (string, error)

ExecutePlan executes an approved execution plan

func (*Executor) GetPlanStatus

func (e *Executor) GetPlanStatus(plan *ExecutionPlan) ExecutionPlanStatus

GetPlanStatus returns the status of an execution plan

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator handles generation of execution plans

func NewGenerator

func NewGenerator(llm interfaces.LLM, tools []interfaces.Tool, systemPrompt string) *Generator

NewGenerator creates a new execution plan generator

func (*Generator) GenerateExecutionPlan

func (g *Generator) GenerateExecutionPlan(ctx context.Context, input string) (*ExecutionPlan, error)

GenerateExecutionPlan generates an execution plan based on the user input

func (*Generator) ModifyExecutionPlan

func (g *Generator) ModifyExecutionPlan(ctx context.Context, plan *ExecutionPlan, modifications string) (*ExecutionPlan, error)

ModifyExecutionPlan modifies an execution plan based on user input

type PlanGenerator

type PlanGenerator interface {
	GenerateExecutionPlan(ctx context.Context, input string) (*ExecutionPlan, error)
}

PlanGenerator is an interface for anything that can generate execution plans

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store handles storage and retrieval of execution plans

func NewStore

func NewStore() *Store

NewStore creates a new execution plan store

func (*Store) DeletePlan

func (s *Store) DeletePlan(taskID string) bool

DeletePlan deletes a plan by its task ID

func (*Store) GetPlanByTaskID

func (s *Store) GetPlanByTaskID(taskID string) (*ExecutionPlan, bool)

GetPlanByTaskID retrieves an execution plan by its task ID

func (*Store) ListPlans

func (s *Store) ListPlans() []*ExecutionPlan

ListPlans returns a list of all plans

func (*Store) StorePlan

func (s *Store) StorePlan(plan *ExecutionPlan)

StorePlan stores an execution plan

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL