Skip to Content
ConceptsObserving a simulator

Concepts

Observing a simulator

Every simulator records what it holds, what it was asked and what it would have sent. The examples use the Stripe simulator with one request made; every simulator serves the same routes.

rystic pull stripe-twin
PORT=$(rystic run stripe-twin -d --name observe --port 0 --scenario design_studio --json | jq -r .data.port)
curl -s localhost:$PORT/v1/customers -u sk_test_twin: -d email=ada@example.com | jq -r .id
# -> cus_lllllllllllllc
WantRead
The whole stateGET /_rystic/inspect
Every request your code madeGET /_rystic/calls
A live feed of requests, effects and control callsGET /_rystic/events, rystic tail
What it would have sent outGET /_rystic/egress
Whether your app is done reactingGET /_rystic/settle, rystic settle
All of it in a browser/_rystic/ui
The API in a browser/_rystic/swagger

State

GET /_rystic/inspect returns every register that holds a record, keyed by register, then by record key. An empty simulator returns {}.

curl -s localhost:$PORT/_rystic/inspect | jq -c 'map_values(length)'
# -> {..."state_charge":269,"state_customer":31,..."state_payment_intent":276,...}
  1. The dump posts back as a seed (How a seed lands).
  2. ?view=identities folds the alias keys a scenario files a user under, such as member on Slack and GitHub, into the user they name. Read with it; seed from the default dump, which keeps the aliases.
  3. GET /_rystic/registers describes each register (Registers).

Requests

GET /_rystic/calls lists every API request since the last reset, oldest first. Control-plane calls are not in it.

curl -s localhost:$PORT/_rystic/calls | jq -c '.calls[0] | del(.duration_ms)'
# -> {"actor":"member","args":{"email":"ada@example.com"},"at":"2026-03-01T00:00:00.001Z","method":"POST","ok":true,"path":"/v1/customers","principal":"","seq":1,"status":200,"template":"/v1/customers"}
  1. actor is the identity the request acted as, and principal the scenario user that actor maps to, or empty. template is the route it matched, args the arguments it carried, ok whether it succeeded and at the simulator’s clock. duration_ms is wall time, so it varies and the example leaves it out.
  2. total counts every call since the last reset.
  3. It keeps as many calls as the egress log keeps events (below).

Live feed

GET /_rystic/events is a Server-Sent Events stream of this simulator’s own requests, effects and control calls. It is not Kalshi’s Live feed, where the book tracks the exchange. Each event is an id: line and a data: line, of kind request, effect or control.

curl -sN localhost:$PORT/_rystic/events
# -> id: 1
# -> data: {"seq":1,"kind":"control","at":"2026-01-01T00:00:00Z","data":{"detail":null,"op":"reset"}}
# -> id: 2
# -> data: {"seq":2,"kind":"control","at":"2026-03-01T00:00:00Z","data":{"detail":{"frames":0,"name":"design_studio"},"op":"scenario"}}
# -> …
  1. On connect it sends up to the last 1,000 events since the last reset, then streams live.
  2. seq keeps counting across resets. Reconnect with Last-Event-ID: <seq> or ?cursor=<seq> to get only what came after.
  3. Not every write emits an effect event, and which ones do varies by simulator. Each simulator’s page lists the writes that do in its Coverage section, under Feed effects. Gmail emits one only when it sends mail (message.sent). Notion emits none, so watch its request events and read the record back.
  4. Some effects come from the simulator’s own activity rather than from one call, such as a scheduled Slack message or a Stripe test-clock advance.

rystic tail prints the same feed, one line per event, stamped with the simulator’s time of day:

rystic tail --addr http://localhost:$PORT
# -> 00:00:00.000 CTL reset
# -> 00:00:00.000 CTL scenario frames=0 name=design_studio
# -> 00:00:00.001 REQ POST /v1/customers -> 200 (0ms)
  1. The default shows writes and control calls. --events all adds reads (REQ GET …) and effects (FX customer.created …). CLI flag reference → tail lists the scopes.
  2. A detached simulator writes the same lines to its log: rystic logs -f observe.
  3. rystic tail -f rystic.yaml follows every simulator of a stack as one feed: Observing a project.

Egress

GET /_rystic/egress returns what the simulator would have sent out, in order: Stripe’s webhooks, Resend’s emails, Kalshi’s WebSocket frames. Webhooks covers them.

curl -s localhost:$PORT/_rystic/egress | jq -c '{total, dropped, types: [.events[].type]}'
# -> {"total":1,"dropped":0,"types":["customer.created"]}
  1. Each event carries seq, effect, type and payload. ?tail=N returns the last N.
  2. total counts everything emitted since the last reset; events may hold fewer.

Retention

  1. The log keeps 100,000 events by default. Beyond that the oldest drop, and dropped counts them: check it before trusting the log as complete.
  2. RYSTIC_EGRESS_RETAIN (rystic run --egress-retain) sets the bound at boot; POST /_rystic/egress-retain with {"retain":N} sets it at runtime. 0 removes it.
  3. GET /_rystic/version shows the bound as egress_retain. A reset empties both logs and keeps the bound.

Wait for your app to finish

Before you assert, wait until your app is done reacting. rystic settle <instance> asks GET /_rystic/settle once, prints the answer and exits 0 when settled, 1 when not:

rystic settle observe --quiet 1s
# -> settled: last call seq 1, idle ...ms
  1. Settled means no webhook or interaction delivery awaits your app’s acknowledgment, and no call, acknowledgment or reset has come for --quiet (quiet_ms, default 500 ms). At --timeout (timeout_ms, default 30 s) it returns not settled, naming what is still open. Both go up to 60 s.
  2. Calls made as the vendor’s own client (X-Rystic-Surface: client), from the state UI or by a timeline event never count. --principal watches only the calls of the actors or principals it names; repeat it for several.
  3. The answer’s last_call_seq is the last seq in /_rystic/calls. Settle before and after an action, and the calls between the two are your app’s turn.

The state UI

Open http://localhost:$PORT/_rystic/ui in a browser. Its cards:

  1. Activity: the live feed.
  2. Store: the state, register by register.
  3. Effects: the egress log.
  4. Network: the network profile, which it switches on and off and edits per endpoint (Network profiles → In the state UI).
  5. Reset, in the header, wipes the simulator as POST /_rystic/reset does.

A simulator with its own view of the vendor’s app, such as Stripe, Lob and PayPal, adds its cards above these; the simulator’s page describes them.

API explorers

/_rystic/swagger, linked from the state UI’s header, is Swagger UI over the vendor API specs the simulator ships, cut to the operations it serves. Every simulator adds the Rystic control plane’s spec of its /_rystic/ routes. Try it out sends each request to the simulator.

  1. GET /_rystic/version names the explorers a simulator serves under explorer. Linear also serves GraphiQL at /_rystic/graphiql.
  2. Both need the ui feature.

Done with the example: rystic stop observe.

Last updated on