Skip to Content
RiusSDKAuto-instrumentation

Auto-instrumentation

The Rius SDK can instrument popular LLM libraries automatically, so model calls appear as generations without any manual spans. Each integration is an optional extra with its own recipe page:

pip install "glassflow-ai[openai]" pip install "glassflow-ai[anthropic,langchain]" pip install "glassflow-ai[instruments]" # all of them
ExtraInstrumentsRecipe
openaiOpenAI client callsOpenAI
anthropicAnthropic client callsAnthropic
langchainLangChain and LangGraph runsLangChain
llama-indexLlamaIndex pipelinesLlamaIndex
litellmLiteLLM routed callsLiteLLM
mcpYour agent’s outgoing MCP tool callsbelow

The client-library integrations are powered by OpenInference , the open source (Apache-2.0) instrumentation project from Arize AI; the SDK bundles its instrumentors as extras and wires them into the Rius pipeline. The MCP integration is built into the SDK itself.

Enabling

With a default (global) init(), every installed integration is enabled automatically:

glassflow.init() # everything installed glassflow.init(instruments=["openai"]) # only OpenAI glassflow.init(instruments=[]) # none

Details worth knowing:

  • Requesting an integration whose package is not installed logs a warning and continues; a broken instrumentor never blocks init().
  • If a library is already instrumented by other OpenTelemetry code (not by this SDK), it is left alone.
  • Scoped clients (set_global=False) do not auto-instrument, because instrumentors patch libraries process-wide; pass instruments=[...] explicitly to opt in.

MCP instrumentation

Two different things share the MCP name. This extra instruments your agent’s own outgoing MCP tool calls so they show up in your traces. The Rius MCP server is the opposite direction: an endpoint that lets AI clients query your telemetry. Instrumenting your agent does not require the MCP server, and vice versa.

With the mcp extra installed, calls made through mcp.ClientSession.call_tool() are traced as TOOL spans named execute_tool <name>, carrying:

  • gen_ai.tool.name: the tool being called
  • input.value: the tool arguments (JSON)
  • output.value: the tool result, preferring structured content, falling back to text blocks

Failures are recorded with ERROR status, both when the call raises and when the MCP result itself reports isError: true. Argument and result values are content attributes, so privacy controls apply to them like everything else.

Last updated on