Skip to main content
Capsule uses the same Python entry point for local development and hosted deploys. capsule serve app.py:app starts the local dev loop. capsule deploy app.py:app ships the app. In hosted mode, Capsule runs the app in isolated per-user runtimes so each app user has their own sandboxed execution context.

1. Confirm the entry point

capsule serve app.py:app
app.py:app means:
  • module: app.py
  • symbol: app
Serve uploads the project, boots the app runtime, and hot-reloads as you edit watched files.

2. Create required resources

Create any resources your app declares before deploy:
capsule secret create OPENAI_API_KEY=sk-...
capsule fs create reports
capsule channel create support-telegram --type telegram -c bot_token=123:ABC
Then reference them in code:
app = cpsl.App(
    name="support-ops",
    image=cpsl.Image(python_packages=["openai"]),
    channels=[cpsl.Channel("support-telegram")],
    secrets=["OPENAI_API_KEY"],
    filesystems={"/data": cpsl.FileSystem("reports")},
)

3. Deploy

capsule deploy app.py:app
Deploy sends the app definition, runtime image, source archive, pages, integrations, schedules, secrets, filesystems, channels, and product settings to Capsule. The output includes the hosted URL.

4. Know what changes in hosted mode

The code stays the same, but requests now come from the hosted app:
  • users sign into this app’s own user pool
  • session.user is the current app user
  • access="authenticated" pages are gated
  • workspace secrets are resolved in the managed runtime
  • each app user gets an isolated runtime for agent work
  • filesystems and container-local files are available to code running in that runtime
  • declared channels can deliver messages to the app

5. Iterate

Make changes locally, serve again, then deploy the same entry point when ready.
capsule serve app.py:app
capsule deploy app.py:app

Next steps