- Send all traces with negative feedback to an annotation queue for human review.
- Send 10% of all traces or threads to an annotation queue for human review to spot check for issues.
- Post all traces with a low evaluator score to your webhook endpoint.
- Upgrade all traces with errors for extended data retention.
To configure online evaluations, visit the online evaluations page.
An automation rule can upgrade matching traces to extended data retention when retention extension is enabled for that rule. This ensures that traces meeting your automation criteria (typically those most valuable for analysis) are preserved for investigation. The workspace retention restriction overrides these settings without changing saved rule preferences. Each action type has its own default, refer to the action-level retention settings for details. For the full retention model, see data retention auto-upgrades.
How automation rules execute
Each automation rule runs on an independent polling schedule. If you have multiple rules on the same project, a webhook rule may process a run before an evaluator rule has scored it, or vice versa. Within a single rule, if multiple actions are configured, they execute in this order:- Add to annotation queue.
- Add to dataset.
- Trigger webhook.
- Run online evaluator.
- Run custom code evaluator.
- Extend data retention.
- Trigger alert.
Set the item type to runs or threads
The Item Type control determines what a rule matches. Set it to Runs and the rule evaluates each matching run as it arrives. Set it to Threads and the rule waits until a conversation is complete, then applies its action once to the whole thread. Choose Threads when the unit you want to review or export is the full conversation rather than a single turn. In the search bar filtering experience, the Threads, Traces, and Runs tabs under Trigger On replace the Item Type control. Threads works as described in this section. Traces and Runs both create run rules: Traces matches root runs only, and Runs matches any run, including child runs. Thread rules require an agent environment that groups traces into threads. For more information, refer to Configure threads.Configure a thread rule
Selecting Threads changes three parts of the rule form:- Thread Filters: The filter builder adds Trace Count and Thread ID to the available fields. Filter on Trace Count to scope a rule to conversations of a given length. The other fields evaluate each trace in the thread rather than the thread as a whole, so a thread matches when any of its traces match. For example, a filter on Status selects every thread that contains an errored trace, not only threads whose last trace errored. In the search bar experience, filter on attributes of the whole thread, such as
turn_count, in the Thread scope, and on the runs a thread contains in the Root run or Any run scope. For the fields each scope supports, refer to Fields. - Action: The form offers Add to Annotation Queue, Add to Dataset, or Trigger Webhooks.
- Add to Annotation Queue: Adds the thread to the queue as a thread item. Thread items display the conversation transcript and support rubric feedback only. For what differs between run items and thread items, refer to the annotation queue capability table.
- Add to Dataset: Creates one dataset example for each matching thread. Each example contains the thread’s full conversation.
- Trigger Webhooks: Sends a payload whose top-level
threadsarray holds every matching thread. For more information, refer to Read a thread rule payload.
Set the thread idle time
A thread rule acts only after the thread goes idle. Once the last trace in a thread is ingested, LangSmith waits for the idle time configured on the agent environment to elapse, which signals that the conversation is complete. The idle time defaults to 10 minutes and cannot be set below 2 minutes. Each agent environment has one idle time, shared by all of its thread rules and multi-turn online evaluators. Changing the value affects all of them. The first thread rule on an environment applies the default only if no value is set yet. To change the idle time, click the Edit tracing settings icon next to the value in the rule form or on the environment’s Tracing page. These limits bound what a thread rule processes:- Runs must be less than one week old: When a thread becomes idle, only runs from the past 7 days are eligible.
- Maximum of 500 threads per execution: A single execution processes at most 500 matching threads, ordered by most recent activity.
Extend data retention for a thread
Data retention is a property of a trace, not of a thread. When a thread rule has Extend Data Retention enabled, it upgrades every trace in the matched thread, not only the most recent one. These upgrades require the workspace to allow extended retention. Because each trace is upgraded individually, a longer conversation costs more to retain. In exchange, the entire conversation is preserved for investigation instead of expiring turn by turn.Filter with the search bar
LangSmith has two filtering experiences, and the one you see can differ between pages. Check the filter controls on the page you are using to see which one applies:
- A search bar where you type a query, usually with a scope selector to its left: Refer to Filter traces.
- An Add filter button that builds filter chips: Refer to Filter traces (ClickHouse).
- Saved filters: Applies a saved filter from the agent environment. Selecting one replaces the rule’s filter and switches to the tab that matches the saved filter’s scopes.
- Clear: Removes the rule’s filter.
View automation rules
In the UI, select your agent, go to Tracing, and select the environment. To view existing automation rules for that environment, click the Automations tab.Create a rule
- In the UI, select your agent, go to Tracing, and select the environment. Click + New in the top right corner of the environment page, then click New Automation.
- Name your rule.
- Select an Item Type, either Runs or Threads. In the search bar experience, select the Threads, Traces, or Runs tab under Trigger On instead. The item type determines which filter fields and actions are available, so set it before configuring either. For more information, refer to Set the item type to runs or threads.
- Create a filter. In the search bar experience, write a query in the search bar, as described in Filter with the search bar. Otherwise, use the filter builder, with the same fields and operators described in Filter traces (ClickHouse).
-
Configure a Sampling Rate to control what percentage of the filtered items trigger the automation action. The form accepts a percentage from 0 to 100. For example, a sampling rate of 50% sends half of the items that pass the filter to the action. The equivalent API field,
sampling_rate, takes a decimal from 0 to 1. -
(Optional) Apply rule to past runs by toggling the Apply to Past Runs and entering a Backfill From date. For a thread rule, the toggle reads Apply to Past Threads. In the search bar experience, the toggle reads Apply to Past Threads, Apply to Past Traces, or Apply to Past Runs, matching the selected tab. This is only possible upon rule creation. Apply to Past Threads is available only on deployments that query traces from SmithDB. You cannot switch an existing run rule that has a backfill to Threads.
The backfill runs as a background job, so results do not appear immediately. To track its progress, view the logs for your automations.
-
Select the action the rule performs. Rules with the Runs item type support every action below. Rules with the Threads item type support only Add to Annotation Queue, Add to Dataset, and Trigger Webhooks.
- Add to Annotation Queue: Add the matching run or trace to an annotation queue as a run item. A thread rule adds the entire conversation as a thread item instead. To add a thread by hand, refer to Assign runs and threads.
- Add to Dataset: A run rule adds the trace’s inputs and outputs to a dataset. A thread rule creates one example for each matching thread. Each example contains the thread’s full conversation.
- Trigger Webhooks: Post the matched items to every webhook URL configured on the rule.
- Extend Data Retention: Extends the data retention period on matching traces that use base retention (refer to the data retention docs for more details).
Configure retention for rule actions
Each action has an independent Extend Data Retention toggle that controls whether matching traces are upgraded to extended retention. The toggles are admin-only controls, gated by therules:configure-retention permission. Workspace members without it see the toggles as disabled, but can still create and edit rules without affecting retention settings.
The defaults are the same for both item types:
- Add to Dataset: Off by default. Enable the toggle to upgrade matching traces.
- Add to Annotation Queue: On by default. Disable the toggle to skip upgrading matching traces.
- Trigger Webhooks: Off by default. Enable the toggle to upgrade matching traces.
- Extend Data Retention: Always upgrades matching traces.
- Online/code evaluators: Upgrade scored traces when their retention setting is enabled.
View logs for your automations
Logs show whether your rules are working as expected. To view them, open the agent environment’s Automations tab on the Tracing page and click Logs in your rule’s row. The logs tab allows you to:- View all runs processed by a given rule for the time period selected.
- If a particular rule execution has triggered an error, you can view the error message by hovering over the error icon.
- You can monitor the progress of a backfill job by filtering to the rule’s creation timestamp. This is because the backfill starts from when the rule was created.
- Inspect the run that the automation rule applied to using the View run button. For rules that add runs as examples to datasets, you can view the example produced.
Connect these docs to your agent of choice via MCP for real-time answers.

