Stop A Dangerous Tool

SDK

Deny a named function, or a shell command that contains text you listed, before that function runs.

Some tools should not run just because a model decided to call them. High-Risk Tool denies a function by its name, such as delete_account. Dangerous Shell Commands denies a listed tool when the command text contains a string you wrote, such as rm -rf.

Both run before the function body. A denied call shows up in Decision Log as Denied, from the SDK, in Block. The trace is still saved.

Two Different Checks

PolicyWhat it readsExample
High-Risk ToolThe function name only.delete_account is denied. lookup_user still runs.
Dangerous Shell CommandsThe command text on the tools you list.shell with rm -rf is denied. shell with ls still runs.

Not A Sandbox

Dangerous Shell Commands does not sit on the operating system and does not block a terminal you did not instrument. It reads the argument your agent passed, usually a field named command, and compares that text to the strings you listed. A different tool that happens to mention rm -rf in a search query is not denied.

Turn It On

  1. Open Policies and click Create Policy.
  2. For a function that should never run unsupervised, choose High-Risk Tool and type the name, such as delete_account.
  3. For a shell helper, choose Dangerous Shell Commands. Under Block If Command Contains, add rm -rf. Under Applies To, list the tool name, usually shell.
  4. Set the mode to Block, then Activate Policy.
  5. Wrap the agent with govern() and mark those functions as tools. Both cards say SDK. They do not apply on the Gateway.

If a shell call has no command text, that rule is skipped and the tool still runs. High-Risk Tool does not need arguments. The name is enough to deny.

A Small Ops Agent

This function never reaches a real shell. The policy denies the call before the body runs. Get the API key from app.traccia.ai.

ops_shell.py
python
from traccia import init, govern, observe
from traccia.governance import AgentBlockedError
init(
api_key="...",
endpoint="https://api.traccia.ai/v2/traces",
agent_id="ops-shell",
)
@observe(name="shell", as_type="tool")
def shell(command: str) -> dict:
return {"ok": True, "command": command}
@govern(fail_open=False, name="ops_shell")
def handle_ticket(command: str) -> dict:
return shell(command)
try:
handle_ticket("rm -rf /tmp/cache")
except AgentBlockedError as exc:
print(exc)

The same wrap denies delete_account when a High-Risk Tool policy lists that name. lookup_user is a different name, so it runs.

What This Does Not Do

These policies do not delete accounts, do not run commands, and do not replace a sandbox or an identity provider. They do not apply on the Gateway. If fail_open stays at its default and Traccia cannot be reached, the tool still runs.

Next Steps

© 2026 Traccia.