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
| Registration | Called for |
|---|---|
on_message | Normalized inbound message events |
on_reaction | Normalized reaction change events |
on_command | Normalized command invocation events |
on_card_action | Normalized card-action callback events |
on_event | Fallback when an event exists but no specific handler is registered |
on_invoke | Direct invocation without an Aion event envelope |
Handler Injection
Handlers may declare only the parameters they need:| Parameter | Value |
|---|---|
state | Current LangGraph state |
runtime | LangGraph Runtime[AionRuntimeContext] |
context | Current AionRuntimeContext |
event | Current typed Aion event, or None |
distribution | Current distribution from the Distribution extension, or None |
behavior | Current behavior from the Distribution extension, or None |
environment | Current environment from the Distribution extension, or None |
principal_identity | Principal identity associated with the request, or None |
service_identity | External service identity associated with the request, or None |
inbox | Raw A2A inbox snapshot |
thread | Thread helper for replies, posts, typing, and history |
message | Normalized inbound Message, or None |
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.