SafeTool: Sandboxed Execution for LLM Agent Tool Calls
OPTINX Agent Governance Team ·July 30, 2024•Updated September 10, 2024
SafeTool: Sandboxed Execution for LLM Agent Tool Calls
Overview
SafeTool is the execution-safety layer inside QUACK. It governs how agent-initiated tool calls are validated, isolated, and — where necessary — reversed. The goal is a simple invariant: no agent action reaches an external system without a checked permission, a bounded blast radius, and a recovery path for anything irreversible.
Threat Model
Agent tool execution differs from traditional software because the caller (an LLM) is non-deterministic and can be influenced by untrusted input (prompt injection through retrieved documents, tool outputs, or user content). SafeTool assumes the planner may attempt any tool with any arguments, and treats every call as untrusted until validated.
Classification of Tools
Every registered tool carries a safety classification:
- Read-only — no external state change (search, retrieve, compute). Lowest gate.
- Reversible write — state change with a defined inverse (create draft, add tag). Requires permission check and an undo record.
- Irreversible — no inverse (send email, execute payment, delete record). Requires explicit approval policy and pre-execution confirmation.
Static Analysis
Before execution, SafeTool statically inspects the proposed call:
- Argument schema validation against the tool contract.
- Policy evaluation against the current runtime context (role, scope, environment).
- Taint analysis — arguments derived from untrusted content are flagged and, for irreversible tools, routed to human approval.
Runtime Monitoring
During execution, tools run inside a constrained sandbox with:
- Network egress allowlists per tool.
- Resource ceilings (time, memory, call count).
- Structured audit records capturing inputs, outputs, and the agent's stated reasoning.
Rollback & Compensation
For reversible writes, SafeTool records a compensating action at execution time. If a downstream step fails or a human rejects a plan mid-flight, the runtime replays compensations in reverse order. Irreversible operations never execute without a satisfied approval policy, so they are excluded from automatic rollback by design.
Human Approval Integration
Approval gates are first-class. A pending irreversible call suspends the agent, surfaces the exact operation and its arguments to a human, and resumes only on explicit approval — with the decision written to the audit log.
Evaluation
Across an internal red-team suite of injection scenarios, SafeTool blocked 100% of attempts to trigger irreversible tools from untrusted content without approval, while adding a median of 6ms of overhead to read-only calls.
Future Work
Extending taint tracking across multi-agent handoffs, and formalizing approval-policy composition so organizations can layer team, project, and regulatory rules without conflict.
References
- OPTINX Technical Report SAFETOOL-001: Execution Safety for Agent Runtimes
- Johnson & Lee (2024): "Permission Models for Autonomous Systems"
- Anderson et al. (2023): "Prompt Injection and Tool-Use Safety"
Related Research
QUACK: Agent Runtime Architecture for Enterprise Intelligence Systems
A detailed architecture of QUACK, OPTINX's agent runtime and execution infrastructure, covering planning, orchestration, tool execution, permission enforcement, and governance mechanisms.
Nextmos: Persistent Organizational Memory Infrastructure
An architectural overview of Nextmos, OPTINX's persistent organizational memory system that enables long-term context retention, customer memory, and learned procedures across agent sessions.
NAVIQ Decision Benchmarks: Evaluation Framework for Autonomous Machine Intelligence
Benchmark suite and evaluation methodology for NAVIQ decision intelligence systems in autonomous machines, covering perception accuracy, decision latency, and safety metrics.
Source Code
The implementation and experiments described in this article are available in our public repository.