# Try huggingface/safeagents: fake tool calls through a pre-harness guard

**1 November 2026 · 15–20 min · Documentation-reviewed, NOT EXECUTED.**

## Purpose

[huggingface/safeagents](https://github.com/huggingface/safeagents) is an Apache-2.0 proxy that checks a model's tool calls *before* a coding agent harness sees them. It checks undeclared tools and unfamiliar hosts and applies atif-scan detectors. An optional model judge is not necessary for this demonstration. It is **not** an operating-system sandbox. The repository was created on **28 October**, not today.

This optional reader lab uses the maintainer's [fake-model simulator](https://github.com/huggingface/safeagents/blob/main/scripts/simulate.py), which sends JSON-only requests and **executes no shell commands**. The daily report itself runs in GitHub's cloud and requires no reader laptop.

## Prerequisites and costs

- Python **3.11+**, Git, [uv](https://docs.astral.sh/uv/) and network access only to install open-source dependencies, on macOS/Linux/WSL.
- Local loopback ports **8787** for the proxy and **18081** for the fake model.
- **No** API key, subscription, model inference, GPU, Actions run or paid service. Do not run this on a production repository or computer containing secrets.
- Inspect third-party code before executing. Record the Git revision to enable later comparison.

## Prepare

```sh
git clone https://github.com/huggingface/safeagents.git
cd safeagents
python3 --version
uv --version
git rev-parse HEAD
uv sync
```

The checked source used package version `0.0.1`, Python >=3.11 and had no GitHub tagged release verified during this pass. For formal reproducibility pin an inspected commit instead of relying on a moving main branch.

## Terminal 1 — start the local proxy

```sh
uv run safeagents http://127.0.0.1:18081 --no-journal
```

The foreground proxy listens at `127.0.0.1:8787`. The `--no-journal` switch avoids storing the fake arguments. Do not expose the listener on a public network.

## Terminal 2 — one safe synthetic replay

From the same checkout:

```sh
uv run python scripts/simulate.py --agents 1 --delay 0.1 --loops 1
```

The script launches a fake Anthropic-compatible model endpoint on localhost, sends a predefined 15-turn sequence through the proxy, and reports whether the harness *would* receive the proposed JSON tool call. Some JSON strings describe dangerous-looking commands, but **none are executed**. Never paste those strings into a real shell.

## Expected output (not measured here)

Terminal 1 should show pass/warn/block counts. Terminal 2 should print a per-turn line with either `harness runs it` or `harness gets a text notice`. This refers to **forwarding the JSON**, not executing tools. Exact counts depend on the repository revision and detector versions, so none are invented.

## Score your observations (0–5)

Award one point each when verified: (1) proxy and fake model bind only to loopback, (2) one fake session finishes and the source revision is recorded, (3) an undeclared tool is blocked, (4) an unexpected destination/secret-read pattern is flagged or blocked, and (5) a false-positive or uncovered-case limitation is recorded. A score of 5 is *not* a security certification, and zero/inconclusive is not automatically a failure.

## Troubleshooting and cleanup

- Missing uv: install from the official uv documentation.
- Python version failure: select a supported Python 3.11+ runtime.
- Port in use: stop conflicting local processes; do not open network-facing ports.
- Proxy cannot connect: ensure Terminal 1 is running with the default local port.
- No block: check flags, detector dependencies, and the pinned revision; report actual behavior without inventing success.
- Finish with Ctrl+C in both terminals and remove the disposable checkout if appropriate.

## Evidence and tested status

Only the repository README, LICENSE, pyproject.toml, commands documentation, and simulator Python source were read. **The proxy and fake model were NOT installed or executed for this edition; there are no real verdicts, timings, inference runs or independent security results.**
