Google Gen AI SDK
OpenTelemetry instrumentation for the Google Gen AI SDK. The offline example is pending.
Python
Package: opentelemetry-instrumentation-google-genai (version at time of writing: 1.3b0, not yet tested by us)
- Upstream docs: OpenTelemetry Google Gen AI instrumentation (GitHub)
- Upstream docs: opentelemetry-instrumentation-google-genai (PyPI)
Not yet tested by us: the install line and setup below have not been run by us.
pip install opentelemetry-sdk==1.45.2 opentelemetry-instrumentation-google-genai==1.3b0 google-genaifrom opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
# After creating your tracer provider (resource with "telumin.agent.owner"):
GoogleGenAiSdkInstrumentor().instrument(tracer_provider=provider)Example pending
No example yet. Each example must run in CI with a mocked model, without an API key and without network access, and that has not been verified for this package.
TypeScript
- Upstream docs: OpenTelemetry GenAI span conventions
Not yet tested by us: the install line and setup below have not been run by us.
npm install --save-exact @opentelemetry/api@1.9.1import { trace } from "@opentelemetry/api"
// No instrumentation package verified yet: create the agent span yourself.
const tracer = trace.getTracer("refund-service")
await tracer.startActiveSpan("invoke_agent refund-agent", {
attributes: {
"gen_ai.operation.name": "invoke_agent",
"gen_ai.agent.name": "refund-agent",
"gen_ai.agent.id": "refund-agent-v1",
"gen_ai.agent.version": "1.0.0",
},
}, async (span) => {
// call the Gen AI SDK here; wrap each tool call in an "execute_tool <name>" span
span.end()
})Example pending
No OpenTelemetry instrumentation package for the Google Gen AI TypeScript SDK has been verified yet.
Owner and approvals
No instrumentation package records who owns an agent or who approved a tool call. Add both with telumin-otel, as the examples do.
Check the result
To check the result, export the spans as OTLP JSON (or send them through the collector tap) and drop the file on the free check. The check runs in your browser tab.