Skip to Content

How do I see the prompts and responses for calls to the Anthropic API?

Rius shows the prompts and responses of each Anthropic call on the Input / Output tab of that call’s span in the trace. Install the Anthropic integration and call init(), and every messages.create call is recorded without changes to your call sites. Wrap your own function in observe if you want those calls nested inside your agent’s run. Content is captured by default, and your privacy controls can strip it.

How it works

With the Anthropic integration on, each messages.create call becomes one span of the LLM kind. It carries:

  • the model, for example claude-haiku-4-5-20251001
  • input and output token counts from the response, including cache reads and writes
  • the request and response messages
  • a cost, which Rius computes from the model and the tokens. You never send it, and it is a list-price estimate in US dollars.

Rius turns the messages into one common shape. Text blocks become text parts and tool calls become tool_call parts. Any other block, such as an image or a reasoning block, is kept as a text part holding the serialized block, so nothing is dropped. Anthropic takes the system prompt as a separate system parameter. Rius places it as the leading system message of gen_ai.input.messages, so you read it with the rest of the prompt.

A failed call records error.type as the error class, such as anthropic.NotFoundError. Streamed calls keep their token usage. Auto-instrumented Anthropic streams carry no time to first token.

The integration records the model call only. The code around it, such as the function that handles a request, needs its own span from observe. Without one, the call still appears in Rius, but as a span of its own rather than nested inside your agent’s run.

Set it up

  1. Install the instrumentation. The extra installs the instrumentation, not anthropic itself, so name the package for a fresh environment:
pip install "glassflow-rius[anthropic]" anthropic
  1. Call init() once at startup, then use the client as before. Decorate the function that makes the call with rius.observe to get your own span around it:
import anthropic import rius rius.init(api_key="ri_...", service_name="my-agent") claude = anthropic.Anthropic() # reads ANTHROPIC_API_KEY @rius.observe def handle(query: str) -> str: response = claude.messages.create( model="claude-haiku-4-5-20251001", max_tokens=200, messages=[{"role": "user", "content": query}], ) return response.content[0].text handle("What should I check when a collector drops spans?")
  1. Open Traces in the console and click the run. In the waterfall, the model call is a span badged llm, nested under your handle span. On the Spans tab you can instead filter by the LLM kind to list every model call, and the search box matches span names, span IDs, trace IDs and session IDs.

  2. Select the llm span and open the Input / Output tab to read the prompt and the response. Raw shows the span exactly as it was ingested. If a trace has several model calls, Since previous llm call on that tab shows what each call added to the prompt.

  3. In TypeScript, install @arizeai/openinference-instrumentation-anthropic, version 0.2.7 or newer. Call await rius.ready before your first call, since integrations attach asynchronously. In a CommonJS app, require @anthropic-ai/sdk before init(), or those calls stay untraced. For the other languages and the full setup, see Integrations and the Anthropic integration page.

What you get

  • The full prompt and response for each Anthropic call on the span’s Input / Output tab, with the system prompt first.
  • A Model section on the same span with the provider, requested and response model, tokens and cost. A call that reports no token usage shows a blank cost rather than $0.
  • Your own observe span as the parent, so the model call sits inside the run that triggered it. Exploring traces covers the waterfall, the map view and the span filters in detail.
  • Content controls. Content capture is on by default. Setting RIUS_CAPTURE_CONTENT to false strips prompts and responses at export, and the tab then says so while timings, tokens and cost still work.
  • A place in the wider picture: these spans feed the same dashboards and alerts described in Monitor AI agents in production.

When something else fits

  • If you call Anthropic from a language with no integration, or you want time to first token on a stream, trace the call as a manual generation with record_first_token(), and exclude the Anthropic integration with instruments (for example instruments=["openai"]), or the call’s tokens and cost count twice.
  • If you use a framework or router over Anthropic, such as LangChain or LiteLLM, start from that integration’s page, since it decides which layer records the call.

Still stuck? Get help

Last updated on