Skip to main content
ThunderLang™Programming Language
← All examples

AgentToolAuthorization

examples/AgentToolAuthorization.thunder

AgentToolAuthorization.thunder
1# area: Agent safety
2mission AgentToolAuthorization
3
4goal
5 Decide whether an agent may call a tool within an approved permission scope.
6
7why
8 A model proposal must pass the same permission check as a human action.
9
10guarantee tool access requires a valid permission scope
11 verify test ToolAccess
12
13never allow a write without explicit approval
14 verify test ToolAccess
15
16decision ToolAccess
17 inputs
18 scopeAllowed
19 isWrite
20 approved
21 rule read within scope
22 when scopeAllowed == true and isWrite == false
23 return Allow
24 rule approved write within scope
25 when scopeAllowed == true and isWrite == true and approved == true
26 return Allow
27 default
28 return Deny
29
30test ToolAccess
31 case scoped read
32 given scopeAllowed true, isWrite false, approved false
33 expect Allow
34 case unapproved write
35 given scopeAllowed true, isWrite true, approved false
36 expect Deny
37 case approved write
38 given scopeAllowed true, isWrite true, approved true
39 expect Allow
40 case out of scope read
41 given scopeAllowed false, isWrite false, approved false
42 expect Deny
43 case approval cannot expand scope
44 given scopeAllowed false, isWrite true, approved true
45 expect Deny
46
47note security
48 Enforce this decision in the tool host before execution. These cases do not install a runtime permission boundary.
Draft syntax. This file is illustrative and does not run yet.