Prerequisites
client_source (clientSource in Node) to anthropic-sdk, which sends an X-Client-Source header that attributes requests to this integration. It defaults to sdk when unset.
Quick Start: Tool Runner
The Anthropic Python SDK includes atool_runner that handles the tool-calling loop automatically. Define Nimble tools with the @beta_tool decorator and the SDK manages execution, message history, and retries.
Python
Agent API V2: autonomous research tool
The tools above (search, extract, crawl, map, and Extract Templates) are synchronous and single-shot. One call returns data directly, and Claude does the reasoning.
Agent API V2 is different. It exposes an asynchronous research agent that plans, searches across many sources, and returns a synthesized answer with a per-claim trust report. The lifecycle is create a run → poll to a terminal state → retrieve the result. Wrap that whole lifecycle in one function so Claude sees a single “deep research” tool.
1. Wrap the run lifecycle
This helper uses a stableagent_name, so every call — from this process or any other — reuses the same agent and its memory instead of spinning up a fresh one each time. It creates the run, polls until terminal, handles failed and cancelled runs, and returns the answer plus its trust and citation metadata. Errors return a safe message, so no API key or raw exception is surfaced.
Python
2. Expose it with the Tool Runner
Wrap the helper with@beta_tool and pass it to tool_runner. Claude calls one tool; the async run loop stays hidden.
Python
confidence grade (high, medium, or low), and the source URLs behind it, so Claude can weigh how much to trust each claim. See Trust for the full report structure.
Messages API (Manual Loop)
For more control, define tools using the Anthropicinput_schema format and handle the tool_use → tool_result loop manually.
1. Define the Tool Schema
Python
2. Handle the Tool-Use Loop
Python
Node.js Example
Node
How It Works
The Anthropic tool-use flow has three steps:1
Send tools and message
Pass the tool definitions and user message to Claude. If Claude decides to use a tool, it returns a
tool_use content block with the tool name and input.2
Execute the tool
Parse the
tool_use block and call the corresponding Nimble SDK method. Return the result as a tool_result message.3
Get the final answer
Claude processes the tool result and responds with a text answer. If it needs more data, it may call another tool, and the loop continues until
stop_reason is end_turn.Available Tools
Any Nimble SDK method can be exposed as an Anthropic tool. Here are the most common ones:Next Steps
Python SDK
Full Python SDK reference with all methods and configuration options
Node SDK
Full Node.js SDK reference with TypeScript support
Web Search Agent
Agent API V2: autonomous research runs with per-claim trust
OpenAI
Use Nimble with OpenAI function calling and the Agents SDK