Y* Policy Builder

Three-layer constraint builder → executable Python · fill blanks, get code

① Fill in blanks
② Advanced
③ Expert
● Layer 1 — Basic · covers 95% of needs
Quick start — built-in templates
Your agents / roles / players
◆ Layer 2 — HigherOrderContract · time, aggregate, context
Rate limit / temporal
per
Aggregate / cumulative
Context / roles / environment
Scheduled window
Resource limits
▲ Layer 3 — Expert · direct Python expressions

For parameter relationships, output validation, complex conditions.

invariant — input constraints
# Evaluated against call parameters — all must hold invariant=["amount > 0", "amount <= budget"] invariant=["price * qty <= notional_limit"] invariant=["withdrawal <= available_balance"]
optional_invariant — conditional
# Only checked when the parameter is present in the call optional_invariant=["price >= cost * 1.1"]
postcondition — output validation
# Checked against the function return value ("result") postcondition=["result.get('status') == 'ok'"]
policy.py