Skip to content

Releases: open-telemetry/opentelemetry-python-genai

opentelemetry-util-genai 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:41
14c76fe

Added

  • Add decode_base64 and image_from_url helpers for converting provider image payloads and data: URLs into Blob/Uri message parts. (#296)
  • Add conversation_id attribute to WorkflowInvocation to capture gen_ai.conversation.id on workflow spans. (#350)
  • Add a settable conversation_id to inference and workflow invocations, emitted as gen_ai.conversation.id. (#474)
  • Add GenAIInvocation.record_stream_chunk() so callback-based instrumentations can report streaming timing without wrapping the SDK's stream. (#482)
  • Add a Role enum mirroring the message roles the GenAI semantic conventions define, which the generated semconv package does not expose (#506)
  • Add agent_name kwarg to TelemetryHandler.tool(); when set, gen_ai.agent.name is written on the execute_tool span (#512)
  • Add GenAIInvocation.should_capture_content property. (#593)
  • Add SystemInstructionPart model, align GenericPart with semantic conventions by removing value, and update invocation types. (#612)
  • Add cache_write_input_tokens and modality token breakdown attributes (text_*, image_*, audio_*) to invocations. (#613)
  • Add reasoning_level, previous_response_id, conversation_compacted, and prompt.* attributes to inference invocations. (#614)
  • Record gen_ai.execute_tool.duration on tool invocations and align gen_ai.invoke_workflow.duration attributes and bucket boundaries with semantic conventions. (#615)
  • Add LocalAgentInvocation and RemoteAgentInvocation for in-process and remote agent invocations. (#616)
  • Add instrumentation_scope_name and instrumentation_scope_version to TelemetryHandler so telemetry carries the instrumentation library's scope (#632)
  • Add suspend() and activate() to GenAI invocations for handing context back to the caller while the invocation is still running, SyncToolStreamWrapper/AsyncToolStreamWrapper for streaming tool executions, and RetrievalDocument model. (#673)
  • Add InferenceInvocation.set_input_tokens, set_output_tokens and set_cache_read_input_tokens for recording per-modality token breakdowns, and add text to Modality. (#674)
  • Add context property to GenAIInvocation and optional context parameter to TelemetryHandler.tool. (#704)
  • Add conversation_id and context arguments to the inference, agent and workflow factories on TelemetryHandler; nested invocations inherit the conversation id. (#726)
  • Add bind_arguments, get_argument, and get_signature utilities for signature-based parameter extraction. (#740)
  • Add optional context parameter to TelemetryHandler methods and invocation classes. (#758)
  • Add the shared RetrievalDocument model with optional id and score fields; retain legacy mapping support on retrieval invocations. (#775)

Changed

  • Tool definitions are not emitted when content capture is disabled (#377)
  • Align message-part class names with semconv (*Part suffix). Rename Text/Blob/File/Uri/Reasoning/ToolCallRequest/ToolCallResponse/ServerToolCall/ServerToolCallResponse to their *Part forms to match semantic-conventions-genai models. (#450)
  • Remove tool_call_id and tool_description from execute_tool start attributes and set them on the invocation instance instead. (#577)
  • Add optional name field to InputMessage and OutputMessage, and make finish_reason optional in OutputMessage. (#611)
  • Record top_k on retrieval spans as integer gen_ai.retrieval.top_k. (#614)
  • Record gen_ai.invoke_agent.duration on local agent invocations. (#616)
  • An invocation started with an explicit context now uses it as the base of its own context, not only to parent the span, so entries the caller put on it stay visible to nested invocations. (#726)
  • Inline invocation span initialization into GenAIInvocation.__init__. (#741)
  • Replace the Modality literal type alias with string enum constants while preserving raw-string support in message parts and token helpers. (#749)

Deprecated

  • Deprecate the message part classes Text, Reasoning, Blob, File, Uri, ToolCallRequest, ToolCallResponse, ServerToolCall and ServerToolCallResponse; they remain available as aliases of their *Part replacements. (#450)
  • Deprecate passing tool_call_id and tool_description as keyword arguments to handler.tool(). (#577)
  • Deprecate should_capture_content_on_spans() and ToolInvocation.should_capture_content_on_span in favor of GenAIInvocation.should_capture_content. (#593)
  • Deprecate OutputMessage.finish_reason. Report finish reasons via gen_ai.response.finish_reasons instead. (#611)
  • Deprecate cache_creation_input_tokens in favor of cache_write_input_tokens. (#613)
  • Deprecate get_telemetry_handler, construct and cache a TelemetryHandler instead. (#632)
  • Deprecate should_emit_event(). Event emission is handled internally by telemetry handlers and invocations. (#746)

Removed

  • Remove internal InvocationMetricsRecorder, instruments.py, and metrics.py. (#615)
  • Remove agent_id and agent_version start-time parameters from invoke_remote_agent; set them on the returned invocation instead. (#729)

Fixed

  • Record gen_ai.invoke_workflow.duration metric on workflow invocations (WorkflowInvocation). (#350)
  • Record cancellation as a failure: the invocation context manager finalized any non-Exception BaseException (asyncio.CancelledError, KeyboardInterrupt, SystemExit, GeneratorExit) through the success path, so cancelled operations were exported with an unset span status and no error.type. (#520)
  • Finalize stream telemetry when stream iteration, close, or manager entry/exit is cancelled. (#656)
  • Change InferenceInvocation.top_k type from float to int. (#707)
  • Wrap programmatic completion hooks in safe wrapper to suppress exceptions. (#750)

opentelemetry-instrumentation-google-genai 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:44
14c76fe

Added

  • Record modality token usage breakdown attributes (text, image, audio) for interactions. (#613)
  • Record modality token usage breakdown attributes (text, image, audio) for generate_content. (#674)
  • Record gen_ai.client.operation.time_to_first_chunk and gen_ai.client.operation.time_per_output_chunk metrics on streamed responses. (#711)
  • Capture generation configuration and output format attributes for synchronous, asynchronous, and streaming Interactions requests. (#752)
  • Add fetch_response spans for Google GenAI interactions.get, including streamed and resumed retrieval. (#755)

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#365)
  • Tool definitions are not emitted when content capture is disabled (#377)

Fixed

  • Record failed Google Interactions streaming requests instead of leaving their spans open. (#538)
  • Emit telemetry under the opentelemetry.instrumentation.google_genai instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Record failed Google GenAI interaction invocations when cancellation raises a BaseException. (#656)
  • Capture provider-executed tool calls and results as server tool message parts. (#701)
  • Do not record gen_ai.embeddings.dimension.count on metrics. (#708)

opentelemetry-instrumentation-genai-smolagents 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:44
14c76fe

Added

  • Add invoke_agent spans for streaming and non-streaming MultiStepAgent.run() calls. (#403)

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#365)
  • Tool definitions are not emitted when content capture is disabled (#377)
  • Record metric gen_ai.invoke_agent.duration instead of gen_ai.client.operation.duration. (#616)

Fixed

  • Emit telemetry under the opentelemetry.instrumentation.genai.smolagents instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Coerce top_k request parameter to integer. (#707)

opentelemetry-instrumentation-genai-qwen-agent 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:41
14c76fe

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#365)
  • Record metrics gen_ai.invoke_agent.duration and gen_ai.execute_tool.duration instead of gen_ai.client.operation.duration. (#616)

Fixed

  • Emit telemetry under the opentelemetry.instrumentation.genai.qwen_agent instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Record failed Qwen Agent tool invocations when cancellation raises a BaseException. (#656)

opentelemetry-instrumentation-genai-portkey 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:41
14c76fe

Added

  • Add Portkey AI instrumentation (#465)
  • Add inference and streaming span instrumentation for Portkey (#466)
  • Record cache-write, cache-read, reasoning, and explicit text, image, and audio token usage for chat and prompt completions, including streamed responses. (#751)

Changed

  • Tool definitions are not emitted when content capture is disabled (#377)
  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#575)

Fixed

  • Emit telemetry under the opentelemetry.instrumentation.genai.portkey instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Record failed Portkey invocations when cancellation raises a BaseException. (#656)
  • Coerce top_k request parameter to integer. (#707)

opentelemetry-instrumentation-genai-openai 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:43
14c76fe

Added

  • Capture OpenAI multimodal image content (image_url and Responses API input_image) as BlobPart, UriPart, or FilePart message parts. (#540)
  • Record cache_write_input_tokens from response usage. (#613)
  • Capture cached prompt tokens - gen_ai.usage.cache_read.input_tokens on chat completions (#662)
  • Capture reasoning tokens - gen_ai.usage.reasoning.output_tokens on chat completions (#680)

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#365)
  • Tool definitions are not emitted when content capture is disabled (#377)
  • Populate name attribute on captured input messages when available. (#611)

Fixed

  • Capture the remaining OpenAI content parts: input_audio as an audio blob, file/input_file as a document reference or blob, and refusal as text; record a completion refusal in gen_ai.output.messages. (#358)
  • Stop consuming generator message content while capturing input messages, which left the wrapped request with no content at all. Capture a file part's inline base64 file_data and take its media type from filename. (#522)
  • Record response telemetry for with_streaming_response calls on the async client, whose parse() returns a coroutine, and end the span for a parsed stream the caller abandons. (#610)
  • Record gen_ai.tool.definitions on Responses API create and stream spans. (#625)
  • Record gen_ai.conversation.id from the Responses API conversation request parameter. (#631)
  • Emit telemetry under the opentelemetry.instrumentation.genai.openai instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Record function_call, custom_tool_call and their output items on Responses API spans, so a turn that follows a tool call keeps its tool-loop history in gen_ai.input.messages. (#650)
  • Record failed OpenAI invocations when cancellation raises a BaseException. (#656)
  • Capture provider-executed Responses API tools in output messages. (#700)
  • Do not record gen_ai.embeddings.dimension.count on metrics. (#708)
  • Do not record gen_ai.request.stream on fetch_response spans. (#709)
  • Keep the gen_ai.conversation.id inherited from an enclosing agent framework when a Responses request carries no conversation parameter (#726)

opentelemetry-instrumentation-genai-openai-agents 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:40
14c76fe

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.1b0, where Error.type became the error.type string value. (#485)
  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#593)
  • Record metrics gen_ai.invoke_agent.duration and gen_ai.execute_tool.duration instead of gen_ai.client.operation.duration. (#616)

Fixed

  • Mark tool and agent span errors recorded on the agents-library Span.error (#485)
  • Record gen_ai.tool.call.arguments on execute_tool spans. (#588)
  • Emit telemetry under the opentelemetry.instrumentation.genai.openai_agents instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Do not record gen_ai.provider.name on tool execution metric attributes. (#710)
  • Record gen_ai.conversation.id from RunConfig.group_id on invoke_workflow and invoke_agent spans, and propagate it to the chat span emitted by the model SDK instrumentation. (#726)

opentelemetry-instrumentation-genai-llama-index 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:46
14c76fe

Added

  • Add skeleton and boilerplate for LlamaIndex instrumentation package (opentelemetry-instrumentation-genai-llama-index). (#309)
  • Add agent invocation and tool execution spans for LlamaIndex agents. (#494)
  • Add tracing for LlamaIndex AgentWorkflow runs and member agent executions. (#668)
  • Add retrieval span instrumentation for LlamaIndex BaseRetriever operations. (#698)

Changed

  • Tool definitions are not emitted when content capture is disabled (#377)
  • Record metrics gen_ai.invoke_agent.duration and gen_ai.execute_tool.duration instead of gen_ai.client.operation.duration. (#616)
  • Simplify tool context propagation using invocation context. (#704)
  • Use the shared RetrievalDocument model to capture only document IDs and scores, with null for unavailable scores, instead of node text. (#775)

Fixed

  • Emit telemetry under the opentelemetry.instrumentation.genai.llama_index instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Keep one invoke_agent span open across an AgentWorkflow member's tool loop, parent execute_tool spans to the requesting agent, and keep a handing-off agent's span open until every tool call of that turn ends. (#668)
  • Exclude broken llama-index-workflows 2.24.0 and declare companion library bounds. (#739)

opentelemetry-instrumentation-genai-langchain 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:43
14c76fe

Added

  • (OpenInference Migration: LangChain) - Capture multimodal image content (OpenAI image_url and Responses API input_image, Anthropic image, and LangChain standard image blocks) as BlobPart/UriPart/FilePart message parts. (#296)
  • Capture document relevance score on retrieval spans per OpenTelemetry GenAI semantic conventions. (#670)
  • Record cache_write_input_tokens and modality token breakdown attributes (text, image, audio) from LangChain usage metadata on InferenceInvocation. (#671)
  • Capture request model from ls_model_name metadata on chat (#682)
  • Capture top_k - gen_ai.request.top_k and choice count - gen_ai.request.choice.count on chat (#684)
  • Record finish_reasons from chat generation metadata. (#705)
  • Classify agent chains by name on on_chain_start (#766)

Changed

  • Bump the minimum opentelemetry-util-genai version to 1.2b0. (#365)
  • Tool definitions are not emitted when content capture is disabled (#377)
  • Raised the opentelemetry-util-genai dependency floor to 1.2b0 for GenAIInvocation.record_stream_chunk (#482)
  • Populate name attribute on captured input and output messages when available. (#611)
  • Record metrics gen_ai.invoke_agent.duration and gen_ai.execute_tool.duration instead of gen_ai.client.operation.duration, and stop setting span attribute gen_ai.agent.id on internal agent spans. (#616)
  • Record modality token usage through the shared InferenceInvocation setters; extract_token_details no longer returns modality keys. (#674)
  • Use the shared RetrievalDocument model to capture only document IDs and scores, with null for unavailable fields, instead of document text. (#775)

Fixed

  • Emit invoke_agent spans for LangChain create_agent graph roots, including nested agents, which get their own spans. (#391)
  • Populate gen_ai.conversation.id on model call and workflow spans, resolved from the thread_id, session_id or conversation_id metadata keys and inherited by nested runs. (#474)
  • Mark streamed calls with gen_ai.request.stream and record gen_ai.response.time_to_first_chunk plus the streaming timing metrics, which were never emitted for LangChain. (#482)
  • Record gen_ai.response.model on streamed spans (#505)
  • Resolve message roles by class so streaming chunk messages no longer report their class name (AIMessageChunk) as the role (#506)
  • Record gen_ai.tool.call.id on failed execute_tool spans (#510)
  • Set gen_ai.agent.name on child execute_tool spans when running under an enclosing invoke_agent (#512)
  • Emit telemetry under the opentelemetry.instrumentation.genai.langchain instrumentation scope instead of opentelemetry.util.genai.handler (#632)
  • Propagate parent context to nested agent, tool, retrieval, and workflow spans in async execution paths. (#758)

opentelemetry-instrumentation-genai-dspy 1.2b0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 16:41
14c76fe

Added

  • Add initial DSPy instrumentation package setup. (#439)
  • Add instrumentation for DSPy Tool execution and ReAct agent invocations. (#529)
  • Support copy and deepcopy on wrapped DSPy methods to ensure compatibility with DSPy compilation and optimizers. (#591)
  • Instrument dspy.Retrieve to emit GenAI retrieval spans. (#594)

Changed

  • Record metrics gen_ai.invoke_agent.duration and gen_ai.execute_tool.duration instead of gen_ai.client.operation.duration. (#616)
  • Use the shared RetrievalDocument model for retrieval results, with null IDs and scores for text-only passages, instead of capturing passage text. (#775)

Fixed

  • Emit telemetry under the opentelemetry.instrumentation.genai.dspy instrumentation scope instead of opentelemetry.util.genai.handler (#632)