peek_inbox_version
Check mailbox version and unread count to detect new mail without fetching full messages, triggering a full retrieval only when the count changes.
Instructions
Cheap non-mutating mailbox version probe (v2.3.0 Phase 4s, ambient wake support).
When to use: low-rate polling that wants to know 'do I have new mail?' without paying a get_messages round-trip, clients diff total_unread_count against their cached value and only call get_messages on a change. Pair with the optional filesystem-marker wake (when RELAY_FILESYSTEM_MARKERS=1) for low-latency idle wake. For full mailbox content use get_messages (mutating) or get_messages_summary (preview).
Behavior: pure read. Returns { mailbox_id, epoch, last_seq, total_messages_count, total_unread_count }. WATCH total_unread_count for new-mail detection, it advances on every send_message/broadcast to this agent. last_seq only advances when the recipient calls get_messages (read-cursor). epoch rotates on backup/restore, a client whose cached epoch no longer matches MUST reset its local last_seen_seq to 0 and re-drain. Auth: any agent token.
Returns: { success: true, mailbox_id, epoch, last_seq, total_messages_count, total_unread_count }.
Errors: AUTH_FAILED, NOT_FOUND (unknown agent_name), RATE_LIMITED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_name | Yes | The agent whose mailbox to observe | |
| agent_token | No | Your agent token (from register_agent response). Optional here — also resolvable from RELAY_AGENT_TOKEN env or X-Agent-Token header. |