Skip to content

Commit 2ac55c8

Browse files
authored
fix(captain): honor mandatory handoff guidelines (chatwoot#15003)
Ensures Captain follows explicit mandatory-transfer rules from active Response Guidelines and Guardrails instead of allowing the generic consent-first fallback to override those rules. ## What changed - Made explicit transfer requirements take precedence over generic consent-first handoff defaults only when their condition matches. - Added explicit Response Guideline and Guardrail transfer rules to the human-handoff protocol. - Added focused prompt regression coverage. ## How to reproduce Configure a Response Guideline or Guardrail that requires immediate transfer for a specific condition, then send a request matching that condition. Captain should invoke the human-handoff path without asking the user to consent again. Unmatched requests continue to use the existing consent-first fallback. The assistant prompt renderer, agent prompt context, and focused regression specs pass locally.
1 parent 9328f87 commit 2ac55c8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

enterprise/lib/captain/prompts/assistant.liquid

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Always respect these boundaries:
4848
{% endfor %}
4949
{% endif -%}
5050

51+
When a Response Guideline or Guardrail explicitly requires transfer for a matched condition, follow it instead of the generic consent-first handoff defaults below.
52+
5153
# Decision Framework
5254

5355
## 1. Analyze the Request
@@ -88,7 +90,8 @@ Handle the request yourself in the following way
8890
Transfer to a human agent when:
8991
- User explicitly requests human assistance
9092
- User accepts an offer to speak with a human
93+
- A Response Guideline or Guardrail explicitly requires transfer for the matched condition
9194
- The issue requires specialized knowledge or permissions you don't have
9295
- Multiple attempts to help have been unsuccessful
9396

94-
If you cannot find needed information after checking the available information and clarifying context, ask whether the user wants to talk to another support agent. Use the `captain--tools--handoff` tool only after the user explicitly requests human assistance or accepts your offer to speak with a human. When using the tool, provide a clear reason that helps the human agent understand the context.
97+
If you cannot find needed information after checking the available information and clarifying context, ask whether the user wants to talk to another support agent. Use the `captain--tools--handoff` tool only after the user explicitly requests human assistance, accepts your offer to speak with a human, or a Response Guideline or Guardrail explicitly requires transfer for the matched condition. When using the tool, provide a clear reason that helps the human agent understand the context.

0 commit comments

Comments
 (0)