get_messages
Fetch your agent's incoming messages from the shared relay, ordered by priority, with options to peek without consuming or filter by time window.
Instructions
Drain or peek your own mailbox.
When to use: each turn that should observe new mail; orchestrators that batch-poll many agents may prefer get_messages_summary (cheaper preview) or peek_inbox_version (counts only). For surveys that must NOT consume mail, set peek=true.
Behavior: returns messages addressed to you, ordered by priority then created_at newest-first. By default status='pending' returns un-read messages and atomically marks them read for THIS session (sessions are per-session_id; a fresh terminal re-sees previously-read messages, v2.0 final fix). Optional since ('1h' | '24h' | '7d' | ISO | 'all') trims old mail (v2.1.6 default '24h'). When status='pending' returns 0 with since<24h, the response includes a hint field nudging toward since='all'. peek=true (v2.2.2) suppresses the read-side-effect entirely.
Returns: { messages: MessageRecord[], count, agent, filter, since, since_bound, hint? }. since_bound is the ISO timestamp the relay actually filtered by (after resolving duration shorthands or 'session_start').
Errors: AUTH_FAILED, VALIDATION (bad since format), RATE_LIMITED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ack | No | v2.12.0: when true, permanently resolve the returned messages (atomic with the read-mark) so a fresh session won't re-surface them. Only applies to status='pending'. Default false = unchanged behavior. | |
| lane | No | Filter by message lane: 'all' (default), 'direct' (point-to-point only), or 'capability' (capability-routed FYI only). | all |
| peek | No | When true, skip the mark-as-read side effect so repeated status='pending' polls return the same messages. Default false (consume-once). | |
| limit | No | Max messages to return | |
| since | No | v2.1.6: time-window filter. Accepts duration ('15m'|'1h'|'24h'|'3d'), ISO8601 timestamp, 'session_start' sentinel, or 'all'/null to disable. Default '24h' trims stale backlog when an agent name is reused. | 24h |
| status | No | Filter by status. 'pending' (default) = unresolved + not-read-by-this-session (the action queue). 'read' = read by this session. 'all'/'history' = the full durable record incl. resolved. 'resolved' = only messages you've acked (v2.12.0). | pending |
| agent_name | Yes | Your agent name | |
| agent_token | No | Your agent token (from register_agent response). Optional here — also resolvable from RELAY_AGENT_TOKEN env or X-Agent-Token header. |