
Alignment-research scaffold (autoresearch-style) for LLM guardrails: search over a single policy.md surface
Open source by Santander AI Lab. An LLM / AI-safety guardrail research library / evaluation harness (autoresearch-style): it searches over a single mutable
policy.mdsurface to minimize attack success rate (ASR) against a fixed evaluation suite, with a benign-pass floor.
Part of Santander AI Open Source — open source AI projects from Banco Santander (santander.com).
autoguardrails is a small alignment research scaffold inspired by Karpathy's autoresearch.
Instead of searching over train.py, this repo searches over policy.md.
The idea is the same:
In this repo, the top-line metric is attack success rate (ASR, lower is better), with a benign-pass floor so the system cannot win by refusing everything.
For day-to-day experimentation, three files matter most:
program.md: the human-owned instructions for the looppolicy.md: the only file you should edit between runsresults.tsv: the append-only run logEverything else is fixed harness code or fixed evaluation data.
policy.mdeval_suite.jsonljudge_prompt.mdautoguardrails/ASR improves and benign pass does not fall by more than 2 percentage pointsIf you want a mental model closer to the original autoresearch, think of autoguardrails/ as the fixed helper layer and policy.md as the single file under search.
Run from the repository root.
python -m autoguardrails baseline --reset --repeat 2 --notes "initial baseline"
Edit only policy.md.
Score the new candidate.
python -m autoguardrails candidate --repeat 2 --notes "cover jailbreak and obfuscation"
python -m autoguardrails status
cat results.tsv
If a candidate is rejected, the harness restores policy.md to the last accepted version automatically.
If you prefer a single entrypoint, use run_autoguardrails.sh:
sh run_autoguardrails.sh status
sh run_autoguardrails.sh evaluate
sh run_autoguardrails.sh baseline "initial baseline" 2
sh run_autoguardrails.sh candidate "cover jailbreak and obfuscation" 2
On Windows, run the wrapper from Git Bash or another POSIX-compatible shell.
The default setup uses a deterministic local stub so the repo works offline. To run real experiments, point the target model and the judge model at OpenAI-compatible endpoints.
Target model variables:
AUTOGUARDRAILS_TARGET_PROVIDER=openai_compatibleAUTOGUARDRAILS_TARGET_MODELAUTOGUARDRAILS_TARGET_API_BASEAUTOGUARDRAILS_TARGET_API_KEYJudge model variables:
AUTOGUARDRAILS_JUDGE_PROVIDER=openai_compatibleAUTOGUARDRAILS_JUDGE_MODELAUTOGUARDRAILS_JUDGE_API_BASEAUTOGUARDRAILS_JUDGE_API_KEYExample:
export AUTOGUARDRAILS_TARGET_PROVIDER=openai_compatible
export AUTOGUARDRAILS_TARGET_MODEL=gpt-4.1-mini
export AUTOGUARDRAILS_TARGET_API_BASE=https://your-endpoint.example/v1
export AUTOGUARDRAILS_TARGET_API_KEY=your-target-key
export AUTOGUARDRAILS_JUDGE_PROVIDER=openai_compatible
export AUTOGUARDRAILS_JUDGE_MODEL=gpt-4.1-mini
export AUTOGUARDRAILS_JUDGE_API_BASE=https://your-endpoint.example/v1
export AUTOGUARDRAILS_JUDGE_API_KEY=your-judge-key
python -m autoguardrails baseline --reset --repeat 2 --notes "real-model baseline"
Use a frozen judge setup during a run series. Do not switch judge prompts or judge models mid-experiment.
A simple offline emulation cycle looks like this:
policy.md.candidate.One example candidate change that improves the bundled stub is to add explicit handling for:
That gives you a realistic first improvement curve without changing the evaluator.
program.md: experiment instructions and constraintspolicy.md: mutable guardrail policy under searchjudge_prompt.md: frozen judge prompteval_suite.jsonl: fixed attack and benign eval casesresults.tsv: run logrun_autoguardrails.sh: convenience wrapper around the CLIautoguardrails/: fixed Python harnesstests/: regression and safety checks for the harnessSee autoguardrails/README.md for the code architecture and tests/README.md for the test strategy.
ruff, black, mypy, pytest, pytest-cov (see CONTRIBUTING.md).AUTOGUARDRAILS_* environment variables described above).Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct before getting started.
ruff check ., black --check ., mypy autoguardrails, and pytest before opening a PR.policy.md is the only mutable surface; eval_suite.jsonl and judge_prompt.md are frozen.Please report security vulnerabilities responsibly. See our Security Policy for how to report (do not open a public issue for vulnerabilities). Contact: [email protected] or use GitHub Security Advisories.
This software is an open source project from the Santander AI Lab, provided "as is" under its license, without warranties or conditions of any kind. It is not an official Banco Santander product or service, carries no commitment of production support, and does not constitute financial, legal or professional advice.
"Santander" and its logo are registered trademarks of Banco Santander, S.A. The project license does not grant any right to use them beyond factual attribution.
If you believe you have found a security vulnerability, follow our security policy — do not open a public issue. You are responsible for assessing the suitability of this software for your use case and for keeping your own deployments up to date.
This project is licensed under the Apache License 2.0 — see the LICENSE and NOTICE files for details.
Copyright (c) 2026 Santander Group
SPDX-License-Identifier: Apache-2.0
If you use autoguardrails in your research, please cite it:
@software{autoguardrails2026,
author = {{Santander AI Lab}},
title = {autoguardrails: an autoresearch-style guardrail policy loop},
year = {2026},
url = {https://github.com/SantanderAI/autoguardrails},
license = {Apache-2.0}
}