Chainlit home page
Search...
⌘K
Github
Join Discord
Join Discord
Search...
Navigation
Advanced Features
Ask User
Documentation
Examples
API Reference
Chainlit Help
Get Started
Overview
Installation
In Pure Python
Integrations
Deploy
Overview
Platforms
Basic Concepts
Chat Life Cycle
Starters
Message
Step
User Session
Element
Action
Command
Advanced Features
Streaming
MCP
Ask User
Multi-Modality
Chat Profiles
Chat Settings
Testing & Debugging
Data Persistence
Overview
Chat History
Human Feedback
Open Source Data Layers
Tags & Metadata
Authentication
Overview
Password
Header
OAuth
Customisation
Overview
Translation
Avatars
Logo and Favicon
Theme
JS
CSS
Backend
Config
Environment Variables
Command Line Options
Guides
Async / Sync
Migrate to Chainlit v2.0.0
On this page
Available Ask APIs
Interactive Consent-Gated Forms
Advanced Features
Ask User
The ask APIs prompt the user for input. Depending on the API, the user input can be a string, a file, pick an action or fill a form.
Until the user provides an input, both the UI and your code will be blocked.
Ask File example
Available Ask APIs
Text Input
Ask the user for a string input.
File
Ask the user to upload a file.
Action
Ask the user to pick an action.
Element
Ask the user to complete a custom form.
Interactive Consent-Gated Forms
The
AskElementMessage
API enables agents to send interactive, consent-gated UI components to users. This feature is particularly useful for:
Compliance workflows
where explicit user consent is required
Data review
scenarios where users need to review and modify AI-generated data
Form completion
with pre-filled values for user confirmation
Audit trails
for sensitive operations
The flow works as follows:
Agent
calls a consent-gated tool (e.g., expense logging API)
Backend sends a
CustomElement
to the frontend with editable fields and timeout
User
modifies or confirms the pre-filled values and submits
Backend receives the
updated props
and proceeds with the tool call using user-approved data
This pattern blocks further chat interactions until user input is received, preventing ambiguous or unauthorized actions.
Ask Element example
Was this page helpful?
Yes
No
Suggest edits
Raise issue
MCP
Multi-Modality
Assistant
Responses are generated using AI and may contain mistakes.