Skip to main content

Overview

This guide shows how to create and evaluate Ad Hoc Rules in Sift using the REST API. Ad Hoc Rules are ideal for automated workflows, such as CI/CD pipelines, where Rules need to be defined, updated, and evaluated programmatically. The guide covers how to create Ad Hoc Rules via the BatchUpdateRules endpoint, preview their behavior using EvaluateRulesPreview, and run evaluations that generate Annotations and Reports using EvaluateRules. Use this guide when you need to automate Rule creation and execution outside the Sift web application, and want to integrate telemetry-based validation directly into your development or testing pipelines.
NoteThis guide uses the Sift REST API for all examples. The same functionality is also available through the gRPC API, which supports official client libraries in Python, Go, and Rust.

Instructions

Step 1: Create an Ad Hoc Rule

To create an Ad Hoc Rule, use the BatchUpdateRules endpoint and set the isExternal flag to true. This enables a Rule to be created and evaluated ad hoc and simultaneously, which is ideal for a Rule triggered by CI/CD workflows.
NoteOnce an Ad Hoc Rule is created, it cannot be edited through the UI or API. Only non-Ad Hoc Rules can be modified.

Step 2: Preview an Ad Hoc Rule

Before evaluating an Ad Hoc Rule, you can preview what Annotations would be generated using the EvaluateRulesPreview endpoint. This allows you to validate an Ad Hoc Rule’s logic without creating a Report or saving any Annotations.

Step 3: Evaluate an Ad Hoc Rule

To apply an Ad Hoc Rule to a specific Run or Asset, use the EvaluateRules endpoint. This evaluates the Rule logic, generating a Report and potential Annotations.