groundy
Agents & Frameworks

Pydantic AI vs LangChain: Where Agent Tracing Sends Your Data

Vendor docs show trace destination is a deployment choice, not a framework trait. LangSmith offers regional SaaS and self-hosting; Pydantic AI uses OpenTelemetry.

Published 6 references
On this page9 sections

The practical finding is that trace destination is mainly a deployment-configuration decision, not a consequence of choosing Pydantic AI or LangChain. LangChain says hosted LangSmith at smith.langchain.com stores data in GCP us-central-1, while EU accounts must point LANGSMITH_ENDPOINT at an EU host. Pydantic AI’s overview instead describes plain OpenTelemetry instrumentation that can use an observability backend a team already runs.

That changes the evaluation order. Before comparing agent APIs, decide which telemetry backend is acceptable, which region it uses, and who operates it. OpenTelemetry compatibility is not itself a residency guarantee, and a regional SaaS endpoint is not an EU AI Act or GDPR determination. All the product evidence here comes from undated vendor documentation and marketing pages, none of it independently evaluated.

The framework boundary does not bound the telemetry

LangSmith’s capture scope can extend beyond LangChain’s own modules. Its LangGraph tracing documentation says LangSmith integrates with LangGraph in Python and JavaScript and can trace agents “whether you’re using LangChain modules or other SDKs.” A team should therefore assess the tracing configuration and backend, rather than assuming that using another model SDK keeps telemetry outside LangSmith.

The Pydantic evidence establishes a different wiring model, but much less operational detail. Pydantic says its instrumentation is plain OpenTelemetry, “so any backend you already run works.” That is a vendor compatibility statement, not an independently tested backend matrix. It also does not establish where an unconfigured installation sends data, what the Logfire hosted service stores, or which fields a trace contains.

Decision axisLangChain with LangSmithPydantic AI with Logfire instrumentation
Hosted storage locationLangChain says hosted smith.langchain.com data is stored in GCP us-central-1.Pydantic’s documentation does not state a default Logfire storage region.
Destination controlEU accounts set LANGSMITH_ENDPOINT to https://eu.api.smith.langchain.com; the guide gives no other regional host values.Pydantic says plain OpenTelemetry works with any backend the team already runs. The overview does not document the exact exporter configuration or post-setup destination.
Residency and deployment optionsLangChain markets SaaS residency in the US, Europe and APAC, plus BYOC and self-hosted deployment. Enterprise delivery can run on customer Kubernetes infrastructure.Pydantic’s overview documents no Logfire region, BYOC or self-hosting options.
Data-use statementLangChain says LangSmith will not train on customer data and customers retain all rights to it.Pydantic’s overview is silent on training use. Silence does not establish that training occurs.
Trace submission behaviorLangChain Python submits traces from a background thread, so a short-lived process can exit before submission completes.Pydantic’s overview documents no equivalent submission or shutdown behavior.

This is deliberately an asymmetric comparison. The LangChain side has documentation on storage, deployment and submission behavior. The Pydantic column rests principally on two overview-page statements about OpenTelemetry and setup. Treat the empty cells as research requirements, not as evidence that the corresponding features do not exist.

LangSmith’s residency ladder starts with an environment variable

For EU accounts, LangChain’s tracing guide documents this setting:

Terminal window
export LANGSMITH_ENDPOINT="https://eu.api.smith.langchain.com"

The guide says the setting is necessary for the EU API key to be recognized and authentication to succeed. This is a concrete destination control outside agent code. It also means an endpoint mismatch can be an operational configuration error, not merely a policy preference.

The documented default and the marketed regional offering answer different questions. LangSmith’s observability page identifies GCP us-central-1 as the storage location for the hosted smith.langchain.com service. LangChain’s platform page separately advertises “SaaS with data residency in the US, Europe, and APAC,” followed by bring-your-own-cloud and self-hosted deployment options.

Do not infer the US or APAC endpoint hostnames from that marketing matrix. Only the EU value appears in the documentation. The region list shows what LangChain markets; it does not supply the complete configuration map needed for deployment.

LangSmith also supports OpenTelemetry in both directions, according to its observability page: teams can send LangSmith trace data to existing tools or ingest OpenTelemetry data into LangSmith. That weakens any simple claim that choosing LangChain necessarily confines telemetry to one vendor backend. What the page does not establish is whether every LangSmith feature remains equivalent when traces are exported, or which routing and retention settings apply in each arrangement.

What “data never leaves your environment” requires

A regional SaaS endpoint is only the first rung of the residency ladder. LangChain says Enterprise customers can have LangSmith delivered to their own Kubernetes cluster in AWS, GCP or Azure so that data never leaves their environment. That is a specific deployment option, not a description of ordinary hosted LangSmith.

There is also a separate self-hosted LangSmith installation. LangChain says it runs the platform in customer infrastructure so trace and operational data stay in that environment. The base installation includes observability, evaluation, prompt engineering, Insights and Chat.

For a residency review, the practical distinction is straightforward:

  • If an approved SaaS region satisfies the requirement, configure and verify the corresponding endpoint before production traffic starts.
  • If no SaaS region is acceptable, evaluate BYOC, Enterprise Kubernetes delivery or the self-hosted installation rather than assuming an environment variable can reproduce those deployment properties.
  • If the organization cannot operate or approve the required infrastructure, the residency requirement remains unresolved. Selecting a different agent API alone does not resolve it.

Self-hosting moves infrastructure and operational responsibility to the customer. LangChain’s pages do not quantify that workload or provide a tier-by-tier feature and cost comparison, so they support identifying the path, not declaring it the lowest-cost option.

LangChain’s data-use commitment addresses another axis. The company says, through the LangSmith Terms of Service as presented on its observability page, “We will not train on your data, and you own all rights to your data.” That is a vendor policy commitment worth including in contract review. It does not independently verify implementation, specify a storage region, or settle a legal compliance assessment.

Pydantic moves the decision to your OpenTelemetry backend

Pydantic’s documented model gives an existing observability deployment a central role. If instrumentation emits OpenTelemetry data to a backend the team already operates, that backend’s location, access controls and retention settings become the relevant review surface. Choosing Pydantic AI does not remove those questions; it relocates them.

The Pydantic AI overview documents a one-time setup command:

Terminal window
uvx logfire-cli wizard --task pydantic-ai

Pydantic presents this as enabling debugging, tracing and cost tracking, with pricing support backed by genai-prices. The command is evidence of a setup path, not evidence of an unconfigured default destination. Before relying on it, verify which backend the wizard selects in the intended environment and whether any subsequent exporter configuration changes that destination.

An existing OpenTelemetry backend can be attractive when its residency and operating controls have already been approved. It would be a mistake, however, to treat “OpenTelemetry” as synonymous with “self-hosted” or “local.” The destination could still be a hosted service, and Pydantic’s overview documents no Logfire region or self-hosting option with which to complete that assessment.

On the available documentation, Pydantic is the clearer fit for a team whose explicit requirement is to use its existing OpenTelemetry backend. That is a conditional architectural judgment, not proof that Pydantic has stronger privacy controls overall. LangSmith’s two-way OpenTelemetry support means LangChain also belongs in that evaluation.

A configured destination does not guarantee trace delivery

LangChain documents a separate operational failure mode in its LangChain tracing guide. In LangChain Python, tracing runs in a background thread to avoid obstructing the production agent. The process can therefore end before all traces are posted. LangChain says this is especially prevalent in serverless environments, where the virtual machine may terminate as soon as the chain or agent completes.

Two consequences follow. First, a region setting governs the destination of submitted traces, not their complete arrival. Second, missing traces are an observability reliability problem, not a dependable privacy mechanism. A team cannot use possible background-thread loss as evidence that sensitive data stayed out of LangSmith.

For short-lived or serverless workloads, trace completeness needs a deployment test that includes process termination and inspection of what reached the backend. LangChain documents the controls: setting LANGCHAIN_CALLBACKS_BACKGROUND to “false” makes callbacks synchronous, and “for both languages, LangChain exposes methods to wait for traces to be submitted before your process exits.” Synchronous callbacks remove the background threading LangChain uses to avoid obstructing the agent, so measure that overhead before making them the default. Pydantic’s overview says nothing about trace flush or shutdown behavior, so that side remains an open test.

What still needs verification?

Several questions are decisive enough to block a rollout when the corresponding capability is required:

  1. Activation and versions. Zero-code activation is documented. LangChain’s tracing guide says: “No extra code is needed to log a trace to LangSmith. Just run your LangChain code as you normally would.” Activation is environment configuration: LANGSMITH_TRACING, LANGSMITH_API_KEY, and LANGSMITH_ENDPOINT for accounts outside the default US region. The guide states no version requirements for this behavior. Recheck activation against the exact LangChain, LangGraph and SDK versions being deployed rather than assuming it survives an upgrade.
  2. Selective tracing. The mechanisms are documented. LangChain describes “two ways to do this in Python: by manually passing in a LangChainTracer instance as a callback, or by using the tracing_context context manager,” and in JS/TS “you can pass a LangChainTracer instance as a callback.” What the guide leaves open is exclusion semantics: whether a given mechanism keeps a specific run, workflow or payload out of LangSmith under your workload. Treat that as a verification gate, not a documentation footnote.
  3. The full endpoint map. Only the EU LANGSMITH_ENDPOINT value is documented in the guide. US, APAC and AWS host values remain open, despite the marketed SaaS region list.
  4. The Pydantic destination after setup. Verify the actual OpenTelemetry destination produced by the wizard and any later configuration. Logfire regions, self-hosting options and training-use terms are not addressed in Pydantic’s overview.
  5. Payload and shutdown behavior. Inspect traces from a bounded pre-production workload, including tool traffic and evaluation data where applicable, and test whether short-lived processes leave gaps. Neither vendor’s documentation provides a field-level payload schema, and the inventory matters for volume as much as content: LangChain notes that “a single conversation can generate megabytes of data across dozens of runs and tool calls.”
  6. Current documentation. Every source page is undated. Record the tested software versions and the documentation access date so that endpoint values, commands and tier claims can be rechecked when the deployment changes.

No source cited here can determine EU AI Act or GDPR obligations. Any compliance conclusion here would be editorial synthesis without the necessary legal and factual basis. The useful next step is to give legal and security reviewers the verified data flow, deployment tier, contract terms and payload inventory, rather than asking a framework comparison to deliver a compliance verdict.

Choose the backend against the requirement

I would decide the trace destination before treating either framework as approved. For a LangChain deployment, hosted LangSmith is a documented option when GCP us-central-1 or a verified regional service meets the organization’s requirements. EU accounts should configure the documented EU endpoint. If SaaS residency fails review, the decision moves to BYOC, Enterprise Kubernetes delivery or self-hosting, with the operational responsibility those options entail.

For a Pydantic AI deployment, the documented OpenTelemetry model supports routing instrumentation to a backend the team already runs, subject to verifying the real configuration and compatibility. That can fit an existing approved observability environment well, but it is not evidence of a compliant default or a self-hosted Logfire service.

If the choice depends on selective-tracing exclusion semantics, an unlisted regional endpoint or Logfire’s own hosting options, the cited documentation cannot settle it. Resolve those items before production. The defensible comparison is not which framework sounds more private, but which complete tracing path you can configure, inspect and operate under your actual residency requirement.

Frequently Asked Questions

How can teams ensure traces are submitted before a short-lived process exits?

LangChain documents the controls: setting LANGCHAIN_CALLBACKS_BACKGROUND to “false” makes callbacks synchronous, and “for both languages, LangChain exposes methods to wait for traces to be submitted before your process exits.” Synchronous callbacks remove the background threading LangChain uses to avoid obstructing the agent, so measure that overhead before making them the default.

References

Follow the links in the article for context. The supporting material is collected here for further reading.

  1. Pydantic AI overviewpydantic.devAccessed
  2. LangGraph tracing documentationdocs.langchain.comAccessed
  3. LangChain tracing guidedocs.langchain.comAccessed
  4. LangSmith observability pagelangchain.comAccessed
  5. LangChain platform pagelangchain.comAccessed
  6. Self-hosted LangSmith installationdocs.langchain.comAccessed

Join the discussion

Share a useful perspective or ask a question about this article.

Discussion guidelinesComments privacy