Skip to main content

Module registry

Module registry 

Source
Expand description

Tool registry — HashMap dispatcher + schema emitter.

Why: Replaces hardcoded if name == "delegate_to_agent" dispatch with a polymorphic registry so new tools (web_search, load_skill, etc.) plug in without touching the PM loop. This is the SOA seam. What: ToolRegistry holds Arc<dyn ToolExecutor> keyed by name; emits a vector of JSON schemas for the LLM request; dispatches named tool calls to the right executor. RBAC-gated dispatch via dispatch_for_user. Test: Unit tests construct a registry with a MockTool and assert that dispatch("mock") returns the mock’s output and schemas() contains the mock’s schema.

Structs§

ToolRegistry
Registry of tools available to an LLM session.