microsoft/RAMPART

A pytest-native safety and security testing framework for agentic AI applications

RAMPART – Quick Overview

What it is: RAMP‑​RAMPART is a Python library that plugs into the popular pytest testing framework to let developers write security‑ and safety‑focused tests for AI agents (chat‑bots, autonomous assistants, etc.). It supplies a set‑up‑once‑and‑run‑any‑time framework for:

  • Simulating adversarial attacks against an agent.
  • Checking that the agent fails gracefully on benign errors.
  • Verifying that the agent’s outputs stay within defined “harm‑category” limits (e.g., hate‑speech, misinformation …).

Why it matters: As AI agents become more autonomous, developers need systematic ways to certify that they won’t cause harm or be easily hijacked. RAMPART gives a pytest‑native way to embed those checks directly in a codebase, so safety testing can run alongside unit‑tests in CI pipelines.


Core Features (as described in the README)

Feature What it does Why it’s useful
pytest integration Tests are written as normal pytest functions, using RAMPART’s helpers and assertions. Leverages existing CI workflows; no new test runner needed.
Adversarial attack testing Provides utilities to craft malicious inputs or payloads that try to trick the agent. Helps discover vulnerabilities before deployment.
Benign‑failure checks Validates that the agent handles normal errors (e.g., malformed queries) safely. Guarantees graceful degradation rather than crashes or unsafe output.
Harm‑category coverage Built‑in taxonomy of common AI harms (hate, misinformation, privacy leaks, etc.) that can be asserted against. Gives a structured way to enforce policy compliance.
Evaluation‑driven assertions Tests can assert on quantitative metrics (e.g., safety scores) rather than just boolean pass/fail. Enables nuanced safety thresholds and regression tracking.
RAMPARTner onboarding skill An interactive “skill” (rampart/skills/rampartner/SKILL.md) that guides developers through creating their first test inside a coding‑assistant environment. Lowers the barrier for teams new to safety testing.

Typical Workflow

  1. Onboard – Run the RAMPARTner skill to define the first safety test for your agent.
  2. Write tests – In a test_*.py file, import RAMPART helpers and describe the scenario (adversarial payload, expected safe response, etc.).
  3. Run with pytest – Execute pytest as usual; RAMPART reports detailed safety metrics.
  4. CI integration – Because it’s just pytest, the tests can be part of any CI pipeline, giving continuous safety regression checks.

Who Should Use It?

  • AI‑agent developers who want to bake safety checks into their development cycle.
  • ML Ops / reliability engineers needing automated security regression testing.
  • Research teams building experimental agents and requiring systematic red‑team evaluations.

Availability

  • Package: Published on PyPI (pip install RAMPART).
  • Source: Open‑source on GitHub under the Microsoft organization.
  • Status: Actively CI‑tested (badge shown) and scored by OpenSSF Scorecard.

Bottom Line

RAMPART is a genuine, production‑ready toolkit that brings formal safety and security testing to the fast‑moving world of agentic AI, all while staying inside the familiar pytest ecosystem.

Related

  • Project
  • Project
  • Project
  • Project
  • Project