| title | Build AI Apps In Python |
|---|---|
| description | Capsule is a framework and hosted runtime for shipping AI apps with chat, pages, state, integrations, tasks, and auth. |
Capsule turns one Python app definition into a hosted AI product.
You write the app. Capsule deploys it as a hosted product where each app user gets an isolated, sandboxed runtime. Inside that runtime, your agents can use Python packages, container-local files, mounted filesystems, secrets, integrations, tasks, pages, and chat together.
Build assistants with persistent session history, streaming replies, uploads, integration prompts, and user identity. Add dashboards, tables, settings, task boards, workflow screens, or custom React pages to the same app. Store queryable records in collections, keep lightweight session state, and expose data handlers to pages. Deploy one app definition into sandboxed per-user runtimes with packages, filesystems, tasks, schedules, and secrets.Capsule is a serverless runtime for agent apps. You do not provision containers yourself; Capsule creates the isolated runtime your app needs when users chat, open pages, start workflows, or run scheduled work.
Create an agent app from a template:
capsule create my-app --template quickstart
cd my-app
uv syncAdd any required secrets printed by the template:
capsule secret create ANTHROPIC_API_KEY=sk-ant-...Deploy the same package entry point:
capsule deploy app.py:appThe deployed app gets a hosted URL, app-scoped sign-in, and the same chat handlers, pages, workflows, tasks, schedules, collections, secrets, and filesystems declared in Python. Each signed-in app user gets their own runtime context, so agents can work with files and long-running state without sharing another user's sandbox.
Start with the product shape closest to what you want to ship.
quickstartfor a chat app grounded in packaged context files with BAML.media-studiofor fal.ai image generation displayed directly in chat.browser-agentfor visible browser workflows and agent-assisted browsing.background-agentfor scheduled or on-demand agent loops with a results page.
Start with the shortest path, then add one product surface at a time.
- Quickstart gets a working app on screen.
- First Chat App teaches the message loop.
- Add Data And State introduces session data and collections.
- Add Pages turns the app into a product surface.
- Connect Services adds integrations, secrets, and filesystems.
- Background Work adds tasks and schedules.
- Deploy An App ships the app.
Use these when you know the feature you need.
- Chat And Sessions
- Pages
- Collections
- Integrations
- Tasks And Schedules
- Channels
- Workflows
- Pricing And Payments
- CLI Reference
Capsule includes examples you can copy from in project templates and example apps:
quickstartfor a BAML-backed assistant with packaged contextmedia-studiofor generated media in chatbrowser-agentfor browser workflowsbackground-agentfor scheduled agent loops