Skip to content
Back to skills

Guardrailsfor Agent

ASecurity

Build, run, and extend the Agent Policy & Guardrails Engine. Use when implementing policy formats, enforcement logic, decision conflict resolution, policy APIs, and audit/compliance workflows.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 18, 2026
toolspythonbashsqlfastapirailsapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 18, 2026

npx -y skills add johnalbertini14-glitch/openclaw-skills --skill guardrailsfor-agent --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Guardrailsfor Agent?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Guardrailsfor Agent
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/johnalbertini14-glitch-guardrailsfor-agent/badge)](https://www.skillsdirectory.com/skills/johnalbertini14-glitch-guardrailsfor-agent)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: agent-policy-guardrails-engine
description: Build, run, and extend the Agent Policy & Guardrails Engine. Use when implementing policy formats, enforcement logic, decision conflict resolution, policy APIs, and audit/compliance workflows.
---

# Agent Policy & Guardrails Engine

## Use This Skill When

- You need to add or change policy enforcement behavior.
- You need to add policy types (financial, privacy, communication, operational, approval, time-based).
- You need to extend decision outputs (`ALLOW`, `DENY`, `MODIFY`, `REQUIRE_APPROVAL`).
- You need to update APIs, persistence, or audit logging.

## Project Layout

- `app/main.py`: FastAPI endpoints.
- `app/service.py`: orchestration for policy CRUD + evaluation + audit writes.
- `app/engine.py`: core policy evaluation and conflict resolution.
- `app/policy_parser.py`: JSON/YAML/NL policy parsing into structured definitions.
- `app/schemas.py`: request/response and policy schemas.
- `app/models.py`: SQLAlchemy models (`policies`, `audit_logs`).
- `app/seed.py`: baseline policies.
- `tests/test_api.py`: API-level behavior.
- `tests/test_engine.py`: decision logic behavior.

## Standard Workflow

1. Implement schema/model changes first if policy structure changes.
2. Update parser and engine evaluation paths.
3. Update API/service layer only as needed.
4. Add or update tests for both engine and API.
5. Run tests before finalizing.

## Commands

Install and test:

```bash
python3 -m pip install -r requirements.txt
python3 -m pytest
```

Run locally:

```bash
python3 -m uvicorn app.main:app --reload
```

## Enforcement Contract

All external agent/tool actions must be sent to `POST /evaluate` before execution.

Runtime handling expectations:

- `DENY`: block execution.
- `REQUIRE_APPROVAL`: pause and require explicit human approval.
- `MODIFY`: apply returned `modifications`, then execute.
- `ALLOW`: execute.

## Conflict Resolution Rules

When multiple policies match the same action:

1. Highest `priority` wins.
2. If tied on priority, effect severity wins:
   `DENY > REQUIRE_APPROVAL > MODIFY > ALLOW`.

## Adding New Guardrails

1. Add a structured policy in `app/seed.py` (optional baseline).
2. Ensure `action_types` and `conditions` map to real runtime payload fields.
3. Add API test coverage in `tests/test_api.py` using `/evaluate`.
4. Add engine-level tests in `tests/test_engine.py` for edge/conflict cases.

## Notes

- Keep policy evaluation deterministic.
- Prefer structured JSON/YAML policies for complex controls.
- Natural-language rules should compile into the same structured policy schema.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.