- one model call
- one webhook
- one chat handler
The shape of a real app
Here is the important idea: The assistant is only one part of the system. Capsule lets all of those parts live in the same app definition.1. The app shell defines the product
In a real app,cpsl.App(...) is where the product comes together:
- the runtime lives here
- integrations live here
- state lives here
- settings live here
- pages live here
- the assistant logic plugs into the same app
2. Pages are workflow surfaces, not marketing pages
Real AI products usually need at least two kinds of UI:- a high-level dashboard for status, settings, and task visibility
- one or more workflow pages where operators actually review, triage, or act on data
ui.Toggle(...)for operator settingsui.Metric(...)for statusui.TaskBoard(...)for background work visibility
- use the Python DSL for dashboards, tables, settings, and lightweight workflow UI
- use a React page when the product needs something richer, like a mailbox, queue, or review surface
3. @app.data(...) powers product UI
Many real apps need pages that talk to external systems. Capsule’s @app.data(...) handlers are the bridge between product UI and runtime logic.
That can look like this:
- it knows who the caller is through
RequestContext - it can use the caller’s connected integrations
- it can feed a workflow page directly
4. Chat is an orchestrator
In toy apps, chat is the whole app. In real apps, chat is often the orchestrator that decides what should happen next. A strong pattern looks like this:- the assistant can route
- the assistant can trigger deterministic product actions
- the assistant can still fall through to a normal streamed answer
5. Tasks and schedules run the operational loop
Real apps almost always need work that should not happen inline inside a chat turn:- sending outreach
- syncing systems
- polling inboxes
- generating reports
- processing attachments
- chat or page action submits a task
- task talks to integrations and updates collections
- the dashboard or workflow page reflects the new state
- a schedule keeps the system moving in the background
TaskBoard matters because it makes that asynchronous work visible to the operator instead of hiding it in logs.
6. AI does judgment, Python does control
This is the most important mindset shift. In a solid Capsule app:- AI handles classification, drafting, extraction, and analysis
- Python handles filters, retries, limits, state transitions, scheduling, and external I/O
- if the job is “understand or generate language,” reach for the model
- if the job is “decide whether we are allowed to do this, how many rows to process, when to retry, or what status to store,” keep that in ordinary code
7. What to copy from this pattern
You do not need to build an outreach tool to use Capsule well. But you probably do want to copy these habits:- put your product shape on
App(...)early - add collections and pages sooner than you think
- treat chat as one surface, not the whole product
- use
@app.data(...)for integration-backed workflow pages - keep task logic observable with
TaskBoard - let AI do interpretation and drafting, but keep business control flow deterministic