plan

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElicitResult

type ElicitResult struct {
	// Action is either "accept" or "decline".
	Action ElicitResultAction `json:"action"`

	// Payload is the user supplied map that conforms to the supplied schema
	// when Action == "accept". It is nil if the action is "decline".
	Payload map[string]any `json:"payload,omitempty"`

	// Reason optionally carries a human readable explanation when the user
	// declines an elicitation. It is empty for accept actions.
	Reason string `json:"reason,omitempty"`
}

ElicitResult represents the outcome of the elicitation prompt.

type ElicitResultAction

type ElicitResultAction string

ElicitResultAction defines the action selected by the user after the elicitation process finished.

const (
	// ElicitResultActionAccept indicates that the user supplied a payload that
	// satisfies the schema and accepted the request.
	ElicitResultActionAccept ElicitResultAction = "accept"

	// ElicitResultActionDecline signals that the user declined to provide a
	// payload.
	ElicitResultActionDecline ElicitResultAction = "decline"
)

type Elicitation

type Elicitation struct {
	mcpproto.ElicitRequestParams `json:",inline"`
	// CallbackURL is a server-relative URL that the UI can POST to
	// with a body {action, payload} to resolve this elicitation.
	// It is optional and, when present, preferred over generic
	// form submission so both LLM- and tool-initiated prompts share
	// a unified posting contract.
	CallbackURL string `json:"callbackURL,omitempty"`
}

Elicitation describes a request to obtain a user-supplied payload that conforms to the supplied JSON Schema document (Schema field). The struct embeds mcp-protocol’s ElicitRequestParams so that callers that already work with the full protocol can freely convert between the two without manual copying.

Only a subset of the original fields is actually used by Agently today. The additional Schema string is a convenience copy of RequestedSchema encoded as a single JSON document so that generic front-ends (CLI/stdio) do not have to reconstruct it from the sub-fields.

func (*Elicitation) IsEmpty

func (e *Elicitation) IsEmpty() bool

IsEmpty reports whether the elicitation is effectively empty (i.e. there is nothing to ask the user). The heuristic is intentionally simple so that it does not require full JSON-Schema parsing.

type Plan

type Plan struct {
	ID          string       `yaml:"id,omitempty" json:"id,omitempty"`                   // Unique identifier for the plan
	Intention   string       `yaml:"intention,omitempty" json:"intention,omitempty"`     // Optional summary of the user’s goal
	Steps       Steps        `yaml:"steps" json:"steps"`                                 // Ordered list of steps to execute
	Elicitation *Elicitation `yaml:"elicitation,omitempty" json:"elicitation,omitempty"` // Optional elicitation details if user input is needed
}

Plan represents an ordered strategy composed of one or more steps.

func New

func New() *Plan

func (*Plan) IsEmpty

func (p *Plan) IsEmpty() bool

func (*Plan) IsRefined

func (p *Plan) IsRefined() bool

IsRefined returns true if the plan has been refined beyond a single noop step.

type Step

type Step struct {
	ID      string                 `json:"id,omitempty" yaml:"id,omitempty"`
	Type    string                 `yaml:"type" json:"type"`                         // "tool", "elicitation", "abort" etc.
	Name    string                 `yaml:"name,omitempty" json:"name,omitempty"`     // Tool/function name (if applicable)
	Args    map[string]interface{} `yaml:"args,omitempty" json:"args,omitempty"`     // Tool arguments matching tool schema
	Reason  string                 `yaml:"reason,omitempty" json:"reason,omitempty"` // Explanation of the step
	Content string                 `yaml:"content,omitempty" json:"content,omitempty"`

	// Structured elicitation payload (when Type=="elicitation").
	Elicitation *Elicitation `json:"elicitation,omitempty"`

	// Retries specifies how many times to retry this tool on error or empty result
	Retries int `yaml:"retries,omitempty" json:"retries,omitempty"`

	// ResponseID carries the provider response.id of the assistant message
	// that requested this tool call (continuation anchor).
	ResponseID string `json:"responseId,omitempty" yaml:"responseId,omitempty"`
}

Step represents a single atomic action in a Plan.

type Steps

type Steps []Step

func (Steps) EnsureID

func (s Steps) EnsureID()

func (Steps) Find added in v0.2.0

func (s Steps) Find(id string) *Step

func (Steps) Len

func (s Steps) Len() int

func (Steps) ToolStepCount

func (s Steps) ToolStepCount() int

Jump to

Keyboard shortcuts

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