Skip to main content
Capsule chat is built around @app.message(). The handler receives:
  • session: the current conversation and user context
  • msg: the incoming user message

Basic reply

Model messages

Use session.chat_messages(msg) to turn Capsule history plus the current message into model-ready messages.

Streaming

For model streams, use:

Session state

Use session.data for lightweight state that belongs to one conversation.

Rich chat blocks

Use these when the assistant needs to show progress, ask for resources, or render structured results.

Uploads and integrations

Prompt methods block until the user completes the action or the prompt times out.