Go sub-agents get blocked tools, turn limits and their own MCP servers

18 minutes 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

  1. 0:00Sub-agents get their own limits
  2. 0:20AgentDefinition: 4 fields to 13
  3. 0:42A sub-agent with its own limits
  4. 1:02Reconnect or toggle an MCP server
  5. 1:25Which agent ran a tool, and why a turn stopped
  6. 1:46Client and Transport gain two methods
  7. 2:03An empty Tools slice now means no tools
  8. 2:23Agent configs are checked before the CLI starts
  9. 2:44Upgrade to v0.10.0
Show transcript
  1. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0

    Go sub-agents get blocked tools, turn limits and their own MCP servers

    Claude Agent SDK for Go, version 0.10.0

    The project's gopher holding a wrench
  2. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    NEW

    AgentDefinition grows from 4 fields to 13

    in v0.9.1
    Description Prompt Tools Model
    added in v0.10.0
    DisallowedTools Skills Memory McpServers InitialPrompt MaxTurns Background Effort PermissionMode
  3. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    NEW

    Keep a researcher out of Bash and stop it after 10 turns

    claudecode.WithAgent("researcher", claudecode.AgentDefinition{
        Description:     "Researches a topic",
        Prompt:          "You are a researcher.",
        DisallowedTools: []string{"Bash"},
        McpServers: []claudecode.AgentMcpServer{
            {Name: "slack"},
            {Name: "local", Config: &claudecode.McpStdioServerConfig{…}},
        },
        MaxTurns: 10,
        Effort:   claudecode.AgentEffortLevel(claudecode.EffortHigh),
    })
  4. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    NEW

    Reconnect or switch off an MCP server mid‑session

    client.ReconnectMcpServer(ctx, serverName)
    Brings back a server that disconnected or failed
    client.ToggleMcpServer(ctx, "github", false)
    GetMcpStatus now reports the server as disabled

    Client API, after Connect() · waits up to 60 seconds for the CLI

  5. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    NEW

    See which sub-agent ran a tool, and why a turn stopped

    Tool hook inputs
    AgentID *string
    AgentType *string
    On PreToolUse, PostToolUse, PostToolUseFailure and PermissionRequest. AgentID is set only inside a sub-agent.
    ResultMessage
    StopReason *string
    For example "end_turn". Nil when the CLI sends none.
  6. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    COULD BREAK

    A custom Client or Transport needs two new methods

    ReconnectMcpServer(ctx context.Context, serverName string) error
    ToggleMcpServer(ctx context.Context, serverName string, enabled bool) error

    Affects your own implementations, such as test fakes.

  7. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    COULD BREAK

    An empty Tools slice now gives the agent no tools

    You writev0.9.1v0.10.0
    Tools: nildefault toolsdefault tools
    Tools: []string{}dropped, so default toolssends [], so no tools
  8. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0
    COULD BREAK

    A bad agent definition now fails before the CLI starts

    Query · QueryWithTransport · Client.Connect return an error for:

    • an agent McpServers entry with an empty name
    • an inline SDK server in an agent's McpServers
    • a negative MaxTurns or a negative AgentEffortTokens
  9. 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.

    Slide text
    claude-agent-sdk-go · v0.10.0

    Upgrade with one go get, after two checks

    go get github.com/severity1/claude-agent-sdk-go@v0.10.0
    Custom Client or Transport: add the two MCP methods
    Meant default tools? Use Tools: nil, not []string{}
    The project's gopher holding a wrench

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built in New York with ❤️