In an agent-based workspace, create an agent once before sending traces. Use agent addressing to select its identifier and environment. If an integration requires
project_name, use the selected environment’s tracer_session_name as a compatibility value.Prerequisites
- A LangSmith account and API key
- Temporal server running (local or cloud)
- OpenTelemetry SDK for your language
Environment variables
Set the following environment variables for all implementations:For regional SaaS or self-hosted LangSmith installations, also set
LANGCHAIN_BASE_URL to your LangSmith instance URL.Set up tracing
- Go
- Python
- TypeScript / JavaScript
This Go example uses the
langsmith-go SDK with Temporal’s OpenTelemetry interceptors to trace workflows and activities. It uses project-based configuration: set LANGSMITH_PROJECT to the environment’s tracer_session_name, without the two agent variables. The Python and TypeScript exporters use agent-addressing headers.1
Install
Install the LangSmith Go SDK, Temporal SDK, and OpenTelemetry interceptor:
2
Initialize tracer
Initialize the LangSmith tracer, create Temporal’s OpenTelemetry interceptor, and register it with the Temporal client and worker:
3
Define workflow and activity
Define a workflow that executes an activity. The activity demonstrates how to add custom span attributes for LangSmith visibility:
4
Execute workflow
In a separate client process, initialize the tracer and execute the workflow:
client.go
View traces in LangSmith
Once configured, traces appear in the selected agent environment:- Navigate to your LangSmith instance.
- Select your agent and environment.
- View traces in the Tracing tab.
- Click on individual traces to see the full span hierarchy.
Configuration options
Set a custom service name
Set a custom service name to distinguish different Temporal workers or services:Add custom span attributes
Add custom attributes to enrich your traces:Configure sampling
For high-volume workflows, configure sampling to reduce trace volume:Troubleshooting
Traces not appearing
- Verify API key: Ensure
LANGSMITH_API_KEYis set correctly - Check endpoint: Confirm you’re using
https://api.smith.langchain.com/otel/v1/traces - Flush on shutdown: Call
provider.shutdown()to flush pending spans before the process exits - Check destination: Verify the registered agent and environment in the exporter headers. For the Go compatibility example, verify the configured
tracer_session_name.
Missing activity spans
Ensure the tracing interceptor is configured on both the client and worker:- Client: Needs interceptor for starting workflows
- Worker: Needs interceptor for executing activities
Context propagation issues
Verify propagators are configured correctly:- Go:
langsmith.NewTracer()automatically configures propagators - Python/TypeScript: Ensure OpenTelemetry SDK is properly initialized with trace propagators
Worker shutdown hangs
If traces aren’t flushing, ensure you’re calling the shutdown method with proper timeout:Next steps
Additional resources
- Temporal Documentation
- Temporal Go SDK
- Temporal Python SDK
- Temporal TypeScript SDK
- OpenTelemetry Documentation
- LangSmith Go SDK
Connect these docs to your agent of choice via MCP for real-time answers.

