concept
Tool results, timeouts and idempotency
Bounded retry routing and actor-scoped dry-run deduplication; no external effects or durability guarantee.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
route(outcome, attempts, limit, remaining_ms, retry_safe); preview(ledger, actor, key, item, amount, permissions, approvals)Working Example
Example Snippetartificial-intelligence
def preview(ledger, actor, key, item, amount, permissions, approvals): # In-memory dry run only. Trusted identity, permissions and approvals. payload = (item, amount) if (item not in permissions or type(amount) is not int or not 1 <= amount <= 5 or type(key) is not str or not key): return "denied" if (actor, key, item, amount) not in approvals: return "approval_required" scope = (actor, key) if scope in ledger: return ledger[scope][1] if ledger[scope][0] == payload else "conflict" result = f"preview: reserve {amount} of {item}" ledger[scope] = (payload, result) return result
ledger = {}approvals = {("u", "r1", "A", 2), ("u", "r1", "A", 3)}print(preview(ledger, "u", "r1", "A", 2, {"A"}, approvals))print(preview(ledger, "u", "r1", "A", 2, {"A"}, approvals))print(preview(ledger, "u", "r1", "A", 3, {"A"}, approvals))print(preview(ledger, "u", "r2", "A", 2, {"A"}, approvals))print(len(ledger))