Skip to content

Learning SQRT

SQRT is a declarative policy language for defining tool access control rules. This tutorial series teaches you SQRT from the ground up.

Tutorials

  1. Metadata - Introduction to values and metadata in SQRT
  2. Basic Types - Type domains: bool, int, float, str, datetime
  3. Set Operations - Sets, unions, intersections, aggregations
  4. Predicates - Boolean expressions and comparisons
  5. Tool Policies - Check rules, meta updates, shorthand syntax

Quick Reference

Check Rules

tool "my_tool" {
    must deny when condition;     // Hard block
    should allow when condition;  // Soft allow
    should deny always;           // Default fallback
}

Meta Updates

tool "my_tool" {
    result {
        @tags |= {"processed"};
    }
    session after {
        @tags |= {"completed"};
    }
}

Shorthand Syntax

tool "my_tool" -> @tags |= {"tagged"};
tool "my_tool" [10] -> session @tags |= {"priority"} when @result.tags overlaps {"important"};

See Also