create_event_router when a LangGraph agent wants Aion to dispatch normalized Aion events to
handler functions without hiding graph topology.
The helper returns a normal LangGraph node. Add it with builder.add_node(...) and connect it with
ordinary LangGraph edges.
Overview
Registrations
Dispatch order for each invocation:
- Kind-specific handler (
on_message,on_reaction,on_command,on_card_action) if registered for the event kind. on_event— if no kind-specific handler matches but an Aion event is present.on_invoke— if there is no Aion event, or neither a kind-specific handler noron_eventis registered.
Handler Injection
Handlers may declare only the parameters they need:
Any other declared parameter is forwarded to LangGraph for native injection, such as
config,
store, or writer.
Explicit Entry Routing
Because the event router is a normal node, you can place your own node before it. This is useful for agents that need to route daemon-style requests, reject unsupported runtime contexts, or validate distribution metadata before event dispatch.Dispatch Rules
The dispatch surface is based on normalized event kinds, not provider-specific trigger names. That means:- a Slack mention and a Telegram DM can both normalize to
on_message - a slash command can normalize to
on_command - a card button click can normalize to
on_card_action
context.event, distribution,
or inbox, not register provider-only handler names.