Zero Labs
Industry News / AI

Claude Think Tool Explained: How It Works in AI Agents

Source · Towards AI By Karthiknadar

From the publisher’s feed, collected in the ZeroLabs newsroom.

An AI agent can call the right tool and still make the wrong decision afterward. A search might return conflicting information. A database lookup might leave a required field unresolved. A test result might show that the agent’s original explanation for a bug was wrong.The next step depends on understanding what just happened. Having access to tools does not automatically make that interpretation reliable.Anthropic’s Claude think tool explored a simple way to give the model space to work through new information during a task. It used the same tool-calling interface as an ordinary function, but its purpose was to record a working note before the agent continued.There is an important update to keep in mind. Anthropic now recommends native extended thinking over a separate think tool in most cases. The original technique is still useful to understand, especially if you are learning how agent loops and scratchpads work. Anthropic's updated articleWhat is the Claude think tool?The original think tool is a function that accepts a text argument. That text is a note generated by the model. The function does not need to search for information, call another language model, or change an external system.In fact, the think handler in the original τ-bench implementation returns an empty string:def think(thought: str) -> str: return ""The function body is almost empty because the useful content has already appeared in the model’s tool-call arguments. The surrounding application keeps that call in the conversation history. Original τ-bench implementationThis is the first distinction worth understanding: the model generates the note; the tool handler does not generate it. The tool gives that note a defined place in the interaction.Start with an ordinary tool-calling loopBefore adding a scratchpad, it helps to understand the loop it becomes part of. When we give Claude a custom tool, we provide a description and an input schema. Claude uses those instructions to decide whether to request the tool and what arguments to supply. Our application then executes the function and returns its result.User request ↓Claude requests a tool ↓Application runs the function ↓Application returns the result ↓Claude continuesThe model does not directly execute our Python function. It produces a structured request that our code handles. That distinction is part of Anthropic’s tool-use contract. The application supplies the operations, the model requests them, and the results return through the conversation.A task can involve several trips through this loop. Each result may change which action makes sense next.Where a scratchpad fitsA plan made before the first tool call cannot account for every fact that later calls will reveal. The agent may discover that information is missing, that two sources disagree, or that an earlier assumption no longer holds. It needs to interpret those results before choosing what to do next.The think tool adds an explicit place for a working note:Claude requests an information-gathering tool ↓Application returns new information ↓Claude writes a note through the think tool ↓Application acknowledges the call ↓Claude continues with the updated conversationThe extra step can help separate what the agent has observed from what it still needs to check. For example, an illustrative note might say:The sources describe different versions of the API.The current behavior is still unverified.Check the latest documentation before answering.This is a short task note based on available evidence. It identifies an unresolved issue and a next check. The note does not establish which source is correct. That still requires verification. Its value is that the unresolved issue becomes explicit before the agent continues.How a function that returns nothing can be usefulThe empty function body can make the technique look strange at first. Usually, we add a tool because its output provides something the model does not already have. A search returns pages. A calculation returns a number. A file-reading function returns text.With think, the important content is in the request. Claude generates the note while constructing the tool call. That call then becomes part of the continuing conversation, alongside the earlier tool results.The next model request can include:Earlier instructionsEarlier observationsThe think tool call and its noteThe acknowledgementThere is no additional source of intelligence inside the handler. The technique changes the interaction by giving the model an explicit opportunity to produce intermediate working text.It also depends on the application preserving that text. Calling a function and discarding the surrounding conversation would remove much of the mechanism we are trying to use.A simple Python implementationThere are two parts to define: the interface Claude sees and the function our application runs.The following example demonstrates the original custom-tool pattern. For a new Claude application, check native thinking support before deciding to add a separate scratchpad tool.Define the tool interfaceTHINK_TOOL = { "name": "think", "description": ( "Record a brief working note after inspecting tool results. " "Use it to note confirmed facts, missing information, " "and the next check. It does not fetch data or perform actions." ), "input_schema": { "type": "object", "properties": { "thought": { "type": "string", "description": ( "A short task note based on the available evidence." ), } }, "required": ["thought"], },}The name identifies the tool. The description explains its purpose and when it is useful. The schema specifies the argument the model must provide.The Python implementation is not part of this definition. Claude receives the interface, while our application keeps responsibility for execution. Anthropic’s tool-definition documentation describes this structure.Implement the handlerdef think(thought: str) -> str: return "Noted."This handler acknowledges the call. It does not repeat the note because the note is already present in the tool-call arguments.An illustrative call could look like this:{ "type": "tool_use", "id": "toolu_example", "name": "think", "input": { "thought": "The sources refer to different API versions. Verify the current documentation before answering." }}The application executes:think( thought=( "The sources refer to different API versions. " "Verify the current documentation before answering." ))and returns the acknowledgement.Writing the note to a separate application log is optional. Keeping it in the model’s continuing conversation is the part that matters for this example.Keep the tool call in the conversationWhen the API returns a tool request, the next request should preserve the assistant’s content and include the corresponding tool result.Here is a small helper for successful client-tool calls:def append_tool_round(messages, response, handlers): messages.append({ "role": "assistant", "content": response.content, })results = []for block in response.content: if block.type != "tool_use": continueoutput = handlers[block.name](**block.input)results.append({ "type": "tool_result", "tool_use_id": block.id, "content": output, })messages.append({ "role": "user", "content": results, })The handlers dictionary connects tool names to their Python functions:handlers = { "think": think,}An application with other custom tools would register their handlers here too.Two details in the helper are important.First, it preserves response.content. That includes the think call and the note Claude supplied.Second, each result contains a tool_use_id matching the call it answers. The acknowledgement belongs to that specific invocation.Returning only "Noted." without preserving the assistant's call would leave out the useful text. Anthropic's tool-result documentation explains the required message structure.Continue the existing agent loopInside an application that already has a configured client, model, tools, and message history, the continuation follows the usual pattern:while response.stop_reason == "tool_use": append_tool_round(messages, response, handlers) response = client.messages.create( model=MODEL, max_tokens=2048, tools=[THINK_TOOL], messages=messages, )This example exposes only the think tool. A real agent would include its other tool definitions in the same tools list and register their handlers.The loop repeats because Claude may request another tool before finishing. Production code also needs to handle tool failures, iteration limits, and responses that stop because they reach an output limit. The scratchpad uses the same conversation mechanism as the other custom tools.The description influences how the tool gets usedAdding a function named think does not tell the model what a useful note should contain. A vague instruction can produce vague notes. It can also encourage unnecessary calls that repeat information without helping the next decision.The description should make the intended purpose clear. In this example, the note records what the available evidence establishes and what remains unresolved. A short instruction in the system prompt could reinforce that purpose:When tool results leave an important issue unresolved,use the think tool to record a brief task note. Identify the missing information and the next check.Keep the note concise and grounded in observed results.Skip the tool when the next action is already clear.This is a suggested instruction for the example, rather than a claim that this exact wording has been benchmarked. It asks for a concise task note. It does not ask the model to expose private internal reasoning.For current Claude integrations, Anthropic’s tool guidance recommends requesting short explanations or supporting evidence in tool arguments, while keeping internal reasoning in native thinking blocks. Current tool-description guidanceHow this relates to context and memoryA scratchpad note can influence a later step only if the model receives it. In the implementation above, that happens through messages. The next request includes the earlier conversation, the assistant's tool call, and the result.This makes the note part of the model’s available context. It does not automatically make it permanent memory. If the application starts a new conversation without carrying the note over, that new conversation does not receive it. Similarly, saving a note to a file does not make the model aware of the file’s contents unless the application provides a way to read them.The context-window documentation explains how messages and tool results contribute to what the model can reference. There is also a practical cost to keeping notes. They add generated text, occupy context, and may be included in subsequent requests. Repeated notes that no longer affect the task can become unnecessary input.A useful working note should make an unresolved issue easier to track. It should not become another long document the agent has to interpret.What Anthropic’s experiments showedAnthropic evaluated the original technique using Claude 3.7 Sonnet, including experiments on τ-bench. The benchmark places an agent in conversations with simulated users and gives it tools and domain-specific policies. Its evaluation checks whether the interaction reaches the intended outcome.It also measures consistency using pass^k. This estimates success across all of several independent attempts at a task. It differs from pass@k, which counts a task as successful if at least one attempt succeeds. τ-bench paperFor the retail domain, Anthropic reported:These results show an improvement in that experimental setting. The article also reports stronger airline results when the tool was paired with optimized instructions. Anthropic’s evaluationThe scope matters. These are results for particular models, tasks, and prompts. They do not establish that adding a tool with the same name improves every agent.They also give us a reason to evaluate the whole configuration. A tool description, system instructions, and the model’s behavior can all affect what happens after we add the function.Think tool versus native thinkingThe original article described a distinction between extended thinking before action and a custom tool that could introduce working text during a sequence of actions. Current Claude capabilities make that distinction less useful as a general rule.Anthropic now documents interleaved thinking, which lets Claude reason between tool calls. The model can consider a tool result before deciding what to do next without needing a separate custom think invocation. Adaptive thinking supports this automatically on models that offer that mode. Current thinking documentationThe two approaches also represent their content differently:A custom tool note is ordinary generated application content. It should not be treated as a direct view into the model’s private reasoning. Native thinking also has model-specific configuration and message-handling requirements. The current documentation is the right place to check those details before copying a setup intended for an older model.For most new Claude applications, Anthropic’s updated recommendation makes native thinking the starting point. The custom tool remains a useful example of how intermediate text can become part of an agent’s continuing context.How to decide whether a scratchpad helps your agentStart with a failed run. Find the point where the agent received useful information but did not use it correctly. Perhaps it ignored a conflict, continued with an outdated assumption, or acted before collecting a required detail.That gives you something specific to test. A scratchpad step is more relevant to that kind of failure than to a simple lookup whose result can be returned directly. If no intermediate decision needs reconsideration, another tool round may mostly add time and tokens.For a meaningful comparison, keep the tasks, model, and available tools fixed. Compare the existing behavior with a clearly defined alternative, such as native thinking or a custom note tool.Look beyond whether the agent produced longer notes. Check whether it chose the right next action and reached the intended outcome. Repeated attempts can help reveal whether an apparent improvement is consistent. The code walkthrough above shows how to preserve a note. It does not establish that the note improves a particular application.What to check before adding another toolThe useful question is where the agent first stopped using the evidence correctly. If the tool result was incomplete, the agent may need another lookup. If the result contradicted an assumption, it may need to revise its plan. If the next step was already obvious, an extra note may add little.That is a more useful starting point than adding a scratchpad to every workflow. It gives you a concrete failure to address and a way to compare the available approaches.I write about context, retrieval, and how AI agents work. Follow along if you found this breakdown useful.Claude Think Tool Explained: How It Works in AI Agents was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.