Unusual recursive agent handoff behaviors #10412
Unanswered
notfoundry
asked this question in
Troubleshooting
Replies: 1 comment 1 reply
-
|
For now, it's only a single agent hand-off per run. This is intentional, since the nodes are hardcoded for this specific feature. More advanced setups like you're suggesting require more visibility and manual configuration of the graph, which would require some node-based UI and is planned. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
I've been experimenting with the agent handoff feature introduced in #10176, and I ran into some behavior that seems unexpected enough to be more of a "bug" than a "feature".
Scenario: Create an agent A with a tool to handoff to an agent C, and then create an agent A with a tool to handoff to agent B.
Steps to Reproduce: If you ask A to handoff to B, it will work fine. If you ask B to handoff to C, it will work fine. But if you ask A to handoff to B, and to then subsequently handoff to C, the
lc_transfer_to_*tool to handoff from B to C is not available to B (previously A).Problem: I think most people would expect handoffs to be a property of each agent, such that you could allow one agent to delegate to another pre-existing agent, that can then delegate to other specialized agents, and so on. It's very unintuitive that the handoff mechanics silently fail this way, and its inconsistent with how agents are portrayed across Librechat as a whole.
In any case, I think the problem starts in https://github.com/danny-avila/LibreChat/blob/main/packages/api/src/agents/run.ts#L152 where the graph configuration only uses edges from the first agent. That way, when an agent B is reached through handoff from A, B's edges (including the handoff to C) are never incorporated into the graph. The MultiAgentGraph from https://github.com/danny-avila/agents/blob/main/src/run.ts#L76 only creates handoff tools based on the edges provided during construction, so the lc_transfer_to_agent_C tool is never created for B.
I tried implementing a fix to just transitively grab all the edges from every loaded agent and use those instead of just agents[0].edges, but I couldn't wrap my head around fixing https://github.com/danny-avila/LibreChat/blob/main/api/server/services/Endpoints/agents/initialize.js#L163 to recursively load all the agents, since that's necessary in order to avoid breaking the handoff tools from all the sub-agents.
Scenario: Create an agent A with a tool to handoff to an agent B.
Steps to Reproduce: If you ask A to handoff to B, and to then subsequently handoff to B again, then within the GUI it will show that it successfully handed off to B twice in a row even though the second handoff tool call silently failed.
Problem: Not entirely sure why, probably just a desync between UI/backend or something hardcoded about that tool name.
Version Information
$ git rev-parse HEAD
ba71375
Steps to Reproduce
See issue description
What browsers are you seeing the problem on?
No response
Relevant log output
Screenshots
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions