Skip to content

Commit 638ed55

Browse files
committed
docs(actors): document manual lifecycle controls
1 parent 498c0f7 commit 638ed55

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

website/src/content/docs/actors/lifecycle.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,28 @@ The platform may force an actor to migrate to a new machine during version upgra
739739

740740
Use `onSleep`, `waitUntil`, or `keepAwake` to control the length of the grace period before the actor moves to another machine.
741741

742+
### Manual Lifecycle Controls
743+
744+
You can also trigger lifecycle transitions from the Rivet Cloud API. These endpoints are useful for operational workflows, debugging, and forcing an actor to move through the same sleep or reschedule path that the platform would normally trigger.
745+
746+
```bash
747+
curl -X POST \
748+
"https://cloud-api.rivet.dev/actors/$ACTOR_ID/sleep?namespace=$NAMESPACE" \
749+
-H "Authorization: Bearer $RIVET_TOKEN" \
750+
-H "Content-Type: application/json" \
751+
-d '{}'
752+
```
753+
754+
```bash
755+
curl -X POST \
756+
"https://cloud-api.rivet.dev/actors/$ACTOR_ID/reschedule?namespace=$NAMESPACE" \
757+
-H "Authorization: Bearer $RIVET_TOKEN" \
758+
-H "Content-Type: application/json" \
759+
-d '{}'
760+
```
761+
762+
`/sleep` asks the actor to enter the normal sleep shutdown sequence. `/reschedule` asks the platform to allocate the actor again, which is useful after crashes or when you need to force a fresh placement. Both endpoints require the actor ID and namespace.
763+
742764
### Keeping the Actor Awake
743765

744766
RivetKit gives you two primitives for holding the actor awake across background work. Both take a `Promise` and differ in how they interact with idle sleep and the grace period.

0 commit comments

Comments
 (0)