Documentation
¶
Overview ¶
Package agentmode provides a context provider that tracks the agent's operating mode (e.g. "plan" or "execute") in the session state and provides tools for querying and switching modes.
It enables agents to operate in distinct modes during long-running HITL tasks — for example, an interactive planning mode vs an autonomous execution mode.
Index ¶
- type Config
- type Mode
- type Provider
- func (p *Provider) Invoked(ctx context.Context, invoked agent.InvokedContext) error
- func (p *Provider) Invoking(ctx context.Context, invoking agent.InvokingContext) ([]*message.Message, []agent.Option, error)
- func (p *Provider) Mode(session *agent.Session) string
- func (p *Provider) SetMode(session *agent.Session, mode string, disableNotification bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Modes is the set of available modes. If nil, defaults to "plan" and "execute".
// An empty, non-nil slice is invalid.
Modes []Mode
// DefaultMode is the initial mode. Must be one of the configured Modes.
// If nil, the first mode is used.
DefaultMode *string
// Instructions overrides the default instruction template.
// Use {available_modes} and {current_mode} as placeholders.
Instructions *string
// DisableModeSetTool omits the built-in mode_set tool while retaining mode
// state and instructions.
DisableModeSetTool bool
// DisableModeGetTool omits the built-in mode_get tool while retaining mode
// state and instructions.
DisableModeGetTool bool
}
Config configures the agent mode provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is an agent mode context provider. Use New to create. Provider can be used directly in agent configuration.
func New ¶
New creates a new agent mode context provider. A zero-value Config uses defaults (plan/execute modes).
Panics if the configuration contains duplicate names, an empty mode name or instructions, or a default mode that is not in the configured set.
func (*Provider) Mode ¶ added in v0.1.1
Mode returns the current operating mode from session state. If no state has been persisted yet, it returns the configured default mode.