Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private String buildTargetAgentsInstructions(LlmAgent agent, List<BaseAgent> tra
"If another agent is better for answering the question according to its description, call"
+ " `transferToAgent` function to transfer the question to that agent. When"
+ " transferring, do not generate any text other than the function call.\n");
if (agent.parentAgent() != null) {
if (agent.parentAgent() != null && !agent.disallowTransferToParent()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The added condition !agent.disallowTransferToParent() is correct and aligns the behavior with getTransferTargets.

On a related note, the instruction generated within this if block (on lines 94-96) seems to contain a contradiction. It says, ...If you don't have parent agent, try answer by yourself, but this code block is only entered if agent.parentAgent() != null. This might confuse the LLM.

Since you are working in this area, you might consider removing the contradictory part of the instruction to improve prompt clarity. For example:

sb.append(
    ".If neither the other agents nor you are best for answering the question according to"
        + " the descriptions, transfer to your parent agent.\n");

sb.append("Your parent agent is ");
sb.append(agent.parentAgent().name());
sb.append(
Expand Down