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
Go uses the
langsmith-go SDK with Temporal’s OpenTelemetry interceptors to automatically trace workflows and activities.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 application, initialize the tracer and execute the workflow:
client.go
View traces in LangSmith
Once configured, traces will appear in your LangSmith project:- Navigate to your LangSmith instance.
- Select your project.
- 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 application exits - Check project: Verify traces are sent to the correct project (default is
"default")
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 Claude, VSCode, and more via MCP for real-time answers.

