Jido.AgentServer.SignalRouter (Jido v2.3.1)

Copy Markdown View Source

Builds a unified Jido.Signal.Router from strategy, agent, and plugin routes.

This module is responsible for:

  1. Collecting routes from all sources (strategy, agent, plugins)
  2. Normalizing route specs with appropriate priorities
  3. Building the trie-based router for efficient signal routing

Priority Levels

SourceDefault PriorityRange
Strategy5050-100
Agent0-25 to 25
Plugin-10-50 to -10

Route Spec Formats

Routes can be specified in several formats:

  • {path, target} - Simple route with default priority
  • {path, target, priority} - Route with explicit priority
  • {path, match_fn, target} - Route with match function
  • {path, match_fn, target, priority} - Route with match function and priority

Target Types

  • module() - Action module, params = signal.data
  • {module(), map()} - Action module with static params
  • {:strategy_cmd, atom()} - Strategy command

Summary

Functions

Builds a unified router from all route sources in the agent state.

Functions

build(state)

Builds a unified router from all route sources in the agent state.

Collects routes from:

  • Strategy routes (priority 50+) via strategy.signal_routes/1
  • Agent routes (priority 0) via agent_module.signal_routes/1
  • Plugin routes (priority -10) via plugin signal_patterns and signal_routes/1

Returns an empty router if no routes are found or if building fails.