The escalation subagent
Every production copilot needs an escape hatch. Legal threats, angry users, complex edge cases that would be dangerous for the model to answer. The escalation subagent handles these cleanly: it acknowledges the user, confirms a human will follow up, and emits a reference id for traceability. It does not try to solve the problem.
ESCALATION_PROMPT = '''You are the escalation agent. The user needs a human. Write a
short, empathetic message that:
1. Acknowledges their frustration or request.
2. Confirms a human specialist will follow up within one business day.
3. Provides a reference handoff id (make one up in the format ESC-XXXXXX).
User message:
{user_input}
'''Notice what the prompt does NOT include: no tools, no retrieval, no customer lookup. This subagent is a controlled, templated response. The only variation is the user-facing wording.
async def escalation_agent_node(state: ClaimState) -> Dict[str, Any]:
provider = get_llm_provider()
answer = await provider.generate_text(
ESCALATION_PROMPT.format(user_input=state.get('user_input', '')),
max_tokens=200,
temperature=0.3,
)
return {'answer': answer, 'citations': []}max_tokens=200 caps the response to a brief handoff message. temperature=0.3 gives it a little warmth without letting the model improvise on details. In a real product, you would also enqueue an actual handoff record to your support system here.
Quiz: Quiz
Loading practice…
Checkpoint: Specialists checkpoint
Loading practice…