escalate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package escalate implements the escalate tool: the model's explicit exit door when it's stuck and a human should take over. Calling it returns loop.ErrEscalate via a typed error so the loop bails cleanly instead of silently looping until iter-cap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Reason     string
	NextAction string
	// Options are discrete choices for the user to pick from. When set, the
	// TUI renders an interactive picker (arrow/number select) instead of
	// free-text next-action prose.
	Options []string
}

Error is the typed sentinel returned by Run. callers match it via errors.As; loop.ErrEscalate provides a string-comparable shim.

func (*Error) Error

func (e *Error) Error() string

type Tool

type Tool struct{}

Tool is the escalate tool.

func New

func New() *Tool

New returns an escalate tool.

func (*Tool) Run

func (t *Tool) Run(_ context.Context, in map[string]any) (tools.Result, error)

Run returns a typed *Error so the loop's tool-dispatch can recognize it via errors.As and propagate without wrapping the value in a ToolResult.

func (*Tool) Spec

func (t *Tool) Spec() llm.ToolSpec

Spec advertises the tool to the model. Small models do better when the description is concrete and gives one clear use case.

Jump to

Keyboard shortcuts

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