Skip to main content

Module mailbox

Module mailbox 

Source
Expand description

Asynchronous message passing between agents.

The MailboxHub manages per-agent mailboxes and a global sequence number (tokio::sync::watch<u64>) that notifies waiters when any result arrives.

§Architecture

Parent (LLM tools)                      Child (AgentRuntime task)
       │                                         │
       │  send_task() / send_message()           │
       ├────────────────────────────────────────►│ task_rx
       │                                         │
       │                      post_result()      │
       │◄────────────────────────────────────────┤ (via result_tx clone)
       │                                         │
       │  wait_for_result() watches seq_rx       │
       │  (blocks until seq changes)             │

Every post_result() increments the global sequence number, waking all wait_for_result() callers.

Structs§

ChildMailbox
The child-side handle to a mailbox.
MailboxHub
Central hub for inter-agent message passing.
MailboxResult
A result posted from child agent to parent.
MailboxTask
A task sent from parent to child agent.

Enums§

MailboxStatus
Status of a result posted from child to parent.