> ## Documentation Index
> Fetch the complete documentation index at: https://docs.capsule.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Build AI Apps In Python

> 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.

> [card] [Chat Apps](https://docs.capsule.new/features/chat-and-sessions.md)
>
> Build assistants with persistent session history, streaming replies, uploads, integration prompts, and user identity.

> [card] [Pages And UI](https://docs.capsule.new/features/pages.md)
>
> Add dashboards, tables, settings, task boards, workflow screens, or custom React pages to the same app.

> [card] [State And Data](https://docs.capsule.new/features/collections.md)
>
> Store queryable records in collections, keep lightweight session state, and expose data handlers to pages.

> [card] [Runtime And Deploy](https://docs.capsule.new/build/deploy-an-app.md)
>
> Deploy one app definition into sandboxed per-user runtimes with packages, filesystems, tasks, schedules, and secrets.

## prod setup

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:

```bash theme={null}
capsule create my-app --template quickstart
cd my-app
uv sync
```

Add any required secrets printed by the template:

```bash theme={null}
capsule secret create ANTHROPIC_API_KEY=sk-ant-...
```

Deploy the same package entry point:

```bash theme={null}
capsule deploy app.py:app
```

The 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.

## templates

Start with the product shape closest to what you want to ship.

* `quickstart` for a chat app grounded in packaged context files with BAML.
* `media-studio` for fal.ai image generation displayed directly in chat.
* `browser-agent` for visible browser workflows and agent-assisted browsing.
* `background-agent` for scheduled or on-demand agent loops with a results page.

## learn by building

Start with the shortest path, then add one product surface at a time.

* [Quickstart](https://docs.capsule.new/quickstart.md) gets a working app on screen.
* [First Chat App](https://docs.capsule.new/build/first-chat-app.md) teaches the message loop.
* [Add Data And State](https://docs.capsule.new/build/add-data-and-state.md) introduces session data and collections.
* [Add Pages](https://docs.capsule.new/build/add-pages.md) turns the app into a product surface.
* [Connect Services](https://docs.capsule.new/build/connect-services.md) adds integrations, secrets, and filesystems.
* [Background Work](https://docs.capsule.new/build/background-work.md) adds tasks and schedules.
* [Deploy An App](https://docs.capsule.new/build/deploy-an-app.md) ships the app.

## feature pages

Use these when you know the feature you need.

* [Chat And Sessions](https://docs.capsule.new/features/chat-and-sessions.md)
* [Pages](https://docs.capsule.new/features/pages.md)
* [Collections](https://docs.capsule.new/features/collections.md)
* [Integrations](https://docs.capsule.new/features/integrations.md)
* [Tasks And Schedules](https://docs.capsule.new/features/tasks-and-schedules.md)
* [Channels](https://docs.capsule.new/features/channels.md)
* [Workflows](https://docs.capsule.new/features/workflows.md)
* [Pricing And Payments](https://docs.capsule.new/features/pricing-and-payments.md)
* [CLI Reference](https://docs.capsule.new/reference/cli.md)

## examples

Capsule includes examples you can copy from in project templates and example apps:

* `quickstart` for a BAML-backed assistant with packaged context
* `media-studio` for generated media in chat
* `browser-agent` for browser workflows
* `background-agent` for scheduled agent loops


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.