User Prompt Tool
Overview
The user prompt tool allows agents to ask questions and collect input from users during execution.
- When the agent needs clarification before proceeding
- Collecting credentials or configuration values
- Presenting choices and getting user decisions
- Confirming destructive or important actions
Configuration
agents:
assistant:
model: openai/gpt-4o
description: Interactive assistant
instruction: |
You are a helpful assistant. When you need information
from the user, use the user_prompt tool to ask them.
toolsets:
- type: user_prompt
- type: filesystem
- type: shell
Tool Interface
The user_prompt tool takes these parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message |
string | ✓ | The question or prompt to display. |
title |
string | ✗ | Optional title for the dialog window in the TUI. Defaults to "Question" when not provided. |
schema |
object | ✗ | JSON Schema defining the expected response structure (object or primitive). |
Response Format
The tool returns a JSON response:
{
"action": "accept",
"content": {
"field1": "user value",
"field2": true
}
}
Action Values
| Action | Meaning |
|---|---|
accept |
User provided a response (check content) |
decline |
User declined to answer |
cancel |
User cancelled the prompt |
Schema Examples
Simple String Input
{
"type": "string",
"title": "API Key",
"description": "Enter your API key"
}
Multiple Choice
{
"type": "string",
"enum": ["development", "staging", "production"],
"title": "Environment",
"description": "Select the target environment"
}
Boolean Confirmation
{
"type": "boolean",
"title": "Confirm",
"description": "Are you sure you want to proceed?"
}
Object with Multiple Fields
{
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Your username"
},
"password": {
"type": "string",
"description": "Your password"
},
"remember": {
"type": "boolean",
"description": "Remember credentials"
}
},
"required": ["username", "password"]
}
Number Input
{
"type": "integer",
"title": "Port Number",
"description": "Enter the port number (1024-65535)",
"minimum": 1024,
"maximum": 65535
}
Example Usage
Here's how an agent might use the user prompt tool:
Agent: I need to deploy this application. Let me ask which environment to target.
[Calls user_prompt with message: "Which environment should I deploy to?"
and schema with enum: ["development", "staging", "production"]]
User selects: "staging"
Agent: Great, I'll deploy to staging. Let me confirm this action.
[Calls user_prompt with message: "Deploy to staging? This will replace the current version."
and schema with type: "boolean"]
User confirms: true
Agent: Deploying to staging...
UI Presentation
How the prompt appears depends on the interface:
- TUI: Displays an interactive dialog with appropriate input controls. The lean TUI shows the same form inline in place of the editor
- CLI (exec mode): Automatically declines form prompts; the agent must handle the decline without reading an answer from stdin
- API/MCP: Returns an elicitation request to the client
Provide clear, concise messages. Include context about why you're asking and what the information will be used for. Use schemas with descriptions to guide users on expected input format.
Handling Responses
The agent should handle all possible actions:
- accept: Process the
contentand continue - decline: Acknowledge and try an alternative approach or explain what's needed
- cancel: Stop the current operation gracefully
The user prompt tool requires an elicitation handler. The full and lean TUIs support interactive form prompts; API/MCP clients must implement elicitation. Exec mode declines form prompts automatically. Interactive OAuth authorization in exec mode is a separate flow, not support for user_prompt forms.