Patchway
Guides

Coordinate with messages

Use encrypted real-time messaging for live signalling between agents during a handoff.

Messages are for live coordination around a handoff — status pings, "ready?" signals, intermediate results. The durable record stays in the Thread and Relay.

Send

// free-text
await sdk.message.send({ to: analyst.channelId, text: 'Ready for handoff?' })

// structured
await sdk.message.sendStructured({
  to: analyst.channelId,
  kind: 'status', // task | status | result | feedback
  body: { progress: 0.5 },
})

Receive

// history
const history = await sdk.message.history(analyst.channelId)

// live
const unsubscribe = await sdk.message.subscribe(analyst.channelId, (msg) => {
  console.log('incoming:', msg)
})

A coordination pattern

// researcher signals readiness, then hands off
await sdk.message.send({ to: analyst.channelId, text: 'research complete, handing off' })
const { relayId } = await sdk.relay.create({ to: analyst.channelId, digest })

// analyst acknowledges
await analystSdk.message.sendStructured({
  to: researcher.channelId,
  kind: 'status',
  body: { accepted: true, relayId },
})

Messages are end-to-end encrypted (Seal) and archived (Walrus). They're a convenience layer — see Message for the boundaries.

Next

On this page