Skip to main content

Context

In May 2026, we released SmithDB, a new observability database built for modern AI agents. SmithDB delivers industry-leading performance across every key observability workload, making core LangSmith experiences dramatically faster. New SDK methods are required to query your traces with SmithDB. This guide helps you migrate your codebase.

Why migrate

  • Queries run up to 12x faster on SmithDB. See the benchmarks.
  • On LangSmith Cloud, the new query endpoints have higher rate limits than the deprecated ones.
  • Dedicated methods for traces and threads replace filtering runs by hand.
  • The deprecated methods stop working on January 31, 2027 on LangSmith Cloud, and when ClickHouse is turned off on self-hosted, at the latest with v0.19. Migrating early avoids a last-minute rush.

Migrate with an AI agent

Copy the following prompt into your coding agent. It first sums up the change in plain words and waits for your go. Then it finds every SDK method and direct API call to the deprecated endpoints, waits for your approval, and migrates them locally. It pushes and opens a pull request only if you approve.

Migrate off deprecated LangSmith endpoints

Deprecation and removal

Each SDK method and its underlying endpoint share the same deprecation date. For details on how LangSmith deprecates and removes API endpoints and SDK methods, see API and SDK deprecation policy.

Minimum SDK version

The new SDK methods are available starting at these SDK versions: The LangSmith CLI queries the same SmithDB-backed endpoints and requires v0.2.44 or later.

About self-hosted

  • The new methods documented in this guide require self-hosted version 0.16 or later, independent of the data store used.
  • The deprecated methods stop working once ClickHouse is disabled.
  • Where possible, the SDK raises a warning or error identifying the version to upgrade to, instead of failing without explanation.

Methods by area

The before and after change for each method is documented on the page for its area.

Query runs

Search the runs in a project: filters, field projection, sorting, and pagination. The largest surface area in the migration.

Retrieve runs

Fetch one run by ID, load its child runs, and build the URL of a run in the LangSmith UI.

Traces

Query the traces in a project, read their token and cost aggregates, and list the runs that belong to one trace.

Threads

Query the threads in a project and list the traces (turns) that belong to one thread.

Dataset experiment runs

Query the runs recorded by an experiment on a dataset, including pagination and sorting by feedback score.

Feedback and sharing

Create feedback on a run, add runs to an annotation queue, and share, unshare, or read publicly shared runs.

Affected methods and endpoints

Every SDK method and API endpoint below is deprecated and stops working on the removal date above. Search your codebase for all of them. Endpoint paths are relative to /api/v1; the area pages have before/after examples for each one, except where noted.

SDK methods

Deprecated methods on Client and AsyncClient:The client.<resource> replacements (client.runs, client.threads, …) are async on Client; other Client methods such as create_feedback stay sync. Paginated methods such as client.runs.query() return an AsyncPaginator: use async for to iterate individual runs across all pages, or await it to fetch the first page. You do not need to await the paginator before using async for. Use await for non-paginated methods. In sync code, keep the same Client: put the migrated calls in one async def and run it once with asyncio.run() (see Python troubleshooting). They return only the fields listed in selects, so include "ID".

Endpoints

The annotation queue run endpoints move to the queue items API under /api/v1/platform/annotation-queues. For adding runs to a queue, see Annotation queues: add runs. For listing and counting queue items, see Annotation queues: read runs. For the other endpoints, see the API reference for request and response shapes.

Exceptions

The SmithDB-backed methods raise new exception classes instead of the legacy langsmith.utils exception classes.Only the new methods (client.runs.* and the other replacements in this guide) raise these classes. Methods called directly on Client or AsyncClient, such as read_project(), still raise the langsmith.utils ones. See Python troubleshooting to catch both.

Discontinued

The following methods are discontinued. They call the retired /feedback/formulas endpoints, which return 410 Gone on composite-feedback v2 and are scheduled for removal on 2026-08-20. Composite scores are now managed as composite evaluators, which implement a composite score as a code evaluator plus a run rule. There is no SDK replacement.

Feedback formula methods

Python troubleshooting

Evaluate existing experiments

When you pass an existing experiment to evaluate() or aevaluate(), the Python SDK loads its runs internally. On deployments with both ClickHouse and SmithDB query support enabled, it uses list_runs() for this step. The SDK suppresses the deprecation warning for these internal calls, but they can appear as POST /runs/query in your workspace’s deprecation report. Upgrading the SDK alone does not eliminate these calls while both query backends remain enabled. On SmithDB-only deployments, the SDK loads the experiment through the SmithDB-backed API instead. Keep the SDK up to date. You do not need to replace evaluate() or aevaluate() calls as part of this migration. Migrate any direct list_runs() calls in your own code separately.

Calling the new methods from sync code

Keep the same Client and pick the pattern that matches where the code runs:
  • Sync script: put the migrated calls in one async def and run it once with asyncio.run().
  • Notebooks, async functions, FastAPI async def handlers, async LangGraph nodes, …: use async for for all pages of paginated results, or await for the first page or non-paginated calls.
  • asyncio.run() where an event loop is already running raises RuntimeError: asyncio.run() cannot be called from a running event loop. Use async for or await directly instead.
  • asyncio.run() from several threads that share a Client (thread pools, FastAPI def handlers, sync LangGraph nodes under load, …) can fail with Event loop is closed. That call path needs a decision: make it async, or batch the calls with asyncio.gather() inside one asyncio.run().

Catching errors from old and new methods

The two exception families share no base class other than Exception. Code that wraps both kinds of call catches both:

Mocking the new methods in tests

From langsmith 0.12.0, the new methods send requests with httpx2, not httpx, so respx, pytest-httpx and httpx.MockTransport do not intercept them. Patch the method on client.runs (or the other resource) with an AsyncMock instead: