Comparison
Providers
- OpenAI Agents SDK
- LiteLLM
- LangGraph
Worker and Workflow Setup
For Temporal-style agents using the OpenAI Agents SDK, LLM calls are auto-traced viaTemporalStreamingModelProvider. TemporalTracingModelProvider was removed in agentex-sdk 0.19.0. For non-Agentex usage of the OpenAI Agents SDK with the SGP tracing SDK directly, see the OpenAI Agents Integration page.Import TemporalStreamingModelProvider, ContextInterceptor, and the stream_lifecycle_content activity from agentex.lib.core.temporal.plugins.openai_agents. Register TemporalStreamingModelProvider with the worker’s OpenAIAgentsPlugin, register ContextInterceptor in the worker’s interceptor list, and add stream_lifecycle_content to the worker’s activities. Follow the Temporal OpenAI worker template for the complete worker configuration.The tracing flow is:- Your workflow sets
_task_id,_trace_id, and_parent_span_idon the workflow instance ContextInterceptor, registered on the worker, carries these IDs to each activity the workflow startsTemporalStreamingModel, the model the provider returns, creates a span for eachget_response()call. It raises aValueErrorif the task, trace or parent span ID is missing.
Auto-Traced Span Structure
Each LLM call produces a single span namedstreaming_model_get_response:The span name is always
streaming_model_get_response. The model name appears in the span’s input data. When the model input includes tool calls or tool results, the output also lists them under tool_calls and tool_outputs.Run a Turn with Tool Tracing
Call this method inside your configured workflow class. It creates the parent span, sets the model activity context, and passes the same context to the default tool hooks:run_turn creates TemporalStreamingHooks by default, passes them trace_id and parent_span_id, and closes any tool spans left open when the run ends. If you supply custom hooks, pass trace_id and parent_span_id to their constructor yourself; run_turn does not apply those values to custom hooks.Streaming Hooks
When you callRunner.run directly, create TemporalStreamingHooks yourself. It streams tool lifecycle events to the UI in real time. With trace_id set, it also opens a span for each tool call:TemporalStreamingModelProvider, the model posts each tool request (ToolRequestContent) itself, so emit_tool_requests=False keeps it from appearing twice. The hooks stream:ToolResponseContentwhen a tool finishes (name, result)TextContenton agent handoffs
close_open_tool_spans() ends that tool’s span, which is otherwise never written.Each tool span takes the bare tool name (no tool: prefix) and is a child of parent_span_id. Its input holds the tool arguments under arguments, and its output holds the result, cut to 2,000 characters, under result.Tracing Gap: Tool Calls
Choosing a Provider
I'm using OpenAI Agents SDK on Temporal
I'm using OpenAI Agents SDK on Temporal
Use
TemporalStreamingModelProvider for automatic LLM call tracing. The temporal-openai-agents CLI template passes it to OpenAIAgentsPlugin as model_provider and adds ContextInterceptor to the worker’s interceptors.For tool-level tracing, call run_turn with trace_id and parent_span_id, or pass them to TemporalStreamingHooks. For other custom logic, create manual spans using adk.tracing.span(). See Manual Spans for examples.I'm using LiteLLM directly
I'm using LiteLLM directly
Use the
adk.providers.litellm methods. All four methods automatically create tracing spans when you pass trace_id and parent_span_id. Wrap your own tool executions in manual spans.The auto_send variants are convenient for chat-style agents since they handle both tracing and UI message creation in one call.I'm using LangGraph
I'm using LangGraph
Wrap
graph.astream() in LangGraphTurn and deliver it with UnifiedEmitter, passing trace_id and parent_span_id. Tool calls and reasoning get their own spans; LLM calls do not, so add manual spans inside model nodes as needed.You still need to create turn-level parent spans manually to group operations by conversation turn.