Data retention
LangSmith provides automatic data retention capabilities to help with compliance and storage management. Data retention policies can be configured at two levels:- Workspace level: Enterprise customers with the required permissions can set extended retention as the workspace default and customize the retention duration. See Customize extended retention policy.
- Environment level: Customers with the required permissions can set the default retention tier for each agent environment, choosing between base or extended retention. See Change default retention for an environment. On self-hosted, administrators can turn on per-project retention so a project can use its own extended period. See Project-level extended retention for self-hosted.
Customize extended retention policy
This feature is available for Enterprise plan customers. For self-hosted Enterprise customers, refer to the workspace-level configuration section.
Changes to the retention period apply to new traces only. Existing traces are not affected.
Configure extended retention
Organization Admins and Operators (organization:manage) can configure retention for any workspace. Workspace Admins can configure their own workspace (workspaces:manage). For a full permissions reference, see Organization and workspace operations.
- UI
- API
In the LangSmith UI:
- Navigate to Settings at the bottom of the page.
- Select Usage configuration from the left-hand menu.
- Find the workspace in the list that you would like to configure.
- Click on the value under the Data retention policy column for that workspace.
- On the workspace usage configurations modal, customize the extended policy using the dropdown for Extended - All traces are retained for option. The dropdown lists the durations available for your hosting option.
- Select Save.
Workspace-level extended retention for self-hosted
Self-hosted Enterprise customers can also use workspace-level extended retention configuration instead of system-wide TTL settings. This provides more granular control over data retention for different workspaces without requiring environment variable changes. To configure this for self-hosted deployments, refer to the self-hosted TTL documentation for the legacy system-wide approach or contact support. On self-hosted, your administrator chooses the periods users can pick. See Choose the extended retention periods users can pick.Project-level extended retention for self-hosted
Per-environment extended retention requires LangSmith v0.18.0 or later and is disabled by default. To enable it, see Requirements.
longlived_ttl_days with PATCH /api/v1/sessions/<tracer-session-id>, using the environment’s tracer_session_id, or set it to null to follow the workspace again.
Lengthening an environment’s period requires the projects:increase-trace-tier permission. Shortening it requires projects:decrease-trace-tier. Resetting an environment to the workspace default can require either, depending on whether the workspace period is longer or shorter. See RBAC permissions.
A new period applies only to traces ingested after the change. Existing traces keep the period they were written with.
In a Base project, traces upgraded to extended retention, for example after feedback, use the workspace period. The UI does not set a period on Base projects, but the API can. A Base project with its own longlived_ttl_days applies that period to its upgraded traces instead.
If an administrator turns per-project retention off after projects have saved their own periods, those projects use the workspace period again.
Disable extended trace retention
The workspace retention restriction blocks extended retention for new traces and new upgrade requests. Use it to keep new traces at base retention without disabling feedback or evaluations. The switch is off by default.This feature is available for Enterprise plan customers. For self-hosted deployments, this feature is available in the LangSmith 0.18.29rc1 release candidate, packaged with Helm chart version 0.18.0-rc.78. Older data planes might not show the switch.
organization:retention:manage, granted to Organization Admins and Operators. A Workspace Admin role alone does not grant this permission.
To disable extended retention for a workspace:
- In the LangSmith UI, go to Settings > Usage configuration.
- Select the workspace’s Data retention policy.
- Turn on Disable Extended Trace Retention.
- Select Save.
- New traces: Use base retention, even if the environment’s saved default is extended.
- Retention upgrades: New requests do not extend traces, including existing base-retention traces. Feedback, evaluations, and other automation actions continue without extending retention.
- Environment defaults: You cannot set new environment defaults to extended or change base defaults to extended. Existing extended defaults remain saved but do not apply to new traces.
- Existing extended traces: Keep their expiration dates. The restriction does not shorten their retention or delete them.
- Saved preferences: Environment defaults and retention preferences for rules and evaluators stay unchanged. Turning the switch off again allows those settings to apply.
Trace deletes
You can use the API to complete trace deletes. The API supports two methods for deleting traces:- By trace IDs and session ID: Delete specific traces by providing a list of trace IDs and their corresponding session ID (up to 1000 traces per request)
- By metadata: Delete traces across a workspace that match any of the specified metadata key-value pairs
Deletion timeline
Trace deletions are processed during non-peak usage times and are not instant. SmithDB may make traces unqueryable right away. Most deletes are hardened within 6 hours or sooner. To confirm deletion, query the data again to verify it has been removed.Delete specific traces
To delete specific traces by their trace IDs from a single session:The
session_id is the tracer_session_id of the agent environment that holds the trace you are trying to delete. Select your agent, go to Tracing, and select the environment. Click the ID badge next to the environment name and copy the Tracing Project ID.Example deletes
You can delete dataset examples self-serve via our API, which supports both soft and hard deletion methods depending on your data retention needs.Deleting examples is a two-step process
For bulk operations, example deletion follows a two-step process:1. Search for examples by metadata
Find all examples with matching metadata across all datasets in a workspace. GET /examplesas_ofmust be explicitly specified as a timestamp. Only examples created before theas_ofdate will be returned
user_id: "user123" or environment: "staging" in their metadata across all datasets in your workspace.
2. Hard delete examples
Once you have the example IDs, send a delete request. This will zero-out the inputs, outputs, and metadata from all versions of the dataset for that example. POST /v1/platform/datasets/examples/delete/- Specify
example_ids(list of example IDs) andhard_delete(boolean) in the request body
Deletion types
Soft delete (default)
- Creates tombstoned entries with NULL inputs/outputs in the dataset
- Preserves historical data and maintains dataset versioning
- Only affects the current version of the dataset
Hard delete
- Permanently removes inputs, outputs, and metadata from ALL dataset versions
- Complete data removal when compliance requires zero-out across all versions
- Set
"hard_delete": truein the request body
Connect these docs to your agent of choice via MCP for real-time answers.

