Skip to main content
Use the LangSmith SDK to manage feedback configurations and annotation queue rubrics programmatically, and to add runs and threads to a queue for review. Define reusable feedback schemas at the workspace level (like accuracy scores or pass/fail judgments), then assign them to specific queues with custom instructions. This enables version control, automation across agents, and consistency—particularly useful for CI/CD pipelines or replicating evaluation setups across environments.
This guide uses the Python and TypeScript SDKs. For installation and setup, refer to the Python SDK documentation and TypeScript SDK documentation.
To review the free-form acceptance criteria that LangSmith Engine proposes for a recurring issue, refer to Use assertions.

Feedback layers

LangSmith uses a three-layer architecture for structured human feedback:
  1. Feedback configs: Workspace-wide definitions of feedback keys that establish the schema for evaluation metrics. For example, you might define “accuracy” as a continuous 0–1 score or “correctness” as a pass/fail categorical choice. These configs are reusable across all annotation queues in your workspace.
  2. Annotation queue rubric items: Queue-specific assignments that determine which feedback configs annotators must fill out when reviewing runs in a particular queue. Each rubric item can include custom descriptions, guidance for specific score values, whether the feedback is required or optional, and conditions that show or require the item based on earlier answers.
  3. Feedback: Individual scores and values that annotators submit on specific runs. This is the actual evaluation data collected using the schemas you’ve defined. Learn more about feedback in LangSmith.

Feedback configs

Create a feedback config

Feedback configs define the schema for a feedback key—whether it’s a continuous score, a categorical choice, or freeform text. A unique key identifies each config within your workspace and specifies how annotators can submit feedback for that metric.
Calling create_feedback_config with an identical config that already exists returns the existing config. If a different config already exists for the same key, the system raises a 400 error.
  • Continuous ("accuracy"): Defines a numeric scale from 0 to 1. The is_lower_score_better parameter indicates whether lower values represent better performance. Use continuous configs for rating scales or percentage-based metrics.
  • Categorical ("correctness"): Provides predefined options with associated values. Each category requires a value (used for scoring and analytics) and a label (shown to annotators). Use categorical configs for binary choices or multi-class classifications.
  • Freeform ("notes"): Allows open-ended text input with no predefined structure. Use freeform configs for qualitative observations or explanations.

List feedback configs

Retrieve feedback configs to see what evaluation criteria are available in your workspace with list_feedback_configs. You can list all configs or filter by specific keys. Each returned config object includes the key, type, configuration details (like min/max or categories), and metadata like is_lower_score_better:

Update a feedback config

Modify an existing feedback config with update_feedback_config by updating specific fields. The method only changes the fields you provide—the rest remain unchanged. This is a partial update that preserves other configuration settings:
Passing feedback_config replaces the whole config, including its category list. To keep a multi-select config multi-select, include allows_multiple_categories in the new config.

Add or remove categories

To change a large category list without resending it, add or remove individual categories with add_feedback_categories and remove_feedback_categories. Both methods keep the config’s other categories and its allows_multiple_categories setting:
These methods require langsmith>=0.15.0 (Python) or langsmith>=0.12.0 (TypeScript). Self-hosted LangSmith requires v0.18 or later. Earlier versions ignore the change and return the config unchanged.
Removing a category does not change feedback already written with that value. A categorical config must keep at least two categories, so a removal that leaves fewer than two fails with a 422 error.

Delete a feedback config

Remove a feedback config from your workspace with delete_feedback_config. This performs a soft delete, which marks the config as deleted but doesn’t permanently remove it from the system. You can recreate a config with the same key later if needed:

Annotation queue rubric items

Rubric items assign feedback configs to a specific annotation queue. They control which feedback forms annotators see when reviewing runs in that queue, and whether each form is required or optional.

Create a queue with rubric items

Create an annotation queue with create_annotation_queue and assign feedback configs to it through rubric items. Each rubric item references a feedback config by its key and customizes how it appears to annotators in this specific queue. The example creates a queue with three rubric items. The queue-level rubric_instructions provides general guidance shown at the top of the annotation interface:
  • feedback_key: The key of an existing feedback config (create this first).
  • description: Queue-specific guidance for annotators about this metric.
  • score_descriptions / value_descriptions: Optional labels that explain what specific values mean (use score_descriptions for continuous configs, value_descriptions for categorical).
  • is_required: Whether annotators must complete this feedback before submitting.

Update rubric items on an existing queue

Modify the rubric items assigned to an annotation queue with update_annotation_queue. This operation replaces the entire rubric items list, so you must include all items you want to keep—the operation removes any items you don’t include. You’ll need the queue ID, which you get when you create the queue or by listing queues:
Updating rubric items replaces the full list. Include all items you want to keep.
When an update omits an item’s required_if or visible_if, the item keeps its current conditions. To clear conditions, pass None (Python) or null (TypeScript).

Add conditions to rubric items

Conditions make a rubric item depend on answers to earlier items, so reviewers see follow-up questions only when they apply. Each rubric item accepts two optional condition fields:
  • required_if: The item is always shown, and is required only while the conditions hold.
  • visible_if: The item is hidden until the conditions hold. Once shown, it follows is_required.
Rubric item conditions require langsmith>=0.15.0 (Python) or langsmith>=0.12.0 (TypeScript).
Each condition object has a join of "all" or "any" and a list of rules. Each rule names the key of an earlier item in the same rubric, an op, and the category values to match:
  • is: The earlier item’s answer is the one value given.
  • is_one_of: The earlier item’s answer is any of the values given.
  • is_empty: The earlier item has no answer. Takes no values.
  • is_not_empty: The earlier item has an answer. Takes no values.
Rule values are category values, not labels. For a multi-select item, is and is_one_of hold if any selected category matches. The following example asks for a failure reason only when the reviewer marks the response as failing:
A rule can reference only an item that appears earlier in the rubric. A rule that references a later item, or the item itself, fails with a 422 error. LangSmith stores conditions and the review view applies them. The API does not enforce them when feedback is written directly.

Copy a rubric to another queue

read_annotation_queue returns a queue’s rubric items in order, each with the feedback config it uses. To copy the rubric, pass those items as-is to another queue’s rubric_items:
Reading rubric items with their feedback configs requires langsmith>=0.15.0 (Python) or langsmith>=0.12.0 (TypeScript).
Because updates replace the full rubric item list, the update replaces the target queue’s rubric. To keep the target’s existing items, combine both lists before you update.

Add runs and threads to a queue

Add runs and threads to a single-run annotation queue with the annotation queue items resource. A single request accepts a mixed batch of run items and thread items, so this method covers everything the UI add flow supports.
The items resource requires langsmith>=0.10.13 (Python) or langsmith>=0.8.8 (TypeScript), served by a LangSmith backend on version 0.16.14 or later.
Each item sets an item_type of RUN or THREAD:
  • RUN items require run_id. Also provide project_id and start_time, which together locate the run directly.
  • THREAD items require thread_id and project_id.
Resolve these IDs with the SDK:
  • project_id: The agent environment’s tracer_session_id. Resolve the agent environment with client.sessions.resolve() and use the returned session_id.
  • run_id: Query runs with client.runs.query(). Each run exposes id, project_id, and start_time, the fields a RUN item needs.
  • thread_id: Query threads with client.threads.query(). Each result exposes its thread_id.
Resolving an agent environment needs recent SDK and LangSmith versions, and is not available on BYOC data planes. For the requirements and a BYOC alternative, see Resolve an agent environment.
You can also find these IDs in the LangSmith UI:
  • project_id: The agent environment’s tracer_session_id. 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. To learn why these APIs take a project ID, see Resolve an agent environment.
  • run_id: Open a run in the Details view and click the ID badge next to the run name to copy the run ID.
  • thread_id: Select your agent, go to Tracing, select the environment, and open the Threads tab. Copy the value from the Thread ID column.
To extend trace retention for the added run items, pass extend_trace_retention=True. If the workspace disables extended trace retention, the items are added without extending retention. The response is an envelope with an items array, one entry per added item.
In Python, annotation_queues.items.create is async, so await it inside an event loop.
For runs-only additions, add_runs_to_annotation_queue still works and remains the simplest option when you are not adding threads. New code that adds threads, or mixed run and thread batches, should use the items resource.

Feedback config types (detailed)

Continuous

Continuous configs define numeric rating scales with minimum and maximum values. Annotators can select any value within the range, making this ideal for scoring dimensions like accuracy, quality, or relevance on a numeric scale:
The first example shows a 0–1 scale without labels. The second example demonstrates adding categories with labeled anchor points on the scale (like “Poor”, “Average”, “Excellent”) to help annotators understand what different values represent. These labels are optional but can improve consistency in how annotators interpret the scale.

Categorical

Categorical configs provide a discrete set of predefined options for annotators to choose from. Each category must have a value (a numeric identifier used for scoring and analytics) and a label (the text shown to annotators). You must define at least 2 categories. Use categorical configs for binary decisions (pass/fail, correct/incorrect), multi-class classifications (sentiment, topic categories), or any evaluation with a fixed set of discrete options. Do not set min or max for categorical configs:
The first example shows a binary pass/fail config. The second example demonstrates a multi-class config for sentiment with three options. The numeric values allow you to compute aggregate scores even for categorical feedback.

Allow multiple selections

Set allows_multiple_categories to let a reviewer pick more than one category for a single item. Use it for multi-label taxonomies, such as tagging every topic a conversation covers. The flag defaults to false and applies to categorical configs only:
allows_multiple_categories requires langsmith>=0.15.0 (Python) or langsmith>=0.12.0 (TypeScript).
When a reviewer picks several categories in the review pane, LangSmith saves each pick as its own feedback entry under the config’s key, with the category label as the value and the category value as the score. Clearing a pick deletes its entry. To write a multi-select answer with the SDK, create one feedback entry per category. A composite evaluator cannot include a multi-select key, because a run can have several scores under that key.

Freeform

Freeform configs allow annotators to provide open-ended text feedback without any predefined structure or constraints. This type has no min, max, or categories fields—annotators can enter any text they want. Freeform feedback is valuable for capturing nuanced insights but is harder to aggregate and analyze compared to structured feedback types:

Validation rules

Reference

Feedback config types

Rubric item fields

Feedback config fields