DEV Community

Aviad Rozenhek
Aviad Rozenhek

Posted on

Keep Every LangSmith Trace Without the 10 Retention Bill

LangSmith is excellent for debugging live AI systems. But keeping every trace in its extended-retention tier can turn observability into a surprisingly large line item.

Today we merged a new archive workflow into langsmith-cli that changes that tradeoff: keep LangSmith for live debugging, continuously archive verified traces to organization-owned private S3, and query the retained Parquet directly with DuckDB.

In other words, you can preserve your complete trace history without placing every trace on LangSmith's extended-retention tier.

The cost-overrun risk

LangSmith currently documents two trace-retention tiers:

Tier Retention Published trace price
Base 14 days 0.05¢
Extended 400 days 0.50¢ total

The 0.45¢ extended-retention upgrade makes an extended trace cost 10× as much as a base trace.

That difference becomes material at production volume:

Monthly traces Base, 14 days Extended, 400 days Added retention cost
100,000 $50 $500 $450
1,000,000 $500 $5,000 $4,500
10,000,000 $5,000 $50,000 $45,000

These examples use the published per-trace rates before free allowances, plan terms, negotiated pricing, or taxes. Always check the official LangSmith usage and billing documentation before making budget decisions.

There is another subtle risk: online evaluators and automation rules can upgrade matching traces when retention extension is enabled. A rule that matches one run upgrades the whole trace, and a thread-level rule can upgrade every trace in that thread. LangSmith currently enables retention extension by default for new online evaluators and automation rules, although you can opt out.

At scale, an innocent-looking evaluator or rule can therefore create a much larger bill than expected.

The new langsmith-cli archive workflow

The new workflow separates live observability from long-term retention:

LangSmith live traces (14 days)
        │
        ├── D+2 primary export ───────┐
        └── D+12 reconciliation ──────┤ deduplicate by run ID
                                      ▼
                            private S3 / Parquet
                                      │
                                      ▼
                         runs ... --archive (DuckDB)
Enter fullscreen mode Exit fullscreen mode

The D+2 export captures traces after normal late-arriving data has settled. The D+12 reconciliation pass catches delayed updates before the 14-day base-retention window closes. Both passes deduplicate by run ID, so retries are safe and the archive converges on the latest exported data.

The result is long-term trace history in storage your organization owns and controls.

Route projects to private S3

Projects can be routed to separate buckets or prefixes—for example, to isolate development and production data:

# archive.yaml
routes:
  - name: dev
    project_pattern: "dev/**"
    archive_uri: s3://my-langsmith-traces-dev/langsmith
  - name: production
    project_pattern: "prd/**"
    archive_uri: s3://my-langsmith-traces-prd/langsmith
Enter fullscreen mode Exit fullscreen mode

Point the CLI at that configuration and schedule the sync using cron, a Kubernetes CronJob, or your existing scheduler:

export LANGSMITH_ARCHIVE_CONFIG=/etc/langsmith-cli/archive.yaml

langsmith-cli --json archive sync \
  --all-routes \
  --retention-days 14
Enter fullscreen mode Exit fullscreen mode

The organization supplies the scheduler, LangSmith API key used during export, AWS workload identity, private buckets, encryption, lifecycle policies, and reader IAM. The CLI owns the archive and query mechanism—not your infrastructure.

Query historical traces without the LangSmith API

Archived traces remain searchable through familiar commands. Reads use DuckDB over Parquet in S3 and do not require a LangSmith API key:

# List production runs from the last 90 days
langsmith-cli --json runs list \
  --archive \
  --project prd/my-agent \
  --last 90d

# Search historical runs
langsmith-cli --json runs search "timeout" \
  --archive \
  --project prd/my-agent

# Inspect a run and its children
langsmith-cli --json runs get <run-id> \
  --archive \
  --follow-children
Enter fullscreen mode Exit fullscreen mode

That means incident investigations, regression analysis, audits, and offline analytics can continue long after a base-tier trace has disappeared from the live LangSmith API.

A better default for high-volume tracing

For many teams, the most economical model is now straightforward:

  1. Keep base retention for day-to-day debugging.
  2. Disable automatic retention extension where it is not intentionally needed.
  3. Export every trace to private S3 before the 14-day window closes.
  4. Use --archive for older investigations and analysis.

You keep LangSmith's excellent live debugging experience, retain your full historical dataset under your own controls, and make long-term storage costs predictable.

The merged change and implementation notes are in langsmith-cli PR #163.

If you operate LangSmith at meaningful volume, this is worth setting up before your next evaluator or automation rule quietly multiplies the retention bill.

Top comments (0)