Add agent_send_async with channel-agnostic callback delivery#797
Open
pbranchu wants to merge 3 commits intoRightNow-AI:mainfrom
Open
Add agent_send_async with channel-agnostic callback delivery#797pbranchu wants to merge 3 commits intoRightNow-AI:mainfrom
pbranchu wants to merge 3 commits intoRightNow-AI:mainfrom
Conversation
Member
|
Reviewed and approved. This PR has merge conflicts with recent changes on main. Please rebase onto current main and we will merge it. |
757f54b to
f77c688
Compare
Member
|
Reviewed and approved. Has merge conflicts with recent changes on main. Please rebase and we will merge immediately. |
024c26a to
e9c4e4a
Compare
13 tasks
Contributor
Author
Update needed: channel-agnostic callback deliveryThe current implementation delivers async delegation results via a voice-only channel ( Design and implementation plan in #891 — the fix routes callbacks through the channel bridge using the existing per-turn system prompt injection mechanism. Key changes:
Will update this PR with the fix. |
16c7a72 to
77fe35c
Compare
Add asynchronous agent delegation via agent_send_async and agent_cancel tools. When an agent delegates work asynchronously, the caller's channel context (channel type, recipient, thread) is captured and stored so the result can be delivered back to the originating channel when the delegate finishes. This avoids blocking the caller's conversation during long- running tasks. Key changes: - ChannelCallbackContext struct in openfang-types - get/set_channel_context + inject_async_callback on KernelHandle trait - agent_send_async / agent_cancel tools in tool_runner - Channel bridge stores context before each send_message call - Kernel implements inject_async_callback: sends result to agent, then delivers agent's response to the originating channel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77fe35c to
2c69fa5
Compare
MALFORMED_FUNCTION_CALL is a transient generation quality issue — the model tried to call a tool but produced invalid JSON. Previously classified as LlmError::Parse (non-retryable, fatal). Now classified as LlmError::Overloaded (retryable) so the agent loop retries automatically. This is especially important with large tool sets where the model occasionally generates malformed calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0ffe4b3 to
f6aec42
Compare
This reverts commit 8883467.
f6aec42 to
d21d77e
Compare
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 for non-blocking delegation to other agents (hands)agent_canceltool to abort in-flight delegationsDesign
When
agent_send_asyncis called:When delegation completes:
inject_async_callbackon the kernel handlesend_channel_messageCloses #891.
Test plan
agent_cancelaborts in-flight taskcargo check -p openfang-kernel -p openfang-runtime -p openfang-channels -p openfang-apicargo fmt --check🤖 Generated with Claude Code