Run or Stream picks up the current registry state — no restart needed. Add tools for a premium user, remove them on logout, swap MCP servers per tenant, or register a specialist sub-agent when a feature flag is enabled.
Combine with static setup (WithTools, WithMCPConfig, etc.) by passing initial capabilities at NewAgent, then mutating registries as context changes.
Registry accessors
All registries are safe for concurrent use. Name uniqueness is enforced —
Register on an existing name returns agent.ErrRegistryDuplicate. To update an entry, call Unregister first, then Register with the new configuration.
Tools
agent.RegisterTools(reg, tools...) registers multiple tools in one call.
See Tools for custom tool implementation.
MCP servers
Static config (WithMCPConfig / WithMCPClients) connects and discovers tools at NewAgent. Dynamic additions via MCPRegistry are discovered on each run — the registry state at call time is what the LLM sees.
A2A agents
Sub-agents
Static vs dynamic
Temporal note
Example
Register tools between runs viaexamples/agent_with_tools/dynamic_registry — see the dynamic_registry sub-example.
Related
Tools
Tool registration and execution modes
MCP
MCP server configuration