Skip to content
OpenPulseDocs

Agents

Wakes

Wake an agent when something happens, deliver each wake once, and act only after your own trust check.

A wake tells an agent that something happened: a payment completed, a job finished, a document changed. It arrives on the same session as everything else, is delivered once per id, and never blocks the next one.

Receive#

TypeScript
pulse.onWake(async (wake) => {  // wake: { trigger_id, kind, subject, payload, issued_at, policy_ref?, reason? }  if (seen.has(wake.trigger_id)) return            // idempotent: safe across reconnects  if (!(await trusted(wake))) return               // a wake is a notice, not an authorization  await act(wake)})

Subscribe before you do anything that produces wakes, such as pulse.pay.send. Named agents get their own wake room: await pulse.agent('billing') returns an agent with its own onWake and run.

Send#

TypeScript
const wakes = pulse.triggers('billing')await wakes.emit({  schema: 'openpulse.trigger.v1',  trigger_id: crypto.randomUUID(),  kind: 'job.done',  subject: 'export-4411',  payload: { rows: 18210 },  issued_at: new Date().toISOString(),})

Rules that keep agents safe#

DoInstead of
Check trust before acting on a wakeTreating a wake as permission
Make handlers idempotent on trigger_idActing twice after a reconnect
Require a person’s step-up for money and keysLetting an agent approve its own payment
Scope wake rooms per tenant and agentOne room every agent reads

Payment wakes#

pay.send delivers payment.completed, payment.failed, payment.returned and, for bank and asset legs, settlement.completed. None of them authorizes anything.