Message concept in Chainlit
A Message is a piece of information sent from the user to an assistant and vice versa. Messages are the building blocks of a chat, coupled with lifecycle hooks. Each message has content, a timestamp, and cannot be nested.
website·Indexed Apr 14, 2026
https://docs.chainlit.io/Chainlit is an open-source Python framework for building conversational AI applications and LLM-powered interfaces. Documentation covers getting started guides, deployment, core concepts including LangChain integration, and advanced features like authentication, data persistence, backend customization, streaming, multi-modality, and MCP integration. Includes comprehensive API references for actions, chat profiles, elements (audio, file, image, PDF, Plotly, Pyplot, Dataframe), and custom data layers.
config.ui.cot setting, which can show the full chain, hide it, or show only tool calls.pip install --upgrade chainlit.CHAINLIT_AUTH_SECRET environment variable using chainlit create-secret to generate a secret string for signing authentication tokens. Changing this secret logs out all users. (2) Add one or more authentication callbacks to your app. Each callback takes different input and optionally returns a cl.User object. If the callback returns None, authentication fails. Ensure each user has a unique identifier to prevent data sharing.Commands capture user intent in a deterministic way. They have the following attributes:
cl.user_session.set(key, value) to store data and cl.user_session.get(key) to retrieve it. This avoids the problem of shared global state where multiple concurrent users would overwrite each other's data.