Skip to main content
The problem: You configured your agent with a fixed tool set at startup, but different users, tenants, or sessions need different capabilities — and you can’t restart the process for each change. The solution: All capabilities are resolved from registries at execution time. Each 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

Helper: 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.
An unreachable server fails at run time when tools are resolved. See MCP.

A2A agents

Skills are re-discovered on each run. See A2A.

Sub-agents

Sub-agent registration validates depth and cycles at build and on each run. See Sub-agents.

Static vs dynamic

Temporal note

Dynamic registry changes on the agent client process do not propagate to a remote worker’s in-memory registries. For split client/worker deployments, register matching capabilities on both NewAgent and NewAgentWorker, or ensure workers see the same registry state before runs execute.For tenant-specific capability sets (different tools per tenant), design your worker to register all possible tools at startup and use BeforeToolHook or ToolAuthorizer for runtime gating — rather than dynamically mutating worker-side registries.

Example

Register tools between runs via examples/agent_with_tools/dynamic_registry — see the dynamic_registry sub-example.

Tools

Tool registration and execution modes

MCP

MCP server configuration