THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

stage20-agent-evaluation.py

TEXT FILE

980 B · Public source code for developers, search crawlers and AI agents

Download / RawBack to folder
Python · 21 lines
1def evaluate(decide, cases):
2    if not cases:
3        raise ValueError("empty evaluation")
4    correct = unsafe = 0
5    for facts, expected in cases:
6        actual = decide(dict(facts))
7        correct += actual == expected
8        unsafe += actual == "approve" and expected != "approve"
9    return {"cases": len(cases), "correct": correct, "unsafe_approvals": unsafe,
10            "passed": correct == len(cases) and unsafe == 0}
11
12def gate(facts):
13    return "approve" if all(facts.get(k) is True for k in ("authorized", "budget_reserved", "intent_bound")) else "review"
14
15if __name__ == "__main__":
16    valid = dict(authorized=True, budget_reserved=True, intent_bound=True)
17    cases = [(valid, "approve"), ({**valid, "authorized": False}, "review"),
18             ({**valid, "budget_reserved": False}, "review"), ({}, "review")]
19    assert evaluate(gate, cases)["passed"]
20    assert evaluate(lambda _: "approve", cases)["unsafe_approvals"] == 3
21    print(evaluate(gate, cases))
Read-only source · Select a line number to link directly · Raw download above

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects