When to use this
Use the Hebbian router when:- You have more than one agent that advertises the same capability and want the kernel to prefer the one with the best track record.
- You want a single general-purpose agent (for example, the LLM agent) to absorb tasks that no specialist advertises.
- You want governance state (quarantined, suspended) to remove an agent from routing without un-registering it.
How it scores candidates
Among the agents that advertise the requested capability and are not blocked by governance, the router blends each agent’s static composite score with its average Hebbian connection weight:composite(a)comes from the agent registry (trust, capability match, recency).hebbian_norm(a)is the agent’s average Hebbian weight, normalised to[0, 1]across the current candidates.alphacontrols how much learned weight overrides the static score.
+1) or weakens (-1) agent → task connections after each run, proven performers are increasingly preferred.
Tuning alpha
alpha is clamped to [0, 1]. Common settings:
Raise
alpha once you have enough completed runs for Hebbian weights to be meaningful. Drop it back toward 0 if you are debugging a misbehaving agent and want the registry’s static scoring to dominate.
Fallback capability
fallback_capability makes a general-purpose agent reachable when no specialist advertises the requested capability — or when the task omits one entirely.
- If a task has
required_capabilitybut no eligible agent advertises it, the router retries withfallback_capability. - If a task has no
required_capabilityat all, the router routes directly to the fallback. - If
fallback_capabilityisNone, capability matching is strict and the router raisesValueErroron no match.
fallback_capability="llm_chat", so the LLM agent absorbs anything no specialist owns.
Governance gating
Agents in the following governance states are removed from the candidate set before scoring:quarantinedsuspended
Configuration
The router is constructed against anAgentRegistry and a HebbianWeightManager:
route() returns a RoutingDecision with the chosen agent and a per-candidate breakdown (composite, raw and normalised Hebbian weight, blended score). The decision serialises with to_dict() for the run logger or API responses.
For callers that only need the selected name:
Failure modes
The router is intentionally defensive: any failure reading a weight or score is treated as the neutral prior, so a missing or mocked Hebbian source never breaks routing — it falls back to composite-only behaviour. The only paths that raiseValueError are:
- A task with no
required_capabilityand nofallback_capabilityconfigured. - A
required_capabilitythat no eligible agent advertises and no usable fallback.
Related
- Routing modes — sequential, concurrent, and adaptive orchestration shapes that sit above the router.
- Hebbian learning and controlled decay — how the weights the router consumes are reinforced and decayed.
- Trust scoring — how composite scores and governance state are produced.
