{"version":"2.1.274","anchor":"new-engine-facade-capability-refreshagents","canonical_anchor":"new-plugin-hook-register-agent","heading":"Plugins can register custom agents at runtime","tier":"use","area":"SDK","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274\/e\/new-engine-facade-capability-refreshagents","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274","markdown":"### Plugins can register custom agents at runtime\n\nPlugins can now register their own custom agents, which get merged into the session's available agents automatically\n\n**What**\n\n- Plugins gain a new function hook, `register_agent` (alongside the existing hooks for registering commands and tools), letting a plugin define a custom agent.\n\n- The plugin SDK exposes an `agent.register` call that takes a name, description, and prompt (plus other fields), validating that the name only contains letters, digits, underscores, or hyphens and is no longer than 64 characters.\n\n- Agents registered this way at runtime are merged into the session's list of available agents, tagged as coming from a plugin (`source: \"plugin\"`, `registeredAtRunTime: true`).\n\n- The session\/engine layer gains a `refreshAgents` method, mirroring the existing `refreshCommands`, to re-read custom agent definitions on demand.\n\n**Why** This lets plugins extend Claude Code with their own specialized agents without requiring a restart, the same way plugins can already register custom commands and tools.\n\n- Area: SDK\n- Names: `refreshAgents`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 3\/5"}