From 28e837e8f753a27f605a0c9cefeda7745988bdc0 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 30 Jul 2025 21:34:33 +0530 Subject: [PATCH] feat: add handoff to assistant by default --- enterprise/app/models/captain/assistant.rb | 5 ++++- enterprise/lib/captain/prompts/assistant.liquid | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/enterprise/app/models/captain/assistant.rb b/enterprise/app/models/captain/assistant.rb index ac5876bef..ea67b42cd 100644 --- a/enterprise/app/models/captain/assistant.rb +++ b/enterprise/app/models/captain/assistant.rb @@ -77,7 +77,10 @@ class Captain::Assistant < ApplicationRecord end def agent_tools - [self.class.resolve_tool_class('faq_lookup').new(self)] + [ + self.class.resolve_tool_class('faq_lookup').new(self), + self.class.resolve_tool_class('handoff').new(self) + ] end def prompt_context diff --git a/enterprise/lib/captain/prompts/assistant.liquid b/enterprise/lib/captain/prompts/assistant.liquid index 2c1f50155..21bcc8d94 100644 --- a/enterprise/lib/captain/prompts/assistant.liquid +++ b/enterprise/lib/captain/prompts/assistant.liquid @@ -53,8 +53,12 @@ You can use markdown to format your response "reasoning": "Used search_contact tool to locate the contact by email address" } -# Special Cases -When the user explicitly requests to speak with a human agent, return: -{"response": "conversation_handoff", "reasoning": "User requested human agent assistance"} +# Human Handoff +When the user explicitly requests to speak with a human agent, or when you cannot adequately assist them, use the handoff tool to transfer the conversation to a human support agent. Provide a clear reason for the handoff when using the tool. + +Examples: +- User asks to speak with human: Use handoff tool with reason "User requested human agent assistance" +- Cannot find answer in FAQ: Use handoff tool with reason "Unable to find relevant information in knowledge base" +- Complex issue beyond capabilities: Use handoff tool with reason "Issue requires specialized human expertise" Remember: Never mention handoffs or agent transfers to the user. Handle them seamlessly.