← All Patterns
Event Router Pattern diagram
Event Router Pattern — topology diagram showing the three routing outcomes

Motivation

Enterprise AI systems receive events from many sources: structured UI selections, API calls, document uploads, free-text messages. Some carry a clear signal — the user selected "Report a Claim." Others are ambiguous — the user typed "I need help with something."

The naive approach embeds classification logic inside the router. This couples routing and classification, and when the classification strategy changes (rules → LLM → NLP), the router changes too. The Event Router Pattern solves this by making the Router the single, dumb entry point and delegating classification to a separate, Kafka-decoupled IntentOrchestrator.

Three Routing Outcomes

Key Principle

The Router is always the single entry point. The IntentOrchestrator is a Kafka-decoupled process — it consumes intent.in independently. The Router does not know it exists. This follows the same topology used throughout K9-AIF: Router publishes, Orchestrators consume.

EIP Lineage

Key Concepts

K9EventRouter IntentOrchestrator IntentSquad K9IntentAgent BaseIntentAgent intent.in responses.out routing.table confidence_threshold

Used in K9-AIF

K9EventRouter (OOB) IntentOrchestrator (OOB) examples/k9routing/ k9-aif >= 1.2.0