Go sub-agents get blocked tools, turn limits and their own MCP servers
2 hours ago
Version 0.10 of the Claude Agent SDK for Go lets a sub-agent you define in Go block tools, stop after a set number of turns, and bring its own MCP servers. It also adds live controls for MCP servers, and it changes three behaviors worth checking before you upgrade.
Ask about this presentation
Chapters
0:00Sub-agents get their own limits
0:20AgentDefinition: 4 fields to 13
0:42A sub-agent with its own limits
1:02Reconnect or toggle an MCP server
1:25Which agent ran a tool, and why a turn stopped
1:46Client and Transport gain two methods
2:03An empty Tools slice now means no tools
2:23Agent configs are checked before the CLI starts
2:44Upgrade to v0.10.0
Show transcriptHide transcript
Version 0.10 of the Claude Agent SDK for Go lets a sub-agent you define in Go block tools, stop after a set number of turns, and bring its own MCP servers. It also adds live controls for MCP servers, and it changes three behaviors worth checking before you upgrade.
An agent definition used to carry four fields: a description, a prompt, its tools and a model. This release adds nine more. Disallowed tools, skills, a memory scope, MCP servers, an initial prompt, max turns, a background flag, effort and a permission mode. Each one is optional, and an unset field stays out of the request to the CLI.
Here is a researcher agent from the reference docs. Disallowed tools takes Bash away from it. Its MCP servers can be named, like slack, which points at a server you already configured, or defined inline, like this local one. Max turns stops it after 10 turns. And effort takes either a level, here high, or a token count.
A connected client can now manage its MCP servers while the session runs. ReconnectMcpServer brings back a server that disconnected or failed. ToggleMcpServer switches one off or on by name, and a disabled server shows up as disabled in the status call. Both wait up to 60 seconds, because a reconnect starts the server process.
The four tool hooks, pre tool use, post tool use, post tool use failure and permission request, now receive an agent ID and an agent type. The agent ID is set only when the hook fires inside a sub-agent. And the result message gains a stop reason, such as end turn, which stays nil when the CLI sends none.
Now the changes that can break you. The Client and Transport interfaces both gained these two methods. If you wrote your own implementation, a test fake for example, it won't compile until you add them. Code that only uses the SDK's own client is unaffected.
Slices behave differently too. A nil slice still sends nothing, so the agent keeps its default tools. An empty slice used to be dropped too, and now it is sent as an empty list. So an agent whose tools are set to an empty slice now gets no tools at all. If you meant the defaults, set it to nil.
Query and Connect return an error before the CLI starts if an agent's MCP server entry has an empty name, if it defines an SDK server inline, or if its max turns or effort tokens are negative. To give an agent an SDK server, add it to the McpServers option and refer to it by name.
Upgrading is one go get command. Check two things first. A custom Client or Transport needs the two MCP methods, and an empty tools slice now means no tools. After that, your Go sub-agents can block tools, stop after a set number of turns, and bring their own MCP servers.