How it works
Distributed tracing links runs across services using context propagation headers:- The client infers the trace context from the current run and sends it as HTTP headers.
- The server reads the headers and adds them to the run’s config and metadata as
langsmith-traceandlangsmith-projectconfigurable values. You can choose to use these to set the tracing context for a given run when your agent is used.
langsmith-trace: Contains the trace’s dotted order.baggage: Specifies the LangSmith project and other optional tags and metadata.
Configure the server
To accept distributed trace context, your graph must read the trace headers from the config and set the tracing context. The headers are passed through theconfigurable field as langsmith-trace and langsmith-project.
graph function in your langgraph.json:
Connect from the client
- RemoteGraph
- SDK
Set
distributed_tracing=True when initializing RemoteGraph. This automatically propagates trace headers on all requests.Related
- Distributed tracing: General distributed tracing concepts and patterns
- RemoteGraph: Full guide to interacting with deployments using RemoteGraph