- Mirror production traces into a staging or personal project for debugging.
- Write to multiple workspaces for multi-tenant isolation without changing any application code.
- Send traces to the same server under different projects, with per-replica metadata overrides.
Configure replicas via environment variable
Set theLANGSMITH_RUNS_ENDPOINTS environment variable to a JSON value. Two formats are supported:
-
Object format: maps each endpoint URL to its API key. Each URL appears once, so use the array format when two replicas share a URL:
-
Array format: a list of replica objects, useful when you need multiple replicas pointing at the same URL or when you want to set a
project_nameper replica:
Configure replicas at runtime
You can also pass replicas directly in code, which is useful when destinations vary per request or tenant.updates field to merge additional fields (such as metadata or tags) into a run for a specific replica only, leaving the primary trace unchanged. Replica errors are non-fatal: if a replica endpoint is unavailable, LangSmith logs the error without affecting the primary trace.
Replicate within the same server (project-only replicas)
If all your replicas use the same LangSmith server, you can omitapi_url and auth and specify only a project_name. The SDK reuses the default client credentials:
Leave feedback on all replica instances
When you use replicas, each replica receives a copy of every run. To submit feedback for a run on a specific replica, you need that replica’s run ID. In Python SDK 0.10.8 or later and JS SDK 0.8.5 or later, you can designate one replica as the primary and usecompute_run_id_for_secondary_replica to deterministically calculate the run IDs for all other replicas.
The primary replica keeps the original run ID unchanged. Each secondary replica receives a deterministic run ID derived from the original run ID and the secondary replica’s project name. Use compute_run_id_for_secondary_replica(original_run_id, project_name) to compute the secondary run ID and pass it when calling create_feedback. Both SDKs raise an error if the run ID is not a UUID v7, or if the project name is empty.
The
compute_run_id_for_secondary_replica / computeRunIdForSecondaryReplica helper is available in Python SDK 0.10.8 or later and JS SDK 0.8.5 or later. If you are using an earlier SDK version, upgrade to use this feature.Route between LangSmith and OpenTelemetry destinations
You can decide at runtime whether a given invocation sends traces to LangSmith, to an OpenTelemetry (OTel) backend, or to both, without redeploying or modifying application logic. This is useful when you want to toggle between observability backends per environment, or even per request, making the decision at runtime. Set the tracing mode using thetracing_mode constructor argument or the LANGSMITH_TRACING_MODE environment variable. Both accept the same values; an explicit tracing_mode argument always takes precedence over the env var:
"langsmith"(default): sends traces natively to LangSmith."otel": exports traces as OpenTelemetry spans to a configured OTel backend."hybrid"(Python only): sends to both LangSmith and an OTel backend from a single replica.
If you are using the deprecated
otel_enabled parameter on Client (Python only), migrate to tracing_mode: Client(otel_enabled=True) → Client(tracing_mode="hybrid"). The otel_enabled parameter is removed in the next minor version.Client directly into a replica to apply the desired mode at runtime:
tracing_mode on each Client determines that replica’s export path. In Python, "hybrid" mode handles both destinations within a single replica. In TypeScript, the “send to both” case uses two separate replicas, one for each client, because there is no "hybrid" mode. Since each replica resolves its own client independently, you can also mix modes within a single tracing_context, for example keeping one replica sending to LangSmith while forwarding the same trace to an OTel collector via a second replica.
Connect these docs to your agent of choice via MCP for real-time answers.

