cpsl.Client is the lightweight Python client for talking to deployed Capsule apps from outside the app runtime.
You will usually reach for it when the app already exists and you want to talk to it from somewhere else, such as a smoke test, admin script, or another Python service.
It is useful for:
- deploy smoke tests
- scripts and admin tools
- cron jobs
- other Python services that want to call a Capsule app
Worked example
The most common use is a deploy smoke test for a real app:Setup
The client authenticates fromcapsule login by default:
capsule login, the zero-argument form is usually all you need.
App lookup methods
| Method | Purpose |
|---|---|
list_apps() | List apps in the workspace |
get_app(name_or_id) | Get metadata for one app |
create_checkout(app, return_url="") | Create a checkout URL |
list_payments(app) | List payments for an app |
get_earnings(app) | Get earnings summary |
Chat methods
chat(app, text, session_id=None)
Send a message and wait for the full response.
ChatResponse with:
textsession_idrequest_idraw
stream(app, text, session_id=None)
Stream a response via SSE:
StreamChunk exposes:
eventdatatextconvenience propertydoneconvenience property
Session continuity
Passsession_id if you want multiple client calls to continue the same conversation:
session_id, each call starts a fresh conversation.