feat: implement delegation mechanism for agent orchestration#84
Open
NamelessNATM wants to merge 1 commit intoJackChen-me:mainfrom
Open
feat: implement delegation mechanism for agent orchestration#84NamelessNATM wants to merge 1 commit intoJackChen-me:mainfrom
NamelessNATM wants to merge 1 commit intoJackChen-me:mainfrom
Conversation
- Introduced `delegate_to_agent` tool for orchestrating agent tasks. - Enhanced `AgentPool` to manage available run slots, preventing deadlocks during nested runs. - Updated `TeamInfo` and `RunOptions` to support delegation context. - Added tests for delegation functionality, including error handling for self-delegation and depth limits. - Refactored built-in tools registration to conditionally include the new delegation tool.
Owner
|
The deadlock guard from #63 is addressed, and the delegation tool + registration gating look good. Two things: Blocking:
Non-blocking (can be follow-up PRs):
|
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.
What
Adds a built-in
delegate_to_agenttool so agents inrunTeam/runTaskscan synchronously hand a sub-prompt to another roster agent and get that run’s final output as a normal tool result, with pool capacity checks to avoid nestedpool.rundeadlocks. Built-in registration is opt-in for pool workers (includeDelegateTool);TeamInfoandRunOptions.teamcarry delegation context, depth limits, and trace/abort forwarding.Why
Teams already share context via shared memory and messaging, but there was no first-class way to “ask the specialist and get the answer back” inside one agent’s tool loop. This closes that gap using the existing tool protocol and pool semaphore, and prevents indefinite blocking when all concurrency slots are held by agents waiting on nested runs.
Fixes #63
Checklist
npm run lintpassesnpm testpasses (30 files, 528 tests)tests/built-in-tools.test.ts,tests/agent-pool.test.ts,tests/semaphore.test.ts, etc.)