A 135M parameter model fine-tuned to answer one question before an agent runs untrusted code: will this hurt the host?
It replies RISKY when the snippet deletes or writes outside its working
directory, talks to the network, spawns unbounded processes, exhausts memory,
reads secrets or mutates the system — and SAFE otherwise.
Part of Blast Radius Zero, an agent that executes every step inside a throwaway container. The classifier is the cheap pre-flight gate; the container is the guarantee.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "personaio/blast-radius-classifier"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.float32)
PROMPT = (
"You are a pre-flight check for an agent that runs untrusted Python.\n"
"Decide whether this code could damage the host it runs on: deleting files "
"outside its working directory, writing outside it, talking to the network, "
"spawning unbounded processes, exhausting memory, reading secrets, or "
"modifying the system.\n"
"Answer with exactly one word: RISKY or SAFE.\n\n"
"CODE:\n```python\n{code}\n```\nANSWER:"
)
code = "import shutil; shutil.rmtree('/')"
ids = tok(PROMPT.format(code=code), return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=6, do_sample=False, pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True).strip()) # RISKY
HuggingFaceTB/SmolLM2-135M-Instructtools/make_classifier_data.py,
plus the real sandbox traces in personaio/blast-radius-zero-traces.MIT, same as the parent project.