Find answers from the community

Updated 14 hours ago

Instructing an LLM to send tool calls instead of messages

I am having a problem of the llm returning "I am handing off to AgentXYZ" instead of acutally sending "content" as empty and tool calls.. Is there a way to instruct llm to send the tool call instead of the message? I am using multi agent work flow
w
5 comments
Another question: should the handoff rules be in system message?
I see that there is a handoff like prompt but I am worried of breaking it as it looks generic made to work for any tools
updating handoff solved the problem..
Plain Text
from llama_index.core.prompts import PromptTemplate

# New custom handoff prompt that instructs the LLM to output a structured function call
CUSTOM_HANDOFF_PROMPT = """You are operating as a multi-agent assistant.
If you determine that another agent is better suited to handle the user's request,
do not output plain text. Instead, output a JSON object exactly in the following format:
{"tool": "handoff", "to_agent": "<target_agent>", "reason": "<explanation>"}
Replace <target_agent> and <explanation> with the appropriate values.
If you are not handing off, simply provide your answer in normal text.

Currently available agents:
{agent_info}
"""
)
not sure if it is because default temperature in o3-mini is 1 and can't be changed but it is super hard to predict handoffs back and forth between agents. sometimes it works perfectly and sometimes it will simply not handoff as instructed. sometimes it won't call tool but instead print the tool call as a normal message
for me it is enough today lol but any tips would be greatly appreciated
Add a reply
Sign up and join the conversation on Discord