Skip to content

ask_user — ask the user a clarifying question

ask_user hands control back to the user via a configured callback. Use it when the agent genuinely needs a decision — a destination directory, a yes/no on a risky action, a choice between equivalent approaches — and not for filler check-ins.

ArgTypeRequiredDescription
questionstringyesThe question to ask.
choicesarray[string]noOptional choices to render as a pick-list.
from chimera.tools.ask_user import AskUserTool
def cli_prompt(question: str, choices: list[str] | None) -> str:
print(question)
if choices:
for i, c in enumerate(choices, 1):
print(f" {i}) {c}")
return input("> ").strip()
tool = AskUserTool(callback=cli_prompt)

Without a callback, the tool raises an error — the protocol is “configure or don’t enable”.

{
"question": "Run the migration against production?",
"choices": ["yes", "no", "dry-run first"]
}
dry-run first

(The raw user response, as a string.)

  • Pair with the Wire channel for GUI front-ends — the wire’s UserQuestion / UserAnswer messages map onto this tool.
  • For permission-style prompts (“approve this bash command?”), use the Permissions layer instead — it integrates with auditing.