Expand description
Agent-loop tool that sends a message to a configured peer on a shared channel.
Validates the target against crate::peers::ResolvedPeers for
the calling agent on the requested channel: peers must mutually
opt in via a [peer_groups.<name>] block whose agents lists
both, OR appear on the group’s external_peers list, before this
tool will deliver. Cross-channel sends from outside the resolver’s
authorization surface are rejected.
Delivery splits by target type:
-
Agent-alias targets route in-process via
crate::agent::loop_::process_message: alpha callssend_message_to_peer(target = "beta", ...)and beta’s agent loop runs the message. The two agents share the channel’s bot identity, so an outbound to the channel would loop the bot’s own handle back through inbound; the in-process path avoids that and lets the orchestrator deliver beta’s reply (if any) through the same channel beta is configured on.This path is fire-and-forget: the recipient runs on a detached
tokio::spawn, so the sender’sToolResult.success = truemeans “accepted for processing”, not “completed”. Recipient errors do NOT surface to the sender; they are emitted viatracing::warn!inside the spawned task and via the recipient agent’s own observability (audit log, runtime trace, channel reply). Observers diagnosing a missing peer message should look at the recipient’s spans, not the sender’s tool output. -
External peers (humans, external bots) route through
crate::cron::scheduler::deliver_announcementwith the external username as the platform target. The channel registry the binary registers at startup forwards the send to the live channel instance. This path is synchronous: thedeliver_announcementfuture resolves before the tool returns, so asuccess = falsehere genuinely reflects a delivery failure.
Structs§
- Send
Message ToPeer Tool - Send a message to a peer on a shared channel. Bound to a single calling agent’s alias; the tool validates every send against that agent’s resolved peer set.