Add agent_send_async and agent_cancel tools for non-blocking delegation#797
Open
pbranchu wants to merge 2 commits intoRightNow-AI:mainfrom
Open
Add agent_send_async and agent_cancel tools for non-blocking delegation#797pbranchu wants to merge 2 commits intoRightNow-AI:mainfrom
pbranchu wants to merge 2 commits intoRightNow-AI:mainfrom
Conversation
Introduces two new built-in tools: - agent_send_async: dispatches a message to another agent in the background, returns immediately with a callback_id, and delivers the result as a follow-up message via an mpsc channel (consumed by channel adapters) - agent_cancel: aborts a pending async task by callback_id This enables voice and real-time channel adapters to acknowledge the user immediately while long-running delegations (email, calendar, etc.) complete in the background. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- test_async_tool_definitions_exist - test_async_tool_schema_has_required_params - test_cancel_tool_schema - test_agent_send_async_no_kernel_fails - test_agent_send_async_missing_caller - test_agent_cancel_missing_callback_id - test_agent_cancel_nonexistent_task - test_take_async_result_receiver_returns_once Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent_send_asynctool that dispatches messages to other agents in the background, returns immediately with acallback_id, and delivers the formatted result via an mpsc channel for channel adapters to consumeagent_canceltool to abort pending async tasks bycallback_idASYNC_TASKS(DashMap) for tracking/cancelling spawned tasks andASYNC_RESULT_TX/ASYNC_RESULT_RXchannel pair for result delivery to voice/real-time adapterstake_async_result_receiver()public API for channel adapters to wire up at startupTest plan
cargo build -p openfang-runtime --libcompiles cleanlycargo clippy -p openfang-runtime --lib -- -D warningspasses with zero warningsagent_send_asyncvia API, verify callback_id returned immediately and result delivered asynchronouslyagent_cancelwith valid callback_id, verify task is aborted🤖 Generated with Claude Code