symfonic.capabilities.triage.intent¶
intent ¶
IntentClassifier -- deterministic pre-hydration intent routing.
Ported from :mod:symfonic.agent.triage.intent: a capability may import the
kernel's contracts and its own package, so the classifier lives here rather
than being imported from the agent layer. The scoring, the "2-of-3" action
guard, and the confidence floor are unchanged -- the parity suite asserts
full-verdict equality with legacy on every shared fixture.
Routes each turn into one of three lanes so the hydration path can skip semantic retrieval on pure action turns:
action— the user is asking the agent to do something (run a tool, call an API, perform a mutation). Full hydration wastes tokens.knowledge— the user wants information or recall. Hydration is load-bearing.ambiguous— the signals are mixed; treat asknowledgeto stay safe (full hydration is the conservative fallback).
Deterministic by design: an English verb lexicon, overlap against the deployment's tool-trigger keywords, and zero LLM calls.
IntentClassifier ¶
Deterministic verb+keyword intent classifier.
Thread-safe and stateless. Safe to reuse across turns. Scoring lives in
:mod:symfonic._intent_scoring; this package owns the
lexicon and hands it over as values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ambiguity_confidence_floor
|
float
|
Verdicts below this confidence value
are labelled |
0.55
|
min_action_signals
|
int
|
Minimum number of distinct signals required
before |
2
|
Source code in src/symfonic/capabilities/triage/intent.py
classify ¶
Classify query into action / knowledge / ambiguous.
Never raises. On empty input returns an ambiguous verdict
with confidence 0.0. tool_keywords maps tool names to
their trigger phrases -- the same overlap legacy reads off the
domain template, passed as values so this package imports
nothing outside itself and the kernel's contracts.
Source code in src/symfonic/capabilities/triage/intent.py
IntentVerdict
dataclass
¶
IntentVerdict(label: IntentLabel, confidence: float, matched_tool_keywords: list[str] = list(), reasoning: str = '', action_score: float = 0.0, knowledge_score: float = 0.0)
Classifier verdict for a single turn.
Attributes:
| Name | Type | Description |
|---|---|---|
label |
IntentLabel
|
One of |
confidence |
float
|
0.0–1.0 heuristic confidence. Values below the floor
are labelled |
matched_tool_keywords |
list[str]
|
Tool names whose trigger keywords overlap with the current query. |
reasoning |
str
|
Short human-readable note — which signals fired. |
action_score |
float
|
Raw action-lane score prior to normalisation. |
knowledge_score |
float
|
Raw knowledge-lane score prior to normalisation. |
to_event_payload ¶
Return a minimal payload suitable for an operator event.