---
title: "Create Decision Model Rule"
method: POST
path: "/api/v1/runs/rules/decision-models"
tags: ["run"]
---

# Create Decision Model Rule

`POST /api/v1/runs/rules/decision-models`

## Request

- Base URL: `https://api.smith.langchain.com`
- URL: `https://api.smith.langchain.com/api/v1/runs/rules/decision-models`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in header `X-Tenant-Id`
  - HTTP bearer

Create a decision-model evaluator (Jev, SemIf or OpenAI Decisions) from
its prompt and questions, and attach it to a project or dataset. Each
question's key becomes a feedback key.

## Request body

- DecisionModelRuleCreateSchema: A decision-model evaluator to create and attach to a project or dataset.
  - `display_name` string, required
  - `session_id` string, uuid, nullable: The tracing project to evaluate.
  - `dataset_id` string, uuid, nullable: The dataset whose experiments to evaluate.
  - `prompt` array[], required: The prompt the model reads, as (role, template) pairs.
    - unknown[]
      - unknown
  - `template_format` 'mustache' | 'f-string'
  - `variable_mapping` object, nullable: Maps the prompt's variables to run fields.
  - `questions` object, required: The questions, keyed by feedback key, in the order to ask them.
  - `provider` 'typesafe' | 'typesafe_compatible' | 'openai_decisions': typesafe for Jev and SemIf, typesafe_compatible for a TypeSafe-compatible endpoint, or openai_decisions.
  - `model` string, nullable: Defaults to jev-latest for typesafe and gpt-6-luna for openai_decisions. Use semif-qwen3.5-4b for SemIf.
  - `base_url` string, nullable: Call this endpoint directly instead of through the LangSmith gateway, with the workspace's TYPESAFE_API_KEY or OPENAI_API_KEY secret. Required for typesafe_compatible.
  - `model_headers` object, nullable: Headers sent with each model call. They are saved in the evaluator's prompt as given, so do not put API keys here.
  - `timeout_seconds` integer, nullable: Seconds to wait for each model call. openai_decisions only.
  - `max_retries` integer, nullable: How many times to retry a failed model call. openai_decisions only.
  - `playground_settings_id` string, uuid, nullable: A saved model configuration to start from: its model, endpoint, key and settings apply unless set here.
  - `sampling_rate` number: The fraction of runs to evaluate.
  - `filter` string, nullable: Only evaluate runs that match this filter.

## Response `200`

Successful Response

- RunRulesSchema: Run rules schema.
  - `id` string, uuid, required
  - `tenant_id` string, uuid, required
  - `is_enabled` boolean
  - `session_id` string, uuid, nullable
  - `session_name` string, nullable
  - `dataset_id` string, uuid, nullable
  - `dataset_name` string, nullable
  - `display_name` string, required
  - `sampling_rate` number, required
  - `filter` string, nullable
  - `trace_filter` string, nullable
  - `tree_filter` string, nullable
  - `add_to_annotation_queue_id` string, uuid, nullable
  - `add_to_annotation_queue_name` string, nullable
  - `add_to_dataset_id` string, uuid, nullable
  - `add_to_dataset_name` string, nullable
  - `add_to_dataset_prefer_correction` boolean
  - `corrections_dataset_id` string, uuid, nullable
  - `use_corrections_dataset` boolean
  - `num_few_shot_examples` integer, nullable
  - `evaluators` EvaluatorTopLevel[], nullable
    - `structured` EvaluatorStructuredOutput, required: Evaluator structured output schema.
      - `hub_ref` string, nullable
      - `prompt` array[], nullable
        - unknown[]
          - unknown
      - `template_format` string, nullable
      - `schema` object, nullable
      - `variable_mapping` object, nullable
      - `model` object, nullable
      - `playground_settings_id` string, nullable
  - `code_evaluators` CodeEvaluatorTopLevel[], nullable
    - `code` string, required
    - `language` 'python' | 'javascript'
    - `require_attachments` boolean
    - `code_evaluator_input` 'thread' | 'all_messages' | 'human_ai_pairs' | 'first_human_last_ai' | 'trajectory': Input provided to a code evaluator.
    - `advanced_features_enabled` boolean
  - `alerts` RunRulesPagerdutyAlertSchema[], nullable
    - `type` 'pagerduty': Enum for alert types.
    - `routing_key` string, required
    - `summary` string, nullable
    - `severity` 'critical' | 'warning' | 'error' | 'info': Enum for severity.
  - `webhooks` RunRulesWebhookSchema[], nullable, required
    - `url` string, required
    - `headers` object, nullable
  - `extend_only` boolean
  - `is_managed_evaluator` boolean
  - `is_tracing_disabled` boolean
  - `extend_evaluator_trace_retention` boolean, nullable
  - `extend_dataset_trace_retention` boolean, nullable
  - `extend_annotation_queue_trace_retention` boolean, nullable
  - `extend_webhook_trace_retention` boolean, nullable
  - `include_extended_stats` boolean
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `backfill_from` string, date-time, nullable
  - `backfill_id` string, uuid, nullable
  - `backfill_status` string, nullable
  - `backfill_progress` number, nullable
  - `backfill_error` string, nullable
  - `backfill_completed_at` string, date-time, nullable
  - `transient` boolean
  - `evaluator_version` integer, required
  - `evaluator_id` string, uuid, nullable
  - `evaluator_name` string, nullable
  - `evaluator_type` string, nullable
  - `alignment_annotation_queue_id` string, uuid, nullable
  - `group_by` 'thread_id' | 'trajectory_id', nullable
  - `spend_limit` RunRuleSpendLimitSchemaOutput
    - `limit_usd` string, required
    - `window` 'weekly', required
  - `trace_count` integer, nullable
  - `spend_usd` number, nullable

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-29** `343cfba37252`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/api/v1/runs/rules/decision-models/post.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) - [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) - [OpenAPI document](https://skmtc.dev/langchain-ai/apis/langsmith/revisions/28621d1a347a?raw)
