You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-20Lines changed: 28 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,10 +143,10 @@ There are six types of Live Activities:
143
143
144
144
-`stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
145
145
-`metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
146
-
-`timer`: best for countdowns and elapsed timers, like benchmark runs, cooking timers, workouts, soak windows, and long-running jobs
147
146
-`segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
148
147
-`progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
149
148
-`alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
149
+
-`timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs
Use `duration_seconds` for a countdown. Omit `counts_down` for the default countdown behavior, or set `counts_down=False` for an elapsed timer.
257
-
258
-
```python
259
-
activitysmith.live_activities.stream(
260
-
"benchmark-run",
261
-
content_state=content_state(
262
-
title="Benchmark Run",
263
-
subtitle="sampling performance",
264
-
type="timer",
265
-
duration_seconds=300,
266
-
color="cyan",
267
-
),
268
-
)
269
-
```
270
-
271
-
Later updates can change the title, subtitle, color, icon, or action without resetting the timer. Include `duration_seconds` again only when you want to restart the timer window from that update.
alt="Timer Live Activity showing a benchmark run countdown"
283
+
width="680"
284
+
/>
285
+
</p>
286
+
287
+
```python
288
+
activitysmith.live_activities.stream(
289
+
"benchmark-run",
290
+
content_state=content_state(
291
+
title="Benchmark Run",
292
+
subtitle="sampling",
293
+
type="timer",
294
+
duration_seconds=300,
295
+
color="cyan",
296
+
),
297
+
)
298
+
```
299
+
300
+
For a countdown, send `duration_seconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `duration_seconds` out unless you want to change the timer.
301
+
302
+
To start at 00:00 and count up, set `counts_down: false` and leave out `duration_seconds`.
303
+
296
304
### End Live Activity
297
305
298
306
Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
0 commit comments