Skip to Content
Rius

How do I see every tool call for calls to the Anthropic API?

Rius records every tool call Claude requests as a tool_call part on the span for each Anthropic model call, and your own observe spans show each tool run. Call init() once and the integration traces each messages.create call without changes to your call sites. Open the trace in the console to read the requested tool calls on each model call and see your tool functions nested beside them.

How it works

Once the Anthropic integration is on, each messages.create call becomes one span for the model call. That span carries the model, token usage including cache reads and writes, cost computed by Rius, and the request and response messages.

The tool calls live in those messages:

  • Requested tool calls. When a response asks for a tool, the call is recorded as a tool_call part in the response messages of that span. Text blocks become text parts, and any other block, such as an image or a reasoning block, is kept as a text part holding the serialized block.
  • System prompt. Anthropic takes it as a separate system parameter. Rius places it as the leading system message of the input, so you read it with the rest of the conversation.
  • Failures. A failed call records error.type as the error class, such as anthropic.NotFoundError.

The integration records the model calls. When your code runs the tool, that work is your function, not an Anthropic call, so it gets a span only when you wrap it with observe. The same wrapper around your agent’s run gives all of it one parent.

Set it up

  1. Install the Anthropic instrumentation and call init(). The extra installs the instrumentation, not anthropic itself. In TypeScript, install @arizeai/openinference-instrumentation-anthropic instead. The Anthropic integration page covers both languages, and Integrations lists every library Rius can trace.
pip install "glassflow-rius[anthropic]" anthropic
  1. Wrap the run and each tool function with observe. Rius records the model calls, so these wrappers add the part it does not see, which is your tool code running and its place in the run. The function names below are yours.
import rius from anthropic import Anthropic from rius import SpanKind rius.init(api_key="ri_...", service_name="my-agent") client = Anthropic() # use the client exactly as before @rius.observe(kind=SpanKind.TOOL) def get_weather(city: str) -> str: ... # your tool code @rius.observe def handle(query: str) -> str: ... # your loop: call client.messages.create, run the tools it asks for
  1. Run the agent once, then open the trace on the Traces page. In TypeScript, name each wrapped function, because an anonymous one traces as anonymous.
  2. Select a model call span and open its Input / Output tab to read the response messages, including the tool_call parts.
  3. To list every model call across runs, open the Spans tab and choose LLM in the All kinds menu. The Monitor AI agents in production guide shows how this fits into day-to-day monitoring.

What you get

In Exploring traces you see the run as a tree on a timeline. Your observe root is the parent, each model call is a child span with its token counts and cost, and each wrapped tool function is a TOOL span named execute_tool followed by the function name.

  • Every tool call Claude asked for, in the response messages of the model call that asked.
  • What changed between steps. On a model call span, Since previous llm call shows the input as a diff, so the tool result you passed back appears marked added.
  • Repeated tools in one row. Back-to-back calls of the same tool collapse into one row such as fetch_article · 3 attempts · recovered, and you expand it for the individual attempts.
  • Context growth. For a trace with several model calls, a strip plots input tokens per call, so a tool result that bloats the prompt shows up early.
  • Stepping through. Use ]l and [l to jump between LLM spans, and j and k to walk every span.

Token usage is captured on streamed calls too. Auto-instrumented Anthropic streams carry no time to first token.

When something else fits

  • Content shows in the Input / Output tab only when your privacy controls leave it on. If content is stripped, you still see timings, tokens and cost, but not the tool_call parts.
  • If an agent framework already runs your tools, check its page under Integrations, because it may emit tool spans itself and need fewer wrappers.

Still stuck? Get help

Last updated on