Skip to main content
Temporal runs Workflows durably: if a process crashes, the Workflow continues where it left off, and failed Activities are retried. That makes it a common runtime for long-running AI agents. With OpenTelemetry, you can see each Workflow in Bronto as one trace: the client that started it, the Workflow, every Activity attempt and, for agents, every model request and tool call. This page covers the Temporal Python, TypeScript and Go SDKs:
  • Traces from each SDK’s OpenTelemetry plugin or, in Go, its tracing interceptor
  • Metrics from each SDK’s metrics exporter or, in Go, its metrics handler
  • AI agents run on Temporal, built with the Claude Agent SDK (Python, TypeScript) or the Anthropic Go SDK (Go)
This page was verified on November 26, 2026 with temporalio 1.37.0, temporalio-claude-agent-sdk 0.0.3, claude-agent-sdk 0.2.168 (Claude Code 2.1.301), the OpenTelemetry Python SDK 1.45.2 and a local Temporal dev server (Temporal CLI 1.10.1). The TypeScript examples were verified on November 27, 2026 with @temporalio/* 1.27.0, @temporalio/interceptors-opentelemetry-v2 1.27.0, @anthropic-ai/claude-agent-sdk 0.3.332 (Claude Code 2.1.332), the OpenTelemetry JS SDK 2.12.1 and Node.js 24. The Go examples were verified on November 27, 2026 with go.temporal.io/sdk 1.52.0, go.temporal.io/sdk/contrib/opentelemetry 0.9.0, github.com/anthropics/anthropic-sdk-go 1.84.0, the OpenTelemetry Go SDK 1.47.0 and Go 1.27. GenAI libraries and semantic conventions are evolving rapidly, so package configuration and emitted attributes can change between releases. Keep your instrumentation current and verify the fields emitted by the version you deploy.

Prerequisites

  • Python 3.11+, Node.js 20+ or Go 1.26+, and the Temporal SDK for your language
  • A Temporal Service: Temporal Cloud, a self-hosted cluster or temporal server start-dev for local development
  • An OTel Collector configured using Connect OpenTelemetry to Bronto, or a direct OTLP exporter (below)

Send traces and metrics to Bronto

Via a Collector: point the application’s OTLP exporter at the Collector, then configure the Collector using Connect OpenTelemetry to Bronto. This is recommended in production. Direct export: point the exporter at the Bronto ingestion endpoint and add your API key:
The OpenTelemetry SDK appends /v1/traces. Give the Worker and the process that starts Workflows different service names, so you can tell them apart in a trace. See API Keys for how to create a key with ingestion permissions. In TypeScript, the OTLP trace exporter reads these variables. In Go, the OTLP trace and metric exporters both read them. The TypeScript and Go examples set the service name in code, in the tracer provider’s resource.

Trace Workflows and Activities

Register a tracer provider, then add the SDK’s OpenTelemetryPlugin to the client. Do this in every process that uses Temporal, both the Worker and the code that starts Workflows, so their spans join one trace:
Use create_tracer_provider() instead of the OpenTelemetry SDK’s TracerProvider. Workflow code can be replayed, and the provider it returns is replay-safe. Register it before Client.connect. A Worker created from the client uses the client’s plugins, so you don’t pass plugins to Worker again. Short-lived processes, such as a script that starts one Workflow, should call provider.force_flush() before they exit.
OpenTelemetryPlugin is marked experimental in temporalio 1.37.0. Older guides use TracingInterceptor from the same module. It still works, but its Workflow span has a duration of zero, so it doesn’t show how long the Workflow ran.

Spans

One Workflow that runs two Activities, where charge_card fails once and succeeds on retry, produces this trace:
Bronto trace waterfall of OrderWorkflow in Python: StartWorkflow, RunWorkflow, StartActivity and RunActivity spans for fetch_order and charge_card, with the first charge_card attempt in error and a second attempt after the retry interval

The Workflow trace in Bronto: 7 spans over 1.45 s, with the failed charge_card attempt and its retry

In each trace, RunWorkflow is a child of StartWorkflow, StartActivity is a child of RunWorkflow, and each RunActivity attempt is a child of its StartActivity. Open Tracing and select the StartWorkflow:<Workflow type> operation to find Workflows, then open a trace to see the Workflow as a waterfall. Each Activity attempt is its own RunActivity span, so retries and the wait between them are visible. A failed attempt has an error status and an exception event with the error message. The TypeScript and Go SDKs produce the same trace. Span names use the function names of your Workflows and Activities, for example StartWorkflow:orderWorkflow and RunActivity:chargeCard in TypeScript, or RunActivity:ChargeCard in Go. In Go, the exception.type of a failed attempt is the Go error type, for example *errors.errorString.
Span details of a failed RunActivity span in Bronto, showing the error status, the exception message and type, and the temporalActivityID, temporalRunID and temporalWorkflowID attributes

A failed Activity attempt with its exception event and Temporal attributes

In TypeScript, the RunWorkflow span also carries workflowType. The RunWorkflow span lasts from the start of the Workflow to its completion. The root StartWorkflow span ends when the Temporal Service accepts the start request, so its duration is the latency of that call, not of the Workflow.

Trace AI agents on Temporal

An agent on Temporal runs its model requests and tool calls from Workflow and Activity code, so they can join the Workflow’s trace. How you run the agent depends on the language.
Temporal’s Claude Agent SDK integration runs a Claude agent inside a Workflow. The agent runs in a Claude Code subprocess that the Worker starts from an Activity. Tools can call Activities, so a crash doesn’t lose the run. The integration doesn’t emit spans of its own, but OpenTelemetryPlugin passes the trace context to the Claude Code subprocess. With Claude Code’s telemetry turned on, its model requests and tool calls join the Workflow’s trace.
Start the event loop under if __name__ == "__main__": in any module that defines a Workflow. Temporal imports the module again in its Workflow sandbox to validate it.Turn on Claude Code’s trace export in the Worker’s environment. The Claude Code subprocess inherits it, together with the OTEL_EXPORTER_OTLP_* variables from Send traces and metrics to Bronto and ANTHROPIC_API_KEY:
Don’t pass these variables, or any API key, through ClaudeAgentOptions.env. The options are part of the Workflow’s input, so they’re stored in its Event History.
One agent run produces this trace (trimmed):
Bronto trace waterfall of the Python weather agent: StartWorkflow, RunWorkflow and a StartActivity with RunActivity that starts the Claude Code subprocess, with a claude_code.interaction span that contains three claude_code.llm_request spans and a claude_code.tool span with blocked_on_user and execution children

The agent trace in Bronto: 58 spans over 7.83 s. The top rows show the Workflow, the Claude Code subprocess and its model requests and tool call

The screenshot shows the first rows only. Below them the trace continues with sibling StartActivity and RunActivity spans for the tool, and the claude-agent-sdk-read, claude-agent-sdk-write and claude-agent-sdk-close Activities. The ask-agent span at the root comes from the example’s own code that starts the Workflow.The Workflow also runs claude-agent-sdk-read and claude-agent-sdk-write Activities to exchange messages with the subprocess. They show up as sibling spans under RunWorkflow.
The Python and TypeScript agents run in Claude Code, so their model requests and tool calls are claude_code.* spans:
Span details of a claude_code.llm_request span in Bronto, showing the model, input, output and cache tokens, time to first token and the stop reason

A claude_code.llm_request span with model, token counts and time to first token

In the TypeScript run (Claude Code 2.1.332), gen_ai.tool.name was the tool name without the MCP prefix, get_weather. The prefixed name mcp__demo__get_weather was in tool_name. By default, the spans contain no prompts, responses or tool arguments. For the settings that add them, see Claude Code: Monitoring.

Send Temporal SDK metrics

The Temporal SDK has its own metrics exporter, separate from the OpenTelemetry Python SDK. It doesn’t read the OTEL_EXPORTER_OTLP_* variables, so pass the endpoint and API key in code. The example reads the key from its own variable:
Configure the exporter on a Runtime and pass the runtime to the client:
Differences from the OpenTelemetry SDK exporter:
  • Use the full URL including /v1/metrics. Unlike the OpenTelemetry SDK, it doesn’t append the path.
  • Set http=True. The default is OTLP over gRPC.
  • Set the temporality to DELTA. With cumulative temporality, every export repeats the running total, and summing a counter in Bronto counts the same events more than once.
It does read OTEL_SERVICE_NAME for the service.name resource attribute.
The metrics appear in Metrics Explorer with the temporal_ prefix. Useful ones:
Bronto Metrics Explorer showing temporal_activity_execution_failed as a sum grouped by activity_type, with one failure for charge_card

temporal_activity_execution_failed grouped by activity_type

All of them also carry namespace. For the full list of metrics and their tags, see the Temporal SDK metrics reference. The TypeScript and Go SDKs emit the same metric names. Their workflow_type and activity_type values are the function names, for example chargeCard in TypeScript. Go keeps Go casing, for example ChargeCard. Latency metrics are in milliseconds in Python and TypeScript, and in seconds in Go. A Workflow that ran 1.07 seconds has a temporal_workflow_endtoend_latency of 1.07 in Go. Keep this in mind when you compare Workers in different languages or set monitor thresholds.

Alert on failures

Monitors evaluate log datasets and metrics, not spans. Create a metric monitor on temporal_workflow_failed or temporal_activity_execution_failed with Sum over a time window, grouped by workflow_type or activity_type. A monitor on temporal_activity_schedule_to_start_latency tells you when Workers fall behind.

Verify in Bronto

Start a Workflow, then open Tracing and filter by the service names you configured. Each Workflow appears as a StartWorkflow:<Workflow type> operation. The Worker’s spans can arrive a minute or two after the client’s span. Then open Metrics Explorer and search for temporal_. If the client’s span appears but the Worker’s spans don’t, check that the Worker’s client also has OpenTelemetryPlugin and a tracer provider registered before Client.connect. If no metrics appear, check the full /v1/metrics URL and http=True. In TypeScript, check that the Worker passes OpenTelemetryPlugin to Worker.create and that provider.register() ran before the first Workflow. If no metrics appear, check the full /v1/metrics URL and http: true, and look for export errors in the Worker’s log. In Go, check that the Worker’s client has the tracing interceptor and that you called otel.SetTracerProvider before you created the client. The Go exporters write errors to the standard log package. If a stray OTEL_EXPORTER_OTLP_INSECURE=true is set in the environment, they send plain HTTP to the endpoint and time out.

References