Rules and Response Resolution
Rule types currently implemented
Rule type resolver coverage
| rule_type | Resolver | When to use |
|---|---|---|
| EXACT | ExactRuleTypeResolver | Exact text-driven trigger |
| REGEX | RegexRuleTypeResolver | Pattern-driven trigger |
| JSON_PATH | JsonPathRuleTypeResolver | Condition over session/context/payload facts |
Rule actions in detail
Action behavior
| action | What it changes | Typical real-world use |
|---|---|---|
| SET_STATE | session.state | Move flow to AWAITING_ACCOUNT_ID |
| SET_INTENT | session.intent | Reclassify after deterministic signal |
| SET_JSON | input param from JSON path extract | Pull ticketId/correlationId from context |
| GET_CONTEXT | input param snapshot of context | Use context in downstream prompts/tasks |
| GET_SESSION | input param snapshot of session facts | Expose runtime flags to prompts |
| GET_SCHEMA_JSON | input param schema-only field subset | Use only extracted form fields |
| SET_TASK | executes custom task bean methods | Raise incident, call internal orchestrator |
Response selection algorithm
- Find enabled
ce_responsecandidates matching intent/state - Score by exact state/intent > ANY/null fallback > priority
- Choose top candidate
- Resolve by response type
EXACT vs DERIVED
EXACT: deterministic payload (exact_text)DERIVED: template-rendered + LLM-generated output
Derived response path (concept)
TEXT
ce_response(response_type=DERIVED, output_format=TEXT)
-> template from ce_prompt_template(response_type=TEXT)
-> render variables
-> llm.generateText(...)
-> optional ResponseTransformer
-> persisted assistant output
Intervention points
- Use
ResponseTransformerafter response resolution to apply consumer-specific post-processing. - Use hook on
RulesStepto inspect rule cascades in production debugging.
Enum drift warning
Do not insert unimplemented rule types/actions in DB. Keep ce_rule values aligned with installed resolver classes.