fix(handoff): return wrong-tool correction to LLM instead of silent execute#61
Open
JumpLink wants to merge 1 commit intodanny-avila:mainfrom
Open
fix(handoff): return wrong-tool correction to LLM instead of silent execute#61JumpLink wants to merge 1 commit intodanny-avila:mainfrom
JumpLink wants to merge 1 commit intodanny-avila:mainfrom
Conversation
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.
When the model calls a handoff tool with a wrong name (e.g. duplicated suffix like
lc_transfer_to_agent_...7yu7yuinstead of...7yu), we no longer execute the handoff silently with the resolved name. We return a ToolMessage that tells the LLM the used name was wrong and suggests the correct tool name, so the LLM can call the correct tool in the next turn and select the right agent itself.Out of Scope?
I understand that the PR is out of scope and may simply be a problem with the model used. I have integrated it as a workaround and didn't want to leave it unmentioned and is more likely a workaround.
Problem
loadToolsdoes not provide them.Solution
dev/agents/src/tools/ToolNode.ts): For handoff calls that are not indirectToolNamesbut can be resolved viaresolveHandoffToolName()(prefix match), we do not add them to direct execution.handleRunToolCompletionsis called for them so the UI shows the step and the correction.Changes
directCallsResolved.handoffCorrectionMessages: one ToolMessage per resolved handoff with the text above.directOutputs+handoffCorrectionMessages+eventOutputs.resolveHandoffToolNameupdated to describe the new behaviour.directToolNamesto satisfy lint.Related