feat: reply_to and silent flags for async inter-agent messages
Problem
In a multi-server setup where agents communicate cross-server via SSH + ask_agent_async.py, two issues arise:
1. Response routing (reply_to)
When Agent A on Server 1 sends an async message to Agent B on Server 2 via SSH, the sender field resolves to unknown (since the SSH context doesn't have the original agent identity). When Agent B replies back via SSH, the response handler lookup fails because sender=unknown doesn't match any registered handler.
Desired: A --reply-to AGENT flag that explicitly sets the target agent for response delivery, bypassing sender-based lookup.
2. Notification suppression (silent)
Every async inter-agent message triggers _notify_recipient() which sends "📥 Async task received from X" to the recipient's chat. In automated pipelines (e.g., code review flow), these system notifications clutter the chat. The user should only see the final result, not intermediate routing messages.
Desired: A --silent flag that suppresses _notify_recipient() for that message.
Proposed changes
AsyncSendOptions — add fields:
reply_to: str = ""— target agent for response deliverysilent: bool = False— suppress recipient notification
AsyncInterAgentTask — add matching fields, passed through from options.
AsyncInterAgentResult — add reply_to: str = "", used in _deliver_async_result() to look up the correct handler.
_deliver_async_result() — if result.reply_to is set, use it instead of result.sender for handler lookup.
_notify_recipient() — skip notification when task.silent or task.reply_to is set (automated flows don't need chat notifications).
internal_api.py — parse reply_to and silent from the JSON body of async send requests.
ask_agent_async.py — add CLI flags --reply-to AGENT and --silent.
Backward compatibility
Full. Without flags, behavior is unchanged. Both fields default to empty/false.
Use case
Automated cross-server workflows where:
- Writer agent (Server 1) triggers a review on Reviewer agent (Server 2) via SSH
- Reviewer completes work and sends result back via SSH with
--reply-to - Writer receives clean result without any system notifications in either chat
Shipped in v0.16.0.
ask_agent_async.py now accepts --reply-to <message_id> to thread the reply and --silent to suppress the user-facing notification while still delivering the message. Existing callers are unaffected (both flags are optional). Delivery logic uses result.reply_to or result.sender for handler lookup and early-returns the user-notification when either flag is set.