Mastyf Foresight predicting that a curl command will send AWS credentials off the machine, and escalating

Try it live  ·  Watch it catch an attack  ·  Results  ·  mastyf.ai

Mastyf Foresight reads the next tool call an AI agent wants to make (a shell command, a file write, a SQL query, a URL) and predicts what it will actually do before it runs: which secrets it touches, whether data leaves the machine, what it deletes, what it installs, and how bad it could get.

Most guardrails ask whether text looks like an attack. Foresight asks what happens if the action is allowed to run.


Watch it catch an attack

An agent is asked to set up a project. The README it reads carries a hidden instruction. Every step is judged before it runs, and Foresight also sees what earlier tools returned, including the planted comment.

Step-by-step replay: reading the README and installing requirements are allowed; reading the AWS credentials and posting them out are escalated; the agent is paused at step 3

What it sees in a single action

Six actions with their predicted effects: tests and README reads are allowed; dumping the users table, download-and-run, leaking AWS keys over HTTPS and copying an SSH key are escalated

Every card is a real prediction, not a mock-up. Foresight names 39 effects, among them reading secrets, sending a secret off the machine, installing persistence, piping downloaded code into a shell, dumping a database and touching cloud metadata, and gives a 95% worst-case bound on bytes sent out, database rows exposed and files deleted.

How it learned

01 Sandbox, 02 Observed labels, 03 Foresight, 04 Built for Shield

Foresight did not learn from opinions about what looks dangerous. Each of its 85,000+ training actions was run in an isolated container with planted fake credentials, system-call tracing and a network trap that also decrypts HTTPS and acts as an SSH and SFTP server. If a planted key appeared on the wire, the action really leaked a secret. The model learns to predict those observed consequences from the action and the session so far.

Results

Attacks caught: Claude Agent SDK 98.4%, OpenAI Agents SDK 89.8%, Google ADK 85.5%; normal sessions flagged 0.4 to 1.4%

Full numbers and how they were measured

Simulated deployments built from public agent traces. Thresholds are set on the first half of each deployment's own traffic (its burn-in) and every number is measured on the second half. Attacks come from attack categories held out of training.

Deployment Held-out attacks caught Normal sessions with any false alarm
Claude Agent SDK 98.4% 1.4%
OpenAI Agents SDK 89.8% 0.6%
Google ADK, never seen in training 85.5% 0.4%
mini-swe-agent, never seen — 4.7%; fresh sessions calibrated on fresh traffic: 1.0%
OpenHands, never seen — 3.7%; fresh sessions calibrated on fresh traffic: 0.0%
  • Attacks a sandbox confirmed did real harm: 96–100% caught.
  • Held-out secret leaks over HTTPS, SSH and SFTP: 98–100% caught, with 0–1.4% of look-alike normal network actions flagged.
  • Fail-safe: 2,000 fault-injected decisions and 0 cases where a model failure made a decision more permissive.

All numbers are self-measured on public data; see Limitations.

Try it live

The interactive demo lets you type any action, or replay a whole agent session step by step. mastyf-foresight.onrender.com

Type any action, or replay a whole agent session step by step and watch where Shield would pause the agent. Actions are only analysed, never executed. The page loads instantly; after a quiet period the model itself can take up to 30 seconds to wake, and the page shows when it is ready.

How it compares

Judging an agent's action before it runs became an active research area in 2025–26. Foresight's design differs from the strongest published guards in where its ground truth comes from, what it tells you, and what it needs to run.

System Ground truth Model Tells you
Mastyf Foresight Observed in an instrumented sandbox (85,000+ executed actions) 39M, built from scratch, CPU 39 effects, harm, 95% damage bounds, off-task
DreamGuard (2026) GPT-5.1 pre-labels reviewed by people World model on a frozen Qwen3-4B encoder Pass / hold / block
StepGuard (2026) LLM-simulated tool responses, LLM labels Qwen3-4B fine-tuned Safe / unsafe, risk type
JANUS · Vanguard (2026) Simulated tools, GPT-5.5 labels Qwen3-8B fine-tuned Safe / potentially unsafe / unsafe
LlamaFirewall AlignmentCheck (2025) Prompted large model Llama 4 Maverick Aligned / misaligned

Foresight is not a chat model and follows no instructions, so there is no prompt for injected text to hijack (adaptive attacks are not yet tested). Published figures come from different benchmarks and hardware, so this is a design comparison, not a head-to-head. Sources: arXiv 2608.05695, 2608.24777, 2607.19913, 2505.03574.

Explore the benchmarks interactively: pick a deployment, move the alarm budget, and see catches and false alarms change, measured on held-out data.

Built for Mastyf Shield

Foresight is designed to run inside Mastyf Shield as an advisor: it can only make a decision stricter (warn or escalate), never looser, and if it errors or is slow, Shield decides without it. It complements Protocol X, which checks the content agents read, and Mastyf Authority, which caps the damage any account can do. Foresight checks the actions agents take, and its damage bounds (bytes out, records exposed, files deleted) map onto the kinds of limits Authority enforces.

Model details

Architecture Causal byte-level transformer, 39M parameters, built and trained from scratch by Mastyf Labs
Context The whole session (2,048 bytes of history), the user's task, and digests of earlier tool outputs
Outputs 39 effect probabilities, harm score, damage bounds (q95), off-task score
Tools covered Shell, file read, write and edit, search, URLs, SQL, code execution
Speed About 50 ms per decision on a laptop CPU; an int8 version runs on small servers
Availability Through Mastyf Shield. Weights are not distributed.

Limitations

  • Simulated, not production, traffic. Deployments are built from public agent traces; no live customer data yet.
  • Coding, shell and file-system agents are covered best. Business-tool domains it has never seen, for example an HR or healthcare application, are not yet reliable; this is the focus of the next version.
  • Harm only in the final answer is out of scope. If every tool call is legitimate and the harm is in what the agent writes back, for example a wrong treatment plan, an action model cannot see it; that needs a separate check on the answer.
  • Fixed public attack sets. Not yet tested against attackers who adapt to the model.
  • Calibrate per deployment. Thresholds must be set on the customer's own recent traffic.

Acknowledgements

Built with public data from DTap-Bench (Apache-2.0), SWE-smith trajectories (MIT), mini-swe-agent trajectories (MIT), DeepSWE trajectories (MIT) and NVIDIA SWE-Zero OpenHands trajectories (CC-BY-4.0). Thanks to their authors.

Mastyf
Mastyf Labs  ·  perimeter security for AI  ·  supported by the IIT Kharagpur Seed Fund

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for Mastyf-Labs/foresight