Skip to content

Import from LangSmith

Connect LangSmith on the Imports page. Metergraph imports LangSmith runs whose run_type is llm, the individual model calls, then keeps the selected project level with LangSmith on a schedule.

LangSmith runs whose run_type is llm are read through POST /runs/query. Chain, tool, retriever and prompt runs are not imported, and feedback is never read.

Credential A LangSmith API key beginning lsv2_
Scope A project name or project id, at most 255 characters (import_connections.py, MAX_SCOPE_LENGTH)
Host https://api.smith.langchain.com by default, the US host. Use https://eu.api.smith.langchain.com for the EU region, or a self-hosted endpoint (import_connections.py, SOURCE_POLICIES; imports.js, baseUrlHelp)

The hosted importer stores the credential encrypted and does not need a Metergraph ingest key. The relay appendix is the path that uses an ingest key (import_providers/__init__.py, module docstring).

  1. Open Imports, select Connect, and choose LangSmith.

  2. Enter the project name or id and the lsv2_ API key. The project scope is limited to 255 characters (import_connections.py, MAX_SCOPE_LENGTH).

  3. Import from defaults to 7 days ago and cannot be in the future. On hosted Metergraph it cannot be more than 90 days back; a self-hosted operator can set that floor from 1 to 366 days (imports.js, defaultInitialSince; config.py, scheduled_imports_max_backfill_days). Run defaults to Every minute. The picker offers Every minute, Every 5 minutes, Every 15 minutes, Every 30 minutes, Every hour, Every 6 hours and Daily. LangSmith has a 1-minute floor and a one-day ceiling (imports.js, INTERVAL_OPTIONS; import_connections.py, CURSOR_MINIMUM_INTERVAL_SECONDS, MAX_INTERVAL_SECONDS, DEFAULT_INTERVAL_SECONDS).

  4. Leave API base URL blank for the US host. Open Self-hosted LangSmith to enter https://eu.api.smith.langchain.com for the EU region or your own endpoint. The endpoint must be https:// and reachable from the public internet (imports.js, baseUrlHelp; import_egress.py, check_url).

  5. Optionally select Test connection. Metergraph resolves the project and queries one run from the last hour, or from the start date when that is more recent, within 6 seconds (langsmith.py, probe, TEST_TIMEOUT_SECONDS). Then select Connect. If the workspace already has a checkpoint for the source and project, the connection resumes from it rather than the start date (api/import_connections.py, create_import_connection).

  6. On Imports, inspect Imported through, Calls in selected range, Rows pushed per run, Success rate, Next run and Run history. Then open Traces and check the provider, model, tokens, status, route and timestamp.

Field Where it comes from
Route The LLM run’s own name, falling back to langsmith/backfill. The hosted import has no route override. --route is relay-only
Timestamp The run’s start_time
Model The run’s ls_model_name metadata, then its invocation parameters
Provider The run’s ls_provider metadata. Without it, unknown
Tokens LangSmith’s own rollup of the run’s usage, with its cache and reasoning breakdowns
Cost LangSmith’s computed total_cost
Latency Derived from the run’s start and end times
Status error when the run recorded an error, otherwise success
Content Read whether the run stored plain chat messages, LangChain message objects, or an OpenAI-shaped response
Trace, span and parent span The LangSmith trace id, run id and parent run id
  • Tool calls and tool names.
  • Environment. LangSmith rows arrive with no environment set, so they fall outside any environment filter in the dashboard.
  • Function attribution, streaming detail, outcomes and repository identity, as on every import path.
  • Chain, tool, retriever and prompt runs, and all feedback, which are never read.
Symptom Likely cause What to do
Test connection says “LangSmith refused the key” The key is invalid, revoked or sent to the wrong host Check the API key, project and base URL, then test again (langsmith.py, probe)
Test connection says “LangSmith has no project” The project name does not match the project available to the key Use the project id or exact project name (langsmith.py, probe)
Test connection says “Could not reach LangSmith at” The host is wrong or unreachable Check the base URL and public internet reachability (langsmith.py, probe; import_egress.py)
Every route is a model class name Relay only: LangChain names LLM runs after the model class Relay only: pass --route when you run metergraphrelay pull or sync
Provider shows as unknown The run carries no ls_provider metadata Set ls_provider and ls_model_name on the runs at the source
project not found Relay only: the name does not match a LangSmith project exactly Relay only: use the project id or exact name
invalid choice: 'langsmith' The installed relay predates LangSmith support Install metergraphrelay 0.6.0 or newer (metergraphrelay, v0.6.0 tag)
The endpoint is refused The hosted egress policy blocks a private, loopback, link-local or metadata address Use a public endpoint, or use the relay appendix (import_egress.py, module docstring)

Use the relay when the hosted importer cannot reach your LangSmith endpoint, or when you need relay-only name and tag selectors. Set METERGRAPH_APP_TOKEN as described in the relay setup.

metergraphrelay pull langsmith --project my-project --tag prod \
--since 2026-08-01T00:00:00Z --output langsmith.jsonl
metergraphrelay push langsmith.jsonl
Selector Meaning
--project Required project name or id. Repeatable
--name A run name. Repeatable, and any name matches
--tag A run tag. Repeatable, and all tags must be present
--since / --until Bound run start time. --since is inclusive and --until is exclusive
-n, --count Caps runs, not traces. The default is 100 (langsmith.py, PAGE_LIMIT)
--route Relay-only route override
metergraphrelay sync langsmith --source-scope my-project-prod \
--initial-since 2026-08-01T00:00:00Z --project my-project --tag prod

--source-scope must be a permanent label for the project and selector set. --initial-since seeds only the first run. The relay and hosted paths share a checkpoint for the same source and scope, so do not run both against one scope. The full contract is in the overview appendix.