Interactive CLI users get this automatically. Running
praison "prompt" or praisonai tui launch now includes clarify in the default toolset (the new clarify group in Interactive Tools). No manual tools=[clarify] needed. The tool is auto-gated on a live interactive TTY, and withheld in headless / non-TTY / CI / JSON runs so scripted runs never block — the core best-judgment fallback then handles ambiguity. Set PRAISON_TOOLS_DISABLE=clarify, PRAISON_NO_CLARIFY=1, or ToolConfig(enable_clarify=False) to opt out.Behavior by Surface
clarify behaves differently on each surface.
Quick Start
1
Enable Clarify
2
With Custom Handler
How It Works
Channel Integration
CLI Usage
Bot Usage
On a bot turnclarify is already wired. The bot session binds a turn-scoped handler automatically, so no handler setup is needed.
When the agent calls clarify(...):
- The question and choices are recorded for this turn’s reply.
- The agent is told to end its turn by restating the question instead of guessing.
- If the agent did not emit its own
MessagePresentation, the choices are attached asMessagePresentation.question(question, choices)and render as native reply buttons. - The user’s tap or typed reply arrives as the next turn’s input.
Custom Surfaces: set_clarify_handler
Bind a handler for one turn on any surface you own, such as a web UI or a custom chat adapter.
- The binding is turn-scoped (a
ContextVar), so concurrentasynciotasks never see each other’s handlers. - An explicitly configured handler (
ClarifyTool(handler=...)orctx["clarify_handler"]) still wins. The bound handler is used only by the shared defaultclarifyinstance. - Always call
reset_clarify_handler(token)in afinallyblock.
Custom Context Handler
Handler Resolution
The tool resolves the handler in this order:- Context handler:
kwargs["ctx"]["clarify_handler"](highest priority) - Explicit tool handler:
ClarifyTool(handler=...) - Bound handler: set with
set_clarify_handler(...), used only when the tool has no explicit handler - Default:
ClarifyHandler()returns the best-judgment fallback string
Configuration Options
Tool Schema
Bot Auto-Approval
clarify tool is included in the bot’s default auto-approve list, so it won’t require manual approval in bot environments.
Common Patterns
Progressive Clarification
Context-Aware Questions
Fallback Behavior
The"No interactive channel" string is returned only when no handler is configured and none is bound, which means a truly headless run.
On a bot turn the fallback string never appears, so a branch that keys off
"no interactive channel" does not fire there. Use it as a headless-only default.Best Practices
Use Sparingly
Use Sparingly
Only call clarify when you genuinely cannot proceed without user input. Don’t ask for preferences that have reasonable defaults.Good: “Which API endpoint format?” when building an API
Bad: “Should I use descriptive variable names?” (obvious default)
Provide Clear Choices
Provide Clear Choices
When possible, offer specific choices rather than open-ended questions.Good:
choices=["fastapi", "flask", "django"]
Bad: "What Python web framework should I use?" (no choices)Handle Fallbacks Gracefully
Handle Fallbacks Gracefully
For headless runs, check if the response indicates no interactive channel and proceed with a sensible default.
Context-Aware Questions
Context-Aware Questions
Frame questions with enough context for users to make informed decisions.Good: “Which authentication method for your user API?”
Bad: “Which auth?” (unclear context)
Related
Ask Conversation
Ask another chat (not the current user) and wait for its reply
Tools Overview
Core tool system and custom tools
Agent Configuration
Agent setup and tool integration
Bot Default Tools
Tools every messaging bot gets out of the box
Gateway Status Tool
Report gateway health from inside a bot turn
How clarify plugs into the default
praison "..." / TUI toolset and its TTY gating.
