advisor-tool changedagents-and-tools/tool-use/advisor-tool
Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+38added
Lines−20removed
From line
224
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits23to this page, all time
The whole hunk
from line 224, old and new numbered
/
from line 224
224224 'content' => 'Build a concurrent worker pool in Go with graceful shutdown.',
225225 ],
226226 ],
227 model: 'claude-sonnet-5',
227 model: Model::CLAUDE_SONNET_5,
228228 tools: [
229229 [
230230 'type' => 'advisor_20260301',
from line 600
600600
601601 List<BetaToolUnion> tools = List.of(
602602 BetaToolUnion.ofAdvisorTool20260301(
603 BetaAdvisorTool20260301.builder().model(Model.CLAUDE_OPUS_5_5).build()));
603 BetaAdvisorTool20260301.builder()
604 .model(Model.CLAUDE_OPUS_5_5)
605 .build()));
604606
605607 List<BetaMessageParam> messages = new ArrayList<>();
606608 messages.add(BetaMessageParam.ofUser(
from line 745
743745
744746
745747 def run_your_tools(content):
746 # Replace with your tool dispatch. Returns one tool_result block per tool_use block.
748 # Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
747749 return [
748750 {
749751 "type": "tool_result",
from line 785
783785 if response.stop_reason == "pause_turn":
784786 continue # server tool pending; re-send to let the API complete it
785787 if response.stop_reason != "tool_use":
786 break # end_turn, or a stop such as max_tokens that needs handling (see below)
788 # end_turn, or a stop such as max_tokens that needs handling
789 # (explained after this example)
790 break
787791
788792 results = run_your_tools(response.content) # list of tool_result blocks
789793 if results:
from line 810
806810 function runYourTools(
807811 content: Anthropic.Beta.Messages.BetaContentBlock[]
808812 ): Anthropic.Beta.Messages.BetaToolResultBlockParam[] {
809 // Replace with your tool dispatch. Returns one tool_result block per tool_use block.
813 // Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
810814 return content
811815 .filter((block) => block.type === "tool_use")
812816 .map((block) => ({
from line 846
842846 continue; // server tool pending; re-send to let the API complete it
843847 }
844848 if (response.stop_reason !== "tool_use") {
845 break; // end_turn, or a stop such as max_tokens that needs handling (see below)
849 // end_turn, or a stop such as max_tokens that needs handling
850 // (explained after this example)
851 break;
846852 }
847853
848854 const results = runYourTools(response.content); // list of tool_result blocks
from line 875
869875 + "now before committing to an approach.";
870876 const int MaxTurns = 10; // agent loop cap
871877
872 // Replace with your tool dispatch. Returns one tool_result block per tool_use block.
878 // Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
873879 List<BetaContentBlockParam> RunYourTools(IReadOnlyList<BetaContentBlock> content)
874880 {
875881 List<BetaContentBlockParam> results = [];
from line 928
922928 }
923929 if (response.StopReason != BetaStopReason.ToolUse)
924930 {
925 break; // end_turn, or a stop such as max_tokens that needs handling (see below)
931 // end_turn, or a stop such as max_tokens that needs handling
932 // (explained after this example)
933 break;
926934 }
927935
928936 var results = RunYourTools(response.Content); // list of tool_result blocks
from line 955
947955 maxTurns = 10 // agent loop cap
948956 )
949957
950 // Replace with your tool dispatch. Returns one tool_result block per tool_use block.
958 // Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
951959 func runYourTools(content []anthropic.BetaContentBlockUnion) []anthropic.BetaContentBlockParamUnion {
952960 var results []anthropic.BetaContentBlockParamUnion
953961 for _, block := range content {
from line 1006
9981006 continue // server tool pending; re-send to let the API complete it
9991007 }
10001008 if response.StopReason != anthropic.BetaStopReasonToolUse {
1001 break // end_turn, or a stop such as max_tokens that needs handling (see below)
1009 // end_turn, or a stop such as max_tokens that needs handling
1010 // (explained after this example)
1011 break
10021012 }
10031013
10041014 results := runYourTools(response.Content) // list of tool_result blocks
from line 1043
10331043 + "now before committing to an approach.";
10341044 static final int MAX_TURNS = 10; // agent loop cap
10351045
1036 // Replace with your tool dispatch. Returns one tool_result block per tool_use block.
1046 // Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
10371047 List<BetaContentBlockParam> runYourTools(List<BetaContentBlock> content) {
10381048 List<BetaContentBlockParam> results = new ArrayList<>();
10391049 for (BetaContentBlock block : content) {
from line 1063
10531063
10541064 List<BetaToolUnion> tools = List.of(
10551065 BetaToolUnion.ofAdvisorTool20260301(
1056 BetaAdvisorTool20260301.builder().model(Model.CLAUDE_OPUS_5_5).build())
1066 BetaAdvisorTool20260301.builder()
1067 .model(Model.CLAUDE_OPUS_5_5)
1068 .build())
10571069 // ... your other tools
10581070 );
10591071 String task = "Build a concurrent worker pool in Go with graceful shutdown.";
from line 1091
10791091 continue; // server tool pending; re-send to let the API complete it
10801092 }
10811093 if (!BetaStopReason.TOOL_USE.equals(stopReason)) {
1082 break; // end_turn, or a stop such as max_tokens that needs handling (see below)
1094 // end_turn, or a stop such as max_tokens that needs handling
1095 // (explained after this example)
1096 break;
10831097 }
10841098
10851099 List<BetaContentBlockParam> results = runYourTools(response.content()); // list of tool_result blocks
from line 1112
10981112 $client = new Client();
10991113
11001114 const NUDGE_TURN = 2; // inject before this assistant turn if no advisor call yet
1101 const NUDGE_TEXT = "You have not consulted the advisor yet. If the task has a non-obvious "
1115 const NUDGE_TEXT = 'You have not consulted the advisor yet. If the task has a non-obvious '
11021116 . "design decision or a failure mode you haven't ruled out, call advisor "
1103 . "now before committing to an approach.";
1117 . 'now before committing to an approach.';
11041118 const MAX_TURNS = 10; // agent loop cap
11051119
1106 // Replace with your tool dispatch. Returns one tool_result block per tool_use block.
1120 // Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
11071121 function runYourTools(array $content): array
11081122 {
11091123 $results = [];
from line 1159
11451159 continue; // server tool pending; re-send to let the API complete it
11461160 }
11471161 if ($response->stopReason !== 'tool_use') {
1148 break; // end_turn, or a stop such as max_tokens that needs handling (see below)
1162 // end_turn, or a stop such as max_tokens that needs handling
1163 // (explained after this example)
1164 break;
11491165 }
11501166
11511167 $results = runYourTools($response->content); // list of tool_result blocks
from line 1185
11691185 "now before committing to an approach."
11701186 MAX_TURNS = 10 # agent loop cap
11711187
1172 # Replace with your tool dispatch. Returns one tool_result block per tool_use block.
1188 # Replace with your tool dispatch. Returns one tool_result block for each tool_use block.
11731189 def run_your_tools(content)
11741190 content.filter_map do |block|
11751191 next unless block.type == :tool_use
from line 1214
11981214 block.type == :server_tool_use && block.name == :advisor
11991215 end
12001216 next if response.stop_reason == :pause_turn # server tool pending; re-send to let the API complete it
1201 break unless response.stop_reason == :tool_use # end_turn, or a stop such as max_tokens that needs handling (see below)
1217 # end_turn, or a stop such as max_tokens that needs handling
1218 # (explained after this example)
1219 break unless response.stop_reason == :tool_use
12021220
12031221 results = run_your_tools(response.content) # list of tool_result blocks
12041222 messages << { role: "user", content: results } unless results.empty?
from line 1242
12241242
12251243The `server_tool_use` block with `name: "advisor"` signals that an advisor call is starting. The pause starts when that block closes (`content_block_stop`). During the pause, the stream is quiet except for standard SSE `ping` keepalives emitted roughly every 30 seconds. Short advisor calls might show no pings.
12261244
1227When the advisor finishes, the `advisor_tool_result` arrives fully formed in a single `content_block_start` event (no deltas). Executor output then resumes streaming.
1245When the advisor call completes, the `advisor_tool_result` arrives fully formed in a single `content_block_start` event (no deltas). Executor output then resumes streaming.
12281246
12291247A `message_delta` event follows with the updated `usage.iterations` array reflecting the advisor's token counts.
12301248
No line in this hunk matches that.