Documentation
¶
Overview ¶
Package ask contributes the `ask` tool: the agent poses a structured question to the human — a prompt plus labeled options, optionally multi-select — and the run parks until the answer arrives.
Parking is a loop mechanism, not a block: Run returns agentcore.ErrParked, the loop records an EntryQuestion for the call and ends the run WITHOUT a tool result, leaving the call dangling in the durable log. The answer arrives out-of-band as an EntryAnswer keyed on the same call id; a resumed run closes the dangling call with that answer as its tool result — the model sees the human's reply exactly as if the tool had returned it. A resume that finds the question still unanswered re-issues the call (the tool is retry-safe), which parks the run again on the same question.
The tool is advertised only where a human can answer — the host wires it on chat-triggered runs and leaves it off scheduled/webhook/delegate/manual runs. It is self-gated: it returns nothing but what the user typed, so it cannot reach anything the run does not already have.
Index ¶
Constants ¶
const ToolName = "ask"
ToolName is the model-visible identifier.
Variables ¶
This section is empty.
Functions ¶
func QuestionText ¶
func QuestionText(raw json.RawMessage) string
QuestionText renders the bounded question for hosts with a plain-text human channel. Structured clients may render the original payload directly.
Types ¶
type Option ¶
type Option struct {
Label string `json:"label"`
Description string `json:"description,omitempty"`
}
Option is one labeled choice the human can pick.
type Plugin ¶
type Plugin struct{}
Plugin offers questions on an interactive top-level run. Delegated children report missing information to their parent, which owns the human channel.
type Tool ¶
type Tool struct{}
Tool is the ask capability. It carries no state: everything durable lives in the session log the loop writes, so the same value serves every run.
func (Tool) PiArgumentPreparation ¶
PiArgumentPreparation selects this plugin's bundled synchronous Pi hook.
func (Tool) PrepareArguments ¶
PrepareArguments normalizes the raw call before validation: clamps bound the question and options so the durable EntryQuestion records the form the human actually sees.
func (Tool) RetrySafe ¶
RetrySafe makes a dangling ask re-issue on resume: re-parking on the same question is the correct recovery when the answer never arrived.
func (Tool) Run ¶
Run never produces a result: a valid call parks the run. The answer reaches the model through the durable log (EntryAnswer), not through this return.
func (Tool) Schema ¶
func (Tool) Schema() agentcore.ToolSchema
Schema advertises the tool to the model.