- Workflow execution spans
- Activity execution spans with metadata
- Distributed traces across workers
- Parent-child relationships between workflows and activities
Setup
Install the required packages:Temporal integration requires TypeScript SDK v2.1.0+.
Trace with Temporal
Braintrust provides automatic tracing for Temporal workflows and activities. The integration uses a plugin pattern for TypeScript and Python, and OpenTelemetry interceptors for Go.TypeScript
Use theBraintrustTemporalPlugin with both your Temporal Client and Worker. The plugin automatically instruments your workflows and activities, creating spans that capture execution details and propagate trace context across process boundaries.
- Creates parent spans for workflow executions
- Creates child spans for activity executions
- Propagates trace context across workers via headers
- Handles concurrent workflow execution safely
Python
To trace Temporal workflows and activities automatically, callbraintrust.auto_instrument() (Python SDK v0.19.0 or later). It adds BraintrustPlugin to any Temporal client or worker you create, so you don’t need to configure anything manually.
BraintrustPlugin from braintrust.integrations.temporal, instantiate it, and pass it to both your Temporal client and worker via plugins=[plugin]. The plugin intercepts workflow and activity executions to create spans with full context, including workflow IDs, activity types, and execution metadata.
- Workflow execution spans via
BraintrustWorkflowInboundInterceptor - Activity execution spans with workflow metadata
- Span context serialization/deserialization via Temporal headers
- Temporal sandbox compatibility for braintrust imports