Repository Public
1---2title: Thinking in tool and multi-turn workflows3url: https://platform.claude.com/docs/en/build-with-claude/thinking-tool-workflows4description: Walk through a complete two-turn tool-use round trip that preserves thinking blocks correctly, and see how interleaved thinking changes the flow.5---67<Note>8 To learn how zero data retention (ZDR) applies to this feature, see [API and data retention](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention).9</Note>1011This page walks through a complete two-turn tool-use round trip with thinking enabled: Claude thinks, requests a tool call, receives the result, and finishes its answer, with the thinking blocks handled correctly at every step. The full rules live on the [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) page, in [Thinking with tool use](https://platform.claude.com/docs/en/build-with-claude/thinking#thinking-with-tool-use) and [Preserving thinking blocks](https://platform.claude.com/docs/en/build-with-claude/thinking#preserving-thinking-blocks); this page shows those rules applied in runnable code.1213## The rules this walkthrough applies1415Each link leads to the full statement on the Thinking page:1617* [Limit tool choice to `auto` or `none` in manual mode](https://platform.claude.com/docs/en/build-with-claude/thinking#thinking-with-tool-use): `tool_choice` options that force tool use return an error with manual extended thinking (`thinking: {type: "enabled"}`); adaptive thinking supports forced tool use.18* [Keep one thinking configuration per assistant turn](https://platform.claude.com/docs/en/build-with-claude/thinking#thinking-with-tool-use): a tool-use loop is one assistant turn, so change the configuration only between turns.19* [Pass thinking blocks back complete and unmodified](https://platform.claude.com/docs/en/build-with-claude/thinking#preserving-thinking-blocks): when you return a tool result, the thinking blocks from the assistant message must come back with it.20* [Echo the assistant message exactly as received](https://platform.claude.com/docs/en/build-with-claude/thinking#preserving-thinking-blocks): rebuilding the message or filtering out `redacted_thinking` blocks triggers a 400 error.2122The samples use adaptive thinking; on models that support only extended thinking, substitute `thinking: {type: "enabled", budget_tokens: N}`. The round-trip rules are identical.2324## Walk through a two-turn tool-use round trip2526The example defines a `get_weather` tool, lets Claude think and request a tool call, then returns the tool result along with the assistant turn echoed exactly as received, thinking block included.2728<Steps>29 <Step title="Make the first request with a tool available">30 Send a request with adaptive thinking enabled and the tool defined. Apart from the `thinking` parameter, this is a standard [tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) request:3132 <CodeGroup>33 ```bash CLI34 ant messages create --transform content <<'YAML'35 model: claude-opus-4-836 max_tokens: 1600037 thinking:38 type: adaptive39 tools:40 - name: get_weather41 description: Get current weather for a location42 input_schema:43 type: object44 properties:45 location:46 type: string47 description: City name48 required:49 - location50 messages:51 - role: user52 content: "What's the weather in Paris?"53 YAML54 ```5556 ```python Python5758 client = anthropic.Anthropic()5960 weather_tool = {61 "name": "get_weather",62 "description": "Get current weather for a location",63 "input_schema": {64 "type": "object",65 "properties": {"location": {"type": "string", "description": "City name"}},66 "required": ["location"],67 },68 }6970 # First request - Claude responds with thinking and tool request71 response = client.messages.create(72 model="claude-opus-4-8",73 max_tokens=16000,74 thinking={"type": "adaptive"},75 tools=[weather_tool],76 messages=[{"role": "user", "content": "What's the weather in Paris?"}],77 )78 print(response)79 ```8081 ```typescript TypeScript82 const client = new Anthropic();8384 const weatherTool: Anthropic.Tool = {85 name: "get_weather",86 description: "Get current weather for a location",87 input_schema: {88 type: "object",89 properties: {90 location: { type: "string", description: "City name" }91 },92 required: ["location"]93 }94 };9596 // First request - Claude responds with thinking and tool request97 const response = await client.messages.create({98 model: "claude-opus-4-8",99 max_tokens: 16000,100 thinking: {101 type: "adaptive"102 },103 tools: [weatherTool],104 messages: [{ role: "user", content: "What's the weather in Paris?" }]105 });106 console.log(response);107 ```108109 ```csharp C#110 AnthropicClient client = new();111112 var weatherTool = new ToolUnion(new Tool()113 {114 Name = "get_weather",115 Description = "Get current weather for a location",116 InputSchema = new InputSchema()117 {118 Properties = new Dictionary<string, JsonElement>119 {120 ["location"] = JsonSerializer.SerializeToElement(new { type = "string", description = "City name" }),121 },122 Required = ["location"],123 },124 });125126 var parameters = new MessageCreateParams127 {128 Model = Model.ClaudeOpus4_8,129 MaxTokens = 16000,130 Thinking = new ThinkingConfigAdaptive(),131 Tools = [weatherTool],132 Messages = [new() { Role = Role.User, Content = "What's the weather in Paris?" }]133 };134135 var message = await client.Messages.Create(parameters);136 Console.WriteLine(message);137 ```138139 ```go Go140 client := anthropic.NewClient()141142 weatherTool := anthropic.ToolUnionParam{143 OfTool: &anthropic.ToolParam{144 Name: "get_weather",145 Description: anthropic.String("Get current weather for a location"),146 InputSchema: anthropic.ToolInputSchemaParam{147 Properties: map[string]any{148 "location": map[string]any{149 "type": "string",150 "description": "City name",151 },152 },153 Required: []string{"location"},154 },155 },156 }157158 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{159 Model: anthropic.ModelClaudeOpus4_8,160 MaxTokens: 16000,161 Thinking: anthropic.ThinkingConfigParamUnion{162 OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{},163 },164 Tools: []anthropic.ToolUnionParam{weatherTool},165 Messages: []anthropic.MessageParam{166 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in Paris?")),167 },168 })169 if err != nil {170 log.Fatal(err)171 }172 fmt.Println(response)173 ```174175 ```java Java176 import com.anthropic.models.messages.ThinkingConfigAdaptive;177 // ...178 AnthropicClient client = AnthropicOkHttpClient.fromEnv();179180 MessageCreateParams params = MessageCreateParams.builder()181 .model(Model.CLAUDE_OPUS_4_8)182 .maxTokens(16000L)183 .thinking(ThinkingConfigAdaptive.builder().build())184 .addTool(Tool.builder()185 .name("get_weather")186 .description("Get current weather for a location")187 .inputSchema(Tool.InputSchema.builder()188 .properties(JsonValue.from(Map.of(189 "location", Map.of("type", "string", "description", "City name")190 )))191 .required(List.of("location"))192 .build())193 .build())194 .addUserMessage("What's the weather in Paris?")195 .build();196197 Message response = client.messages().create(params);198 IO.println(response);199 ```200201 ```php PHP202 $client = new Client();203204 $weatherTool = [205 'name' => 'get_weather',206 'description' => 'Get current weather for a location',207 'input_schema' => [208 'type' => 'object',209 'properties' => [210 'location' => ['type' => 'string', 'description' => 'City name']211 ],212 'required' => ['location']213 ]214 ];215216 $message = $client->messages->create(217 maxTokens: 16000,218 messages: [219 ['role' => 'user', 'content' => "What's the weather in Paris?"]220 ],221 model: 'claude-opus-4-8',222 thinking: ['type' => 'adaptive'],223 tools: [$weatherTool],224 );225 echo $message;226 ```227228 ```ruby Ruby229 client = Anthropic::Client.new230231 weather_tool = {232 name: "get_weather",233 description: "Get current weather for a location",234 input_schema: {235 type: "object",236 properties: {237 location: { type: "string", description: "City name" }238 },239 required: ["location"]240 }241 }242243 message = client.messages.create(244 model: "claude-opus-4-8",245 max_tokens: 16000,246 thinking: {247 type: "adaptive"248 },249 tools: [weather_tool],250 messages: [251 { role: "user", content: "What's the weather in Paris?" }252 ]253 )254 puts message255 ```256 </CodeGroup>257 </Step>258259 <Step title="Capture the content array to echo back">260 You should see `thinking`, `text`, and `tool_use` blocks in the response content on a run where Claude chose to think (on simpler requests, adaptive mode may skip the thinking block). Keep this content array intact: the next step sends it back verbatim.261262 <Note>263 To see thinking text like this output, add `display: "summarized"` to the request. On models where display defaults to omitted, including claude-opus-4-8, the `thinking` field otherwise comes back as an empty string with only the `signature` populated. Either way, echo the content array back unchanged; see [Controlling thinking display](https://platform.claude.com/docs/en/build-with-claude/thinking#controlling-thinking-display).264 </Note>265266 ```json Output267 {268 "content": [269 {270 "type": "thinking",271 "thinking": "The user wants to know the current weather in Paris. I have access to a function `get_weather`...",272 "signature": "BDaL4VrbR2Oj0hO4XpJxT28J5T...."273 },274 {275 "type": "text",276 "text": "I can help you get the current weather information for Paris. Let me check that for you"277 },278 {279 "type": "tool_use",280 "id": "toolu_01CswdEQBMshySk6Y9DFKrfq",281 "name": "get_weather",282 "input": {283 "location": "Paris"284 }285 }286 ]287 }288 ```289 </Step>290291 <Step title="Return the tool result, echoing the assistant turn verbatim">292 Run the tool on your side, then send a second request that appends two messages to the conversation. The first is the assistant content echoed back exactly as received, so the thinking block stays unchanged alongside the `tool_use` block. The second is a user message carrying the `tool_result`.293294 Each sample is a self-contained script: it repeats the first request, then immediately sends the follow-up using the response it just received.295296 <CodeGroup>297 ```bash CLI298 # First turn: write the assistant content array (thinking and tool_use299 # blocks, signatures intact) to a file. Routing model-generated text300 # through a file keeps it out of shell-expansion position later.301 ant messages create --transform content --format jsonl \302 > assistant_content.json <<'YAML'303 model: claude-opus-4-8304 max_tokens: 16000305 thinking:306 type: adaptive307 tools:308 - name: get_weather309 description: Get current weather for a location310 input_schema:311 type: object312 properties:313 location:314 type: string315 description: City name316 required: [location]317 messages:318 - role: user319 content: What's the weather in Paris?320 YAML321322 # Second turn: jq fills the two null placeholders from the captured file,323 # so the blocks return verbatim as the assistant message. The thinking324 # block MUST accompany the tool_use block. The quoted delimiter keeps the325 # shell from expanding anything in the body.326 jq --slurpfile blocks assistant_content.json '327 .messages[1].content = $blocks[0] |328 .messages[2].content[0].tool_use_id =329 ($blocks[0][] | select(.type == "tool_use") | .id)330 ' <<'JSON' | ant messages create331 {332 "model": "claude-opus-4-8",333 "max_tokens": 16000,334 "thinking": {"type": "adaptive"},335 "tools": [{336 "name": "get_weather",337 "description": "Get current weather for a location",338 "input_schema": {339 "type": "object",340 "properties": {341 "location": {"type": "string", "description": "City name"}342 },343 "required": ["location"]344 }345 }],346 "messages": [347 {"role": "user", "content": "What's the weather in Paris?"},348 {"role": "assistant", "content": null},349 {"role": "user", "content": [{350 "type": "tool_result",351 "tool_use_id": null,352 "content": "Current temperature: 88°F"353 }]}354 ]355 }356 JSON357 ```358359 ```python Python360361 client = anthropic.Anthropic()362 weather_tool = {363 "name": "get_weather",364 "description": "Get current weather for a location",365 "input_schema": {366 "type": "object",367 "properties": {"location": {"type": "string", "description": "City name"}},368 "required": ["location"],369 },370 }371 response = client.messages.create(372 model="claude-opus-4-8",373 max_tokens=16000,374 thinking={"type": "adaptive"},375 tools=[weather_tool],376 messages=[{"role": "user", "content": "What's the weather in Paris?"}],377 )378 # Extract the tool use block to get its ID for the tool result379 tool_use_block = next(block for block in response.content if block.type == "tool_use")380381 # Call your actual weather API, here is where your actual API call would go382 # Let's pretend this is what we get back383 weather_data = {"temperature": 88}384385 # Second request - Include the assistant turn and the tool result386 continuation = client.messages.create(387 model="claude-opus-4-8",388 max_tokens=16000,389 thinking={"type": "adaptive"},390 tools=[weather_tool],391 messages=[392 {"role": "user", "content": "What's the weather in Paris?"},393 # Echo the assistant content exactly as received. When a thinking394 # block is present, it must accompany the tool_use block.395 {"role": "assistant", "content": response.content},396 {397 "role": "user",398 "content": [399 {400 "type": "tool_result",401 "tool_use_id": tool_use_block.id,402 "content": f"Current temperature: {weather_data['temperature']}°F",403 }404 ],405 },406 ],407 )408 print(continuation)409 ```410411 ```typescript TypeScript412 const client = new Anthropic();413414 const weatherTool: Anthropic.Tool = {415 name: "get_weather",416 description: "Get current weather for a location",417 input_schema: {418 type: "object",419 properties: {420 location: { type: "string", description: "City name" }421 },422 required: ["location"]423 }424 };425426 const response = await client.messages.create({427 model: "claude-opus-4-8",428 max_tokens: 16000,429 thinking: {430 type: "adaptive"431 },432 tools: [weatherTool],433 messages: [{ role: "user", content: "What's the weather in Paris?" }]434 });435436 // Extract the tool use block to get its ID for the tool result437 const toolUseBlock = response.content.find(438 (block): block is Anthropic.ToolUseBlock => block.type === "tool_use"439 );440441 // Call your actual weather API, here is where your actual API call would go442 // Let's pretend this is what we get back443 const weatherData = { temperature: 88 };444445 if (toolUseBlock) {446 // Second request - Include the assistant turn and the tool result447 const continuation = await client.messages.create({448 model: "claude-opus-4-8",449 max_tokens: 16000,450 thinking: {451 type: "adaptive"452 },453 tools: [weatherTool],454 messages: [455 { role: "user", content: "What's the weather in Paris?" },456 // Echo the assistant content exactly as received. When a thinking457 // block is present, it must accompany the tool_use block.458 { role: "assistant", content: response.content },459 {460 role: "user",461 content: [462 {463 type: "tool_result" as const,464 tool_use_id: toolUseBlock.id,465 content: `Current temperature: ${weatherData.temperature}°F`466 }467 ]468 }469 ]470 });471 console.log(continuation);472 }473 ```474475 ```csharp C#476 AnthropicClient client = new();477478 var weatherTool = new ToolUnion(new Tool()479 {480 Name = "get_weather",481 Description = "Get current weather for a location",482 InputSchema = new InputSchema()483 {484 Properties = new Dictionary<string, JsonElement>485 {486 ["location"] = JsonSerializer.SerializeToElement(new { type = "string", description = "City name" }),487 },488 Required = ["location"],489 },490 });491492 var parameters = new MessageCreateParams493 {494 Model = Model.ClaudeOpus4_8,495 MaxTokens = 16000,496 Thinking = new ThinkingConfigAdaptive(),497 Tools = [weatherTool],498 Messages = [499 new() { Role = Role.User, Content = "What's the weather in Paris?" }500 ]501 };502503 var response = await client.Messages.Create(parameters);504505 // Extract the tool_use block to get its ID for the tool result506 ToolUseBlock? toolUseBlock = null;507 foreach (var block in response.Content)508 {509 if (block.TryPickToolUse(out var toolUse))510 {511 toolUseBlock = toolUse;512 break;513 }514 }515516 var weatherData = new { temperature = 88 };517518 // Build continuation with tool result519 var continuationParams = new MessageCreateParams520 {521 Model = Model.ClaudeOpus4_8,522 MaxTokens = 16000,523 Thinking = new ThinkingConfigAdaptive(),524 Tools = [weatherTool],525 Messages = [526 new() { Role = Role.User, Content = "What's the weather in Paris?" },527 // response.Content includes the thinking blocks; passing them back is required528 new() { Role = Role.Assistant, Content = response.Content.Select(block => new ContentBlockParam(block.Json)).ToList() },529 new() { Role = Role.User, Content = new MessageParamContent(new List<ContentBlockParam>530 {531 new ContentBlockParam(new ToolResultBlockParam()532 {533 ToolUseID = toolUseBlock?.ID ?? "",534 Content = $"Current temperature: {weatherData.temperature}°F"535 })536 })}537 ]538 };539540 var continuation = await client.Messages.Create(continuationParams);541 Console.WriteLine(continuation);542 ```543544 ```go Go545 client := anthropic.NewClient()546547 weatherTool := anthropic.ToolUnionParam{548 OfTool: &anthropic.ToolParam{549 Name: "get_weather",550 Description: anthropic.String("Get current weather for a location"),551 InputSchema: anthropic.ToolInputSchemaParam{552 Properties: map[string]any{553 "location": map[string]any{554 "type": "string",555 "description": "City name",556 },557 },558 Required: []string{"location"},559 },560 },561 }562563 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{564 Model: anthropic.ModelClaudeOpus4_8,565 MaxTokens: 16000,566 Thinking: anthropic.ThinkingConfigParamUnion{567 OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{},568 },569 Tools: []anthropic.ToolUnionParam{weatherTool},570 Messages: []anthropic.MessageParam{571 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in Paris?")),572 },573 })574 if err != nil {575 log.Fatal(err)576 }577578 var toolUseBlock anthropic.ToolUseBlock579 for _, block := range response.Content {580 if v, ok := block.AsAny().(anthropic.ToolUseBlock); ok {581 toolUseBlock = v582 break583 }584 }585586 weatherData := map[string]int{"temperature": 88}587588 continuation, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{589 Model: anthropic.ModelClaudeOpus4_8,590 MaxTokens: 16000,591 Thinking: anthropic.ThinkingConfigParamUnion{592 OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{},593 },594 Tools: []anthropic.ToolUnionParam{weatherTool},595 Messages: []anthropic.MessageParam{596 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in Paris?")),597 response.ToParam(),598 anthropic.NewUserMessage(599 anthropic.NewToolResultBlock(toolUseBlock.ID, fmt.Sprintf("Current temperature: %d°F", weatherData["temperature"]), false),600 ),601 },602 })603 if err != nil {604 log.Fatal(err)605 }606607 fmt.Println(continuation)608 ```609610 ```java Java611 import com.anthropic.models.messages.ThinkingConfigAdaptive;612 // ...613614 void main() {615 AnthropicClient client = AnthropicOkHttpClient.fromEnv();616617 Tool weatherTool = Tool.builder()618 .name("get_weather")619 .description("Get current weather for a location")620 .inputSchema(Tool.InputSchema.builder()621 .properties(JsonValue.from(Map.of(622 "location", Map.of("type", "string", "description", "City name")623 )))624 .required(List.of("location"))625 .build())626 .build();627628 MessageCreateParams initialParams = MessageCreateParams.builder()629 .model(Model.CLAUDE_OPUS_4_8)630 .maxTokens(16000L)631 .thinking(ThinkingConfigAdaptive.builder().build())632 .addTool(weatherTool)633 .addUserMessage("What's the weather in Paris?")634 .build();635636 Message response = client.messages().create(initialParams);637638 ToolUseBlock toolUseBlock = null;639 for (var block : response.content()) {640 if (block.toolUse().isPresent()) {641 toolUseBlock = block.toolUse().get();642 break;643 }644 }645646 int temperature = 88;647648 // Second request: echo the assistant turn as received, then the tool result649 MessageCreateParams continuationParams = MessageCreateParams.builder()650 .model(Model.CLAUDE_OPUS_4_8)651 .maxTokens(16000L)652 .thinking(ThinkingConfigAdaptive.builder().build())653 .addTool(weatherTool)654 .addUserMessage("What's the weather in Paris?")655 .addMessage(response)656 .addUserMessageOfBlockParams(List.of(657 ContentBlockParam.ofToolResult(658 ToolResultBlockParam.builder()659 .toolUseId(toolUseBlock.id())660 .content("Current temperature: " + temperature + "°F")661 .build()662 )663 ))664 .build();665666 Message continuation = client.messages().create(continuationParams);667 IO.println(continuation);668 }669 ```670671 ```php PHP672 $client = new Client();673674 $weatherTool = [675 'name' => 'get_weather',676 'description' => 'Get current weather for a location',677 'input_schema' => [678 'type' => 'object',679 'properties' => [680 'location' => [681 'type' => 'string',682 'description' => 'City name'683 ]684 ],685 'required' => ['location']686 ]687 ];688689 $response = $client->messages->create(690 maxTokens: 16000,691 messages: [692 ['role' => 'user', 'content' => "What's the weather in Paris?"]693 ],694 model: 'claude-opus-4-8',695 thinking: ['type' => 'adaptive'],696 tools: [$weatherTool],697 );698699 $toolUseBlock = null;700 foreach ($response->content as $block) {701 if ($block->type === 'tool_use') {702 $toolUseBlock = $block;703 break;704 }705 }706707 $weatherData = ['temperature' => 88];708709 $continuation = $client->messages->create(710 maxTokens: 16000,711 messages: [712 ['role' => 'user', 'content' => "What's the weather in Paris?"],713 ['role' => 'assistant', 'content' => $response->content],714 ['role' => 'user', 'content' => [715 [716 'type' => 'tool_result',717 'tool_use_id' => $toolUseBlock->id,718 'content' => "Current temperature: {$weatherData['temperature']}°F"719 ]720 ]]721 ],722 model: 'claude-opus-4-8',723 thinking: ['type' => 'adaptive'],724 tools: [$weatherTool],725 );726727 echo $continuation;728 ```729730 ```ruby Ruby731 client = Anthropic::Client.new732733 weather_tool = {734 name: "get_weather",735 description: "Get current weather for a location",736 input_schema: {737 type: "object",738 properties: {739 location: { type: "string", description: "City name" }740 },741 required: ["location"]742 }743 }744745 response = client.messages.create(746 model: "claude-opus-4-8",747 max_tokens: 16000,748 thinking: {749 type: "adaptive"750 },751 tools: [weather_tool],752 messages: [753 { role: "user", content: "What's the weather in Paris?" }754 ]755 )756757 tool_use_block = response.content.find { |block| block.type == :tool_use }758759 raise "No tool_use block found" unless tool_use_block760761 weather_data = { temperature: 88 }762763 continuation = client.messages.create(764 model: "claude-opus-4-8",765 max_tokens: 16000,766 thinking: {767 type: "adaptive"768 },769 tools: [weather_tool],770 messages: [771 { role: "user", content: "What's the weather in Paris?" },772 { role: "assistant", content: response.content },773 { role: "user", content: [774 {775 type: "tool_result",776 tool_use_id: tool_use_block.id,777 content: "Current temperature: #{weather_data[:temperature]}°F"778 }779 ] }780 ]781 )782783 puts continuation784 ```785 </CodeGroup>786 </Step>787788 <Step title="Read the final response">789 You should see Claude complete the turn with text. Because [interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#interleaved-thinking) is automatic in adaptive mode, the continuation can also open with a new thinking block before the final text:790791 ```json Output792 {793 "content": [794 {795 "type": "text",796 "text": "Currently in Paris, the temperature is 88°F (31°C)"797 }798 ]799 }800 ```801 </Step>802</Steps>803804## How interleaved thinking changes the flow805806Interleaved thinking lets Claude think between tool calls, reasoning about each tool result before acting on it. The concept and per-model availability are covered in [Interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#interleaved-thinking) on the Thinking page; interleaving changes where thinking blocks appear, not whether tool calls can chain. The following comparison shows what interleaved thinking changes in a two-tool workflow:807808<AccordionGroup>809 <Accordion title="Tool use without interleaved thinking">810 Without interleaved thinking, Claude thinks once at the start of the assistant turn. Subsequent responses after tool results continue without new thinking blocks.811812 ```text813 User: "What's the total revenue if we sold 150 units at $50 each,814 and how does this compare to our average monthly revenue?"815816 Response 1: [thinking] "I need to calculate 150 * $50, then check the database..."817 [tool_use: calculator] { "expression": "150 * 50" }818 ↓ tool result: "7500"819820 Response 2: [tool_use: database_query] { "query": "SELECT AVG(revenue)..." }821 ↑ no thinking block822 ↓ tool result: "5200"823824 Response 3: [text] "The total revenue is $7,500, which is 44% above your825 average monthly revenue of $5,200."826 ↑ no thinking block827 ```828 </Accordion>829830 <Accordion title="Tool use with interleaved thinking">831 With interleaved thinking enabled, Claude can think after receiving each tool result, allowing it to reason about intermediate results before continuing.832833 ```text834 User: "What's the total revenue if we sold 150 units at $50 each,835 and how does this compare to our average monthly revenue?"836837 Response 1: [thinking] "I need to calculate 150 * $50 first..."838 [tool_use: calculator] { "expression": "150 * 50" }839 ↓ tool result: "7500"840841 Response 2: [thinking] "Got $7,500. Now I should query the database to compare..."842 [tool_use: database_query] { "query": "SELECT AVG(revenue)..." }843 ↑ thinking after receiving calculator result844 ↓ tool result: "5200"845846 Response 3: [thinking] "$7,500 vs $5,200 average - that's a 44% increase..."847 [text] "The total revenue is $7,500, which is 44% above your848 average monthly revenue of $5,200."849 ↑ thinking before final answer850 ```851 </Accordion>852</AccordionGroup>853854## Next steps855856<CardGroup cols={3}>857 <Card title="Thinking" icon="brain" href="https://platform.claude.com/docs/en/build-with-claude/thinking">858 The overview: turn thinking on, read thinking output, and review the full rules for tool use, caching, and streaming.859 </Card>860861 <Card title="Steering thinking" icon="compass" href="https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost">862 Steer how often and how deeply Claude thinks with effort levels and prompt-based guidance.863 </Card>864865 <Card title="Extended thinking" icon="clock" href="https://platform.claude.com/docs/en/build-with-claude/extended-thinking">866 Manual thinking budgets on older models: `budget_tokens` mechanics and migration to adaptive.867 </Card>868</CardGroup>869