Installation
Install the ActivitySmith Python SDK with pip:Python
Usage
- Create an API key
- Set
ACTIVITYSMITH_API_KEYor pass it directly toActivitySmith. - Reuse the client anywhere you send pushes or Live Activity updates.
Python
Send a Push Notification
Useactivitysmith.notifications.send when a deploy finishes, a customer upgrades, or a background job needs attention. title is required. message and subtitle are optional.
Python
Rich Push Notifications with Media
Python
What will work:
- direct image URL:
.jpg,.png,.gif, etc. - direct audio file URL:
.mp3,.m4a, etc. - direct video file URL:
.mp4,.mov, etc. - URL that responds with a proper media
Content-Type, even if the path has no extension
media can be combined with redirection, but not with actions.
Actionable Push Notifications
Push notification redirection and actions are optional and can be used to redirect the user to a specific URL when they tap the notification or to trigger a specific action when they long-press the notification. Webhooks are executed by ActivitySmith backend.
Python
Live Activities

metrics: best for live operational stats like server CPU and memory, queue depth, or replica lagsegmented_progress: best for step-based workflows like deployments, backups, and ETL pipelinesprogress: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
Simple: Let ActivitySmith manage the Live Activity for you
Use a stablestream_key to identify the system or workflow you are tracking,
such as a server, deployment, build pipeline, cron job, or charging session.
This is especially useful for cron jobs and other scheduled tasks where you do
not want to store activity_id between runs.
Metrics

Segmented progress

Progress

stream(...) again with the same stream_key whenever the state changes.
End a stream
Use this when the tracked process is finished and you no longer want the Live Activity on devices.content_state is optional here; include it if you want
to end the stream with a final state.
stream(...) request with the same stream_key,
ActivitySmith starts a new Live Activity for that stream again.
Stream responses include an operation field:
started: ActivitySmith started a new Live Activity for thisstream_keyupdated: ActivitySmith updated the current Live Activityrotated: ActivitySmith ended the previous Live Activity and started a new onenoop: the incoming state matched the current state, so no update was sentpaused: the stream is paused, so no Live Activity was started or updatedended: returned byend_stream(...)after the stream is ended
Advanced: Full lifecycle control
Use these methods when you want to manage the Live Activity lifecycle yourself:- Call
activitysmith.live_activities.start(...). - Save the returned
activity_id. - Call
activitysmith.live_activities.update(...)as progress changes. - Call
activitysmith.live_activities.end(...)when the work is finished.
Metrics Type
Usemetrics when you want to keep a small set of live stats visible, such as
server health, queue pressure, or database load.
Start

Update

End

Segmented Progress Type
Usesegmented_progress for jobs and workflows that move through clear steps or
phases. It fits jobs like backups, deployments, ETL pipelines, and checklists.
number_of_steps is dynamic, so you can increase or decrease it later if the
workflow changes.
Start

Update

End

Progress Type
Useprogress when the state is naturally continuous. It fits charging,
downloads, sync jobs, uploads, timers, and any flow where a percentage or
numeric range is the clearest signal.
Start

Update

End

Live Activity Action
Just like Actionable Push Notifications, Live Activities can have a button that opens provided URL in a browser or triggers a webhook. Webhooks are executed by the ActivitySmith backend.
Open URL action
Python
Webhook action
Python
Channels
Target specific channels when sending a push or starting a Live Activity.Python
Error Handling
Wrap API calls withtry/except. The SDK raises exceptions for non-2xx responses. Rate limit errors use the error and message fields, and Live Activity limit errors include limit and active. See Rate Limits for details.
Additional Resources
PyPI Package
Install the ActivitySmith Python SDK from PyPI
Source Code
View the Python SDK source on GitHub