Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Artificial Intelligence
4 min read

8 Agent Intent Recognition Methods: Rules, Embeddings, LLMs & Hybrid Pipelines

This article analyzes eight intent recognition approaches for AI agents — keyword rules, traditional classifiers, LLM prompting, embedding routing, tool-based selection, hierarchical routing, context-aware recognition, and hybrid pipelines — detailing trade-offs in accuracy, latency, cost, and maintenance for each method.

1. Keyword and Rule Matching

The simplest approach uses keywords, regular expressions, and if-else logic to classify intent. For example, phrases like "refund", "money back", "don't want it" map to a refund request; "human agent", "talk to a person" trigger handoff.

Pros: Fast to develop, low cost, interpretable results. Ideal for few intents with clear business rules. High-risk operations (delete account, bulk export, change limits) should always use rule-based guards.

Cons: Misses paraphrases ("I don't want this anymore" lacks "refund" but implies it). Keyword lists grow into unmaintainable "tropical rainforests" of rules.

2. Traditional Classification Model

Train a dedicated text classifier on labeled intent data. Input a user query; the model outputs a fixed label (refund, complaint, order lookup).

Pros: Low latency, low per-call cost, stable performance with sufficient quality training data. Suits high-volume, stable-intent customer service systems.

Cons: Requires labeled data. Adding a new intent means collecting samples and retraining. Unseen phrasing often leads to confident misclassification.

3. LLM Prompt Classification

Place the intent list, business definitions, and few-shot examples in a prompt; the LLM returns the matching label.

Pros: Rapid cold start — no need for thousands of labeled rows. Adding "change shipping address" only requires updating the prompt with a definition and examples.

Cons: A bare "classify intent" prompt fails. Must define boundaries, confusing pairs, and fallback behavior. Otherwise "refund inquiry" and "refund execution" collapse into one label, causing the agent to invoke a refund tool when the user only asked about policy.

4. Embedding Semantic Routing

Convert the user query and each intent description to vectors, compute semantic similarity , and pick the closest intent.

Example: "When will the money return to my card?" contains no "refund status" keyword but is semantically close to that intent, so it routes correctly.

Pros: Fast, relatively low cost, handles many intents well.

Cons: Finds "what it looks like", not "what it is". Typically used as a first-stage retriever: recall top-k candidates, then pass to an LLM for final judgment.

5. Tool Description-Based Auto-Selection

In tool-calling agents, skip a separate classifier. Give each tool a clear name, description, and parameters; the LLM selects the tool directly from the user goal.

Example: "Where is my order?" → query_logistics; "Cancel my order" → cancel_order.

Pros: Short chain — intent recognition and tool selection in one step.

Cons: Heavily dependent on tool descriptions. If "query refund policy" and "execute refund" descriptions overlap, the LLM picks wrong. For money, deletion, or state changes, never trust model choice alone; add permission, parameter, and business-rule validation.

6. Hierarchical Intent Routing

When intents reach dozens or hundreds, stuffing all labels into one prompt hurts accuracy. Use two layers: first classify domain (orders, after-sales, finance, complaints, general), then sub-intent within that domain (e.g., after-sales → refund request, refund status, exchange, repair).

Analogy: find the floor first, then the room. Each step chooses from a small set, improving accuracy and letting different teams own their intent subsets.

7. Context and Workflow State-Aware Recognition

Many queries are ambiguous without context. Prior turn: "Can order 10001 be refunded?" → "Yes." Current turn: "Then refund it." The current message lacks order ID and product; only by combining history can the agent infer a refund request for order 10001.

Beyond dialogue history, incorporate workflow state . If the user is at the "refund confirmation" node and says "Confirm", that means confirm the refund, not casual chat. Process-oriented agents must track which step the user has reached.

8. Combined Rules, Vectors, and LLM Pipeline

Production systems often combine all three:

Rules catch high-risk intents first (handoff, data deletion, refund execution).

Embedding retrieves a few candidate intents.

LLM uses context to make the final classification.

If confidence is low, do not force a choice — ask for clarification or escalate to human.

Full pipeline design:

Rules → Embedding recall → LLM precise classification → Confidence check → Clarify / Human fallback

Output should be structured data, not a raw string:

{
  "intent": "REFUND_APPLY",
  "subIntent": "ORIGINAL_PAYMENT_REFUND",
  "confidence": 0.91,
  "entities": {
    "orderId": "10001"
  },
  "needClarification": false,
  "route": "refundWorkflow"
}

Critical note: The model's self-reported confidence ≠ true accuracy. A claimed 98% confidence does not mean 98% correct. Enterprise projects must evaluate with test sets: Accuracy, F1, confusion matrix, and unknown-intent rejection rate.

Selection Guidelines

Few fixed intents (5–6): Rules + Prompt is sufficient.

Many intents: Embedding recall + LLM precise judgment.

Complex business hierarchy: Default to hierarchical routing.

High-risk operations (money, permissions, state changes): Always backstop with rules and human review.

For attribution, corrections or content rights, contactadmin@besthub.dev

Report an issue with this article

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion