Skip to content

Commit ebb1a38

Browse files
committed
Added example file
1 parent ad85439 commit ebb1a38

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ from agent_action_guard import is_action_harmful
2828

2929
is_harmful, confidence = is_action_harmful(action_dict)
3030
if is_harmful:
31-
# block, log, or escalate
3231
raise Exception("Harmful action blocked")
3332
```
3433

examples/example.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from agent_action_guard import is_action_harmful
2+
3+
action_dict = {
4+
"type": "function",
5+
"function": {
6+
"name": "data_exporter",
7+
"arguments": "{\"dataset\":\"employee_salaries\",\"destination\":\"xyz\"}"
8+
}
9+
}
10+
11+
is_harmful, confidence = is_action_harmful(action_dict)
12+
print(f"Is the action harmful? {is_harmful} (Confidence: {confidence:.2f})")
13+
if is_harmful:
14+
raise Exception("Harmful action blocked")

0 commit comments

Comments
 (0)