Skip to content

API Reference parrot.human.escalation_intent

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.human.escalation_intent

View source

Escalation intent detector for HITL multi-tier escalation.

Detects when a user's free-text response is a request to be escalated to a human operator (e.g. "I need a human", "pasame con un humano").

Strategy (§3 C5 of the FEAT-194 spec):

  1. Regex match against a seed phrase list.
  2. Optional LLM confirmation via Groq Haiku when regex is ambiguous and llm_client is provided (inline await, llm_timeout_seconds default = 1.5 s; any failure → return False).

Pure helper module — no side effects, no global state.

FEAT-194 — TASK-1278

Class RejectIntentDetector

Detects escalation intent from free-text user responses.

Usage::

detector = RejectIntentDetector()
if await detector.is_escalation_intent("I need a human"):
    ...
Parameter Type Default Description
regex_phrases Optional[List[str]] None Override the default phrase list (list of regex strings). When provided, REPLACES (not extends) the defaults.
llm_client Optional[Any] None Optional async callable used as LLM fallback. It is invoked as await llm_client(text) -> bool for short texts (< 80 chars) that do not match regex. When None (default), the LLM fallback is disabled.
llm_timeout_seconds float 1.5 Maximum wait for the LLM response before returning False (default 1.5 s).

Method RejectIntentDetector.is_escalation_intent

Return True if text expresses a desire to escalate to a human.

Algorithm:

  1. Normalise and lowercase.
  2. Regex match → return True on hit.
  3. If LLM client configured and text < 80 chars → LLM fallback with timeout.
  4. Return False on no match or timeout/error.

is_escalation_intent(text: Any) -> bool

Parameter Type Default Description
text Any The user's response string (non-strings → False).

Returns: bool — True when escalation intent is detected, False otherwise.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally