> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude agents

> Give Claude agents WebRouter custom tool definitions and execute their calls.

`web_router.integrations.anthropic` gives a Claude agent the same two tools,
as plain custom tool definitions, and the guide that says when to use which:

```python theme={null}
from anthropic import AsyncAnthropic
from web_router import AsyncWebRouter
from web_router.integrations.anthropic import WebRouterTools

client = AsyncAnthropic()
tools = WebRouterTools(AsyncWebRouter(), provider="nimble", max_results=5)
agent = await client.beta.agents.create(
    name="researcher",
    model="claude-opus-5",
    system=tools.guide(),  # when to reach for which tool
    tools=tools.definitions(),  # web_router_search, web_router_extract
)

# In the session, for each agent.custom_tool_use event:
result = await tools.acall(event.name, event.input)
await client.beta.sessions.events.send(
    session.id, events=[{"type": "user.custom_tool_result", "custom_tool_use_id": event.id, **result.event_fields()}]
)
```

The definitions serve a Managed Agents agent and the Messages API's `tools`
alike, and the module needs no SDK and no extra: your Anthropic client sends
them, and `call` / `acall` run each call here, on your keys. The options rule
is the LangChain tools' — the model supplies the query or the URLs, you fix the
rest — and so is the rendering, byte for byte. Input the model got wrong comes
back as an error result it can fix; a backend failure does too; your own setup
mistake raises (see [What the model reads when a call fails](https://docs.webrouter.net/integrations.md#what-the-model-reads-when-a-call-fails)).
The tools are named `web_router_search` and `web_router_extract`, never
`web_search`, so an agent that also holds Claude's built-in search cannot
confuse the two (see [Tool names](https://docs.webrouter.net/integrations.md#tool-names)).

**Answer is opt-in.** `methods=["search", "extract", "answer"]` adds
`web_router_answer`: one question in, the backend's written answer and its
citations out, each snippet cut to `result_chars`. It goes to `answer_provider`,
else to `provider` when that backend answers, else to the router's default
answer backend, and the tools raise `NoAnswerProviderError` when they are built
if there is none to use. It sends only the question; the search options are not
passed to it.

`routing_guide()` (or `tools.guide()`, for exactly the tools you expose) is a
first version of the judgment half: cheapest tool first, one fact per search,
read a page only when its snippet falls short. Research and browse join the
tools once the guide can say when one is worth its bill.

[Back to Agent integrations](https://docs.webrouter.net/integrations.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.