Anthropic provides built-in tools that run inside Claude's managed infrastructure — no external setup required. Unlike user-defined tools (which require your backend to execute), built-in tools are executed directly by Anthropic's servers. You enable them by adding their tool type to the tools array in your API request, just like the Web Search tool.
code_execution_20260120)The Code Execution tool gives Claude a sandboxed environment to write and run Python or Bash code during a conversation. This is ideal for tasks that require computation, data transformation, or validation — instead of asking Claude to "imagine" the output, it actually runs the code and returns real results.
The Web Fetch tool allows Claude to retrieve content from URLs during a conversation. Claude can fetch HTML pages, JSON APIs, or raw text and process the results inline. This is distinct from Web Search — fetch retrieves a specific URL you or Claude provides, while search discovers new URLs.
Built-in tools are enabled by adding them to the tools array with their specific type identifier. No input_schema is needed — Anthropic defines the schema internally.
// API call with Code Execution tool enabled
const response = await anthropic.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 8192,
tools: [
{ type: "code_execution_20260120", name: "code_execution" }
],
messages: [{
role: "user",
content: "Calculate the first 20 Fibonacci numbers and plot them."
}]
});
// Claude writes Python code, executes it in the sandbox,
// and returns the output (including any generated charts)
You can combine multiple built-in tools in a single request. For example, enabling both code execution and web search allows Claude to fetch data from the web, then process it with Python — all in a single turn.