Thomas Piacentini
← Workshop

Project

Tool Call Firewall

Original text · English480 min

An approval receipt proving exactly which operation was authorized and executed.

The caller application supplies identity; the model supplies only a proposed operation. The compact Rust envelope carries a stable request id, role, tool and relative argument without ambiguous delimiters or controls.

Start with a learner workspace

Tool schema design, Security and secrets audit. Language foundation: Rust ownership and Result.

Install Rust (rustc) and Python 3.10+. The core uses the Rust standard library; Python adapters compile into private temporary directories.

bash
python3 scripts/project_test.py tool-call-firewall --init learning-artifacts/tool-call-firewall
python3 scripts/project_test.py tool-call-firewall --stage 1 --path learning-artifacts/tool-call-firewall

Build route

  1. Validate an unambiguous call envelope
  2. Evaluate role and path policy
  3. Consume a request-bound approval once
  4. Record bounded audit evidence

Run with your own inputs

After completing the stages, these commands run your workspace code on the original Orchard examples. Replace the sample paths with your own files.

bash
rustc --edition=2021 learning-artifacts/tool-call-firewall/cli.rs -o learning-artifacts/tool-call-firewall/firewall
learning-artifacts/tool-call-firewall/firewall projects/tool-call-firewall/examples/workspace reader r1 read notes.md

To inspect the complete reference first, replace learning-artifacts/tool-call-firewall with projects/tool-call-firewall/solution in the same command. JSON results use schema_version: 1; paths and argument examples are explicit so another tool can consume them.

Integration boundary

The native CLI requires a trusted role from the invoking application. Reads and writes pass through dispatch, which validates canonical containment and binds writes to exact content. Approvals are single-use in memory within one invocation. The code is a file-tool enforcement example, not a persistent cross-process authority or OS sandbox.

bash
python3 scripts/project_test.py tool-call-firewall --all --solution --strict
python3 scripts/project_test.py tool-call-firewall --all --path learning-artifacts/tool-call-firewall --strict

The first command checks the reference. The second checks your implementation. The published examples and tests are regression evidence, not a production certification or an unseen benchmark.

Primary references

Code and artifacts 34
What you take away

Saved in your notebook on this device.

Sources and limits

Reading checkpoints are self-reported. Test results are recorded separately and apply to the executed cases.

AI Engineering from Scratch · 3f9715c · MIT

Download this file ↓