planner

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPlanningFailed is returned when the planner fails to produce a plan.
	ErrPlanningFailed = fmt.Errorf("planner: planning failed")

	// ErrNoSkillsAvailable is returned when no skills are registered.
	ErrNoSkillsAvailable = fmt.Errorf("planner: no skills available")
)
View Source
var (
	// ErrNilPlan is returned when an execution plan is nil.
	ErrNilPlan = errors.New("planner: execution plan is nil")

	// ErrEmptyAssistantID is returned when plan has no assistant ID.
	ErrEmptyAssistantID = errors.New("planner: plan has empty assistant ID")

	// ErrTooManySteps is returned when the plan exceeds maximum allowed steps.
	ErrTooManySteps = errors.New("planner: plan exceeds maximum allowed steps")

	// ErrTooManyToolCalls is returned when the plan exceeds maximum allowed tool calls.
	ErrTooManyToolCalls = errors.New("planner: plan exceeds maximum allowed tool calls")

	// ErrInvalidStepType is returned for unrecognized step types.
	ErrInvalidStepType = errors.New("planner: invalid step type")

	// ErrEmptyStepName is returned when a step has no name.
	ErrEmptyStepName = errors.New("planner: step missing name")
)

Functions

This section is empty.

Types

type ContextBuilder

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

ContextBuilder orchestrates the assembly of context from various subsystems.

func NewContextBuilder

func NewContextBuilder(reg registry.SkillRegistry) *ContextBuilder

NewContextBuilder creates a new ContextBuilder.

func (*ContextBuilder) Build

func (b *ContextBuilder) Build(ctx context.Context, runtime *assistant.AssistantRuntime, userRequest string) (*PlannerContext, error)

Build assembles the PlannerContext for a specific request.

type ExecutionLimits

type ExecutionLimits struct {
	MaxSteps         int
	MaxToolCalls     int
	MaxExecutionTime time.Duration
}

ExecutionLimits defines the maximum limits for any execution plan to ensure bounded, deterministic execution.

func DefaultLimits

func DefaultLimits() ExecutionLimits

DefaultLimits provides the standard system limits.

type ExecutionPlanner

type ExecutionPlanner interface {
	// Plan analyzes user intent and produces a validated execution plan.
	Plan(ctx context.Context, pCtx *PlannerContext) (*execution.ExecutionPlan, error)
}

ExecutionPlanner uses an LLM to generate bounded execution plans.

type LLMPlanner

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

LLMPlanner implements ExecutionPlanner using an LLM provider to generate JSON plans.

func NewLLMPlanner

func NewLLMPlanner(router providers.ModelRouter, limits *ExecutionLimits) *LLMPlanner

NewLLMPlanner creates a new planner with the given model router and optional limits.

func (*LLMPlanner) Plan

Plan uses the assembled context to generate a validated execution plan.

type PlannerContext

type PlannerContext struct {
	AssistantID   string
	Soul          assistant.AssistantSoul
	MemoryContext []assistant.SearchResult
	Skills        []SkillDescriptor
	UserRequest   string
}

PlannerContext contains the unified state for generating an execution plan.

type SkillDescriptor

type SkillDescriptor struct {
	ID          string             `json:"id"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	InputSchema *skills.JSONSchema `json:"input_schema,omitempty"`
}

SkillDescriptor describes a skill for LLM context building.

type Validator

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

Validator enforces structural and limit constraints on an execution plan.

func NewValidator

func NewValidator(limits *ExecutionLimits) *Validator

NewValidator creates a new plan validator with the given limits. If limits is nil, default limits are used.

func (*Validator) Validate

func (v *Validator) Validate(plan *execution.ExecutionPlan) error

Validate checks if the execution plan is valid and within bounds.

Jump to

Keyboard shortcuts

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