feat(agent): expose advisor_20260301 capability on AgentDefinition#880
Open
MukundaKatta wants to merge 1 commit intoanthropics:mainfrom
Open
feat(agent): expose advisor_20260301 capability on AgentDefinition#880MukundaKatta wants to merge 1 commit intoanthropics:mainfrom
MukundaKatta wants to merge 1 commit intoanthropics:mainfrom
Conversation
Adds `advisor: bool | AdvisorToolConfig | None` to `AgentDefinition` so
sub-agents declared via `ClaudeAgentOptions(agents={...})` can attach
the `advisor_20260301` server-side tool without dropping to the raw
`anthropic` SDK. Defaults to `None`, omitted from the wire payload.
When set to `True`, signals the CLI to enable the advisor with default
config and add the `advisor-tool-2026-03-01` beta header. When set to
an `AdvisorToolConfig` dict (model / max_uses / caching / allowed_callers),
the dict is forwarded verbatim — keys mirror the API's
`BetaAdvisorTool20260301Param` schema.
Older CLIs silently ignore the field, matching how unknown
`AgentDefinition` fields are handled today.
Closes anthropics#875.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ClaudeAgentOptions(agents={...})lets users declare sub-agents, butAgentDefinitionhas no way to attach theadvisor_20260301server-sidetool. Today, anyone who wants the executor/advisor pattern (Sonnet runs
the loop, Opus is consulted at decision points) has to drop a leaf
sub-agent down to the raw
anthropicSDK and lose Hooks, Tool Search,output_formatjson_schema coercion, OTEL trace propagation, and theSDK's per-sub-agent cost telemetry.
Closes #875.
What
advisor: bool | AdvisorToolConfig | None = NonetoAgentDefinitionNone(default) -> field omitted from the wire payloadTrue-> ask the CLI to enable the advisor with default config andadd the
advisor-tool-2026-03-01beta headerAdvisorToolConfigdict -> forwarded verbatimAdvisorToolConfig(TypedDict, total=False) mirroring the API'sBetaAdvisorTool20260301Paramshape:model,max_uses,caching,allowed_callersAdvisorToolConfigfrom the package root so callers can typetheir config dicts
The serializer in
_internal/client.pyandclient.pyalready stripsNoneandasdict()-deep-copies dict values, so no transport-layerchanges are needed for the field to flow through.
The docstring is explicit that this requires a Claude Code CLI build
that wires advisor configuration through to per-sub-agent API calls -
older CLIs silently ignore unknown
AgentDefinitionfields, so theaddition is forward-compatible and backward-safe.
Tested
tests/test_types.py::TestAgentDefinition:advisor=None-> field omitted from payloadadvisor=True->payload["advisor"] is Trueadvisor=False->payload["advisor"] is False(lets a sub-agentexplicitly opt out of an advisor a profile would otherwise inherit)
advisor={...}(full config) -> dict forwarded verbatim, snake_casekeys preserved, no key rewriting
from claude_agent_sdk import AdvisorToolConfigworksTestAgentDefinition._serializepattern,which mirrors the exact
{k: v for k, v in asdict(agent_def).items() if v is not None}transform used by the live serializers.API references
BetaAdvisorTool20260301Paramshape: anthropic-sdk-pythonsrc/anthropic/types/beta/beta_advisor_tool_20260301_param.pyadvisor-tool-2026-03-01(seehttps://docs.anthropic.com/en/api/beta-headers)
the matching declaration-side surface.