False Handoffs between assistants in squad
# support
p
Hey guys, So i have created a squad for my project which consists of multiple assistants for supporting different languages. For switching between models i created handoff tools which should only switch if user explicitely asks to switch the language model. But for some reason it switches mid conversation after it ask user's age. I can't seem to find the issue. Can someone help me out with this one? @User @Vapi Support Bot Browser: Chrome, Brave https://cdn.discordapp.com/attachments/1447658005934899372/1447658009416433847/image.png?ex=698e1d95&is=698ccc15&hm=56226e73606fc8cc95b37949bf7ea249caea4c4d9d4c27f3bdcf9603f755f3be&
v
To prevent false handoffs, update your handoff tool's function definition to be extremely explicit. For example:
Copy code
json
{
  "type": "handoff",
  "function": {
    "name": "handoff_to_kannada_assistant",
    "description": "Only transfer to Kannada assistant if the user clearly says they want to switch to Kannada. Do NOT use for normal conversation or when answering questions."
  }
}
Make sure your system prompt also instructs the assistant to use this tool only for explicit language switch requests, not for any other reason. For more details, see the [Handoff Tool documentation](https://docs.vapi.ai/tools/handoff). Source: - [Handoff Tool documentation](https://docs.vapi.ai/tools/handoff)
p
I already did that. It still switches the assistants
k
please provide a call id so we can review the call details
p
I am providing you a list of call. I have try to resolve this through prompts but that did not helped one bit. I have called like 50 times and this happens every time. please look into this asap 019aff42-d7e4-700a-bf17-a851d95e98d8 019aff28-27a5-7226-b67d-75fa57375c46 019b01a3-5c72-7000-819d-3617f5d7b98f 019b01a0-e479-7114-9498-2a493cb2da5c
It seems to be a model issue rather than a transcriber issue. Since i saw the exact message from call logs and transcriber was correctly identifying language as en with high confidence level. There seems to be something wrong with either the logic behind squad or the model itself is too eager to call the handoff tool.
any update guys? @kyle @User @Vapi Support Bot
v
To further restrict false handoffs, try adding a strict parameter to your handoff tool's function definition that requires an explicit confirmation variable, such as
user_requested_language_switch
, and only trigger the handoff when this variable is set to
true
. For example:
Copy code
json
{
  "type": "handoff",
  "function": {
    "name": "handoff_to_kannada_assistant",
    "description": "Transfer only if user clearly says they want to switch to Kannada. Require 'user_requested_language_switch' to be true.",
    "parameters": {
      "user_requested_language_switch": {
        "type": "boolean",
        "description": "Set to true only if the user explicitly requests a language switch."
      }
    }
  }
}
This ensures the handoff tool is only called when the assistant detects an explicit user request, reducing accidental triggers. See the [handoff tool documentation](https://docs.vapi.ai/tools/handoff) for more on custom function parameters. Source: - [Handoff Tool documentation](https://docs.vapi.ai/tools/handoff)
v
Message marked as helpful by @Prakhar Agrawal! 🎉
c
the description for the handoff tool being executed is vague, so the assistant doesnt know when to execute it. it just says "new connection" \`\`\` { "type": "handoff", "async": false, "function": {"name": "handoff_to_kannada_assistant"}, "messages": \[\], "destinations": \[ { "type": "assistant", "assistantId": "6a34a74f-9d16-4f8b-a871-4e7c88cdfdea", "description": "New Connection", "assistantName": "Kannada NBT" } \] }\`\`\`
insert the description from your other handoff tool and it should work:
Copy code
"ONLY use this tool when the user EXPLICITLY requests to switch to Kannada language. Examples: 'Switch to Kannada', 'Speak in Kannada', 'ಕನ್ನಡದಲ್ಲಿ ಮಾತನಾಡಿ'. DO NOT use this tool for normal conversation, answering questions, or when the user simply responds to your questions. DO NOT use when user says numbers, ages, dates, or provides any information in response to your questions. ONLY use when they explicitly ask to change language to Kannada."
p
Ohh, this issue was already resolved earlier. Thanks for your help!
Can you please look into the other issue i raised? The one related to paylod to send for squad sdk for overriding prompts
c
We will take a look at it and provide an update on it soon.
a
so why not to ditch the Squad and just create multiple handoff tools and assign them to each assistant based on scenarios (for example your example languages) and then the user will have eventually a seamless transition to the new assistant without the client even knowing it even happened.
p
Yeah I am doing that only now! Thanks for suggestion!
c
This is a great suggestion. I'll be sure to keep it in my notes for this use-case