Borrowing it
Nothing to install: this file belongs to rennf93/fastapi-guard. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/rennf93/fastapi-guard/master/AGENTS.mdgit clone --depth 1 https://github.com/rennf93/fastapi-guardWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/rennf93/fastapi-guard/agents-md)<a href="https://agentmods.dev/instructions/rennf93/fastapi-guard/agents-md"><img src="https://agentmods.dev/badge/instructions/rennf93/fastapi-guard/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/rennf93/fastapi-guard/agents-md"><img src="https://agentmods.dev/badge/instructions/rennf93/fastapi-guard/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03140 | $0.03140 |
| Opus 5.5 | $0.01256 | $0.01256 |
| Sonnet 5.5 | $0.00628 | $0.00628 |
| Haiku 4.5 | $0.00314 | $0.00314 |
Grade A, and why
fastapi-guard AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- fastapi-guard CLAUDE.md — 100% identical, 3 lines differ
How it starts
The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Guidance for AI agents (including Claude Code) working in this repository.
Project Overview
FastAPI Guard is a production-ready security library for FastAPI applications that provides:
-
IP control and rate limiting
-
Request logging and monitoring
-
Penetration attempt detection
-
Security headers management
-
Redis-based distributed caching
-
PyPI Package:
fastapi-guard -
Import Name:
guard -
Python Support: 3.10, 3.11, 3.12, 3.13, 3.14
-
Package Manager: uv (modern Python package manager)
-
Build System: Docker + Make
Ecosystem Position
As of v5.0.0, fastapi-guard is a thin adapter over guard-core. All security logic (models, handlers, decorators, detection engine, protocols, utilities) lives in the guard_core package. This repo contains only the FastAPI/Starlette integration layer.
guard-core (engine, PyPI dependency) <- all security logic
└── fastapi-guard (this repo) <- ASGI middleware adapter for FastAPI/Starlette
├── flaskapi-guard <- sibling adapter (Flask extension, sync mirror)
├── djapi-guard <- sibling adapter (Django middleware, sync mirror)
└── tornadoapi-guard <- sibling adapter (Tornado handler/middleware)
Because FastAPI/Starlette is async, this adapter imports guard_core.* directly (the sync adapter siblings import the unasync-generated guard_core.sync.* mirror instead).
Package Components
guard/__init__.py- Re-exports 20+ items fromguard_coreso users canfrom guard import SecurityConfig, SecurityDecorator, ...without knowing about guard-core. Also exportsSecurityMiddlewarefromguard.middleware.guard/middleware.py-SecurityMiddlewareextends Starlette'sBaseHTTPMiddleware. It wraps StarletteRequest/Responseobjects via adapters, delegates all security checks to guard-core's pipeline, and orchestrates initialization, event dispatch, metrics, and response processing using guard-core modules (core.checks,core.events,core.initialization,core.responses,core.routing,core.validation,core.bypass,core.behavioral).guard/adapters.py- Protocol adapters that bridge Starlette types to guard-core's framework-agnostic protocols:StarletteGuardRequest(adaptsstarlette.requests.RequesttoGuardRequest),StarletteGuardResponse(adaptsstarlette.responses.ResponsetoGuardResponse),StarletteResponseFactory(creates response adapters), and the lifecycle helperswrap_call_next()/unwrap_response().guard/lifespan.py-guard_lifespan,make_lifespan, andguard_startupwarm guard-core's shared-state registry at app startup so initialization does not happen on the first request.guard/_middleware_state.py-MiddlewareStateregistry keyed on theSecurityConfiginstance and the resolved decorator handler, so two middleware instances sharing one config only share a pipeline when they resolve the same decorator handler.guard/_decorator_adoption.py- Resolves and adopts the app's registeredguard_decorator(resolve_app_state_decorator,adopt_app_state_decorator) so the pipeline can be derived from the registered route config.guard/status.py-add_status_routehelper exposing a guard status endpoint.guard/websocket.py- WebSocket support (WebSocketCloseReason, a_WebSocketGuardRequestadapter for WebSocket connections).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago Changed · +1 lines · +1 tokens per session aec94f0bb0a9
- 2mo ago First seen · 303 lines · 3,139 tokens per session scan A 425ecb65aa81
fastapi-guard AGENTS.md is an instructions file published in the GitHub repository rennf93/fastapi-guard (829 stars, last pushed 19d ago), licensed MIT. It adds 3,140 tokens to every session, about $0.0126 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-21.
fastapi-guard AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| fastapi-guard AGENTS.mdrennf93/fastapi-guard | Instructions file | 829 | 19d ago | MIT | A | 3,140 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 196k | today | MIT | A | 9,887 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 144k | today | MIT | A | 7,230 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 196k | today | MIT | A | 5,685 | GitHub Copilot |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 150k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 196k | today | MIT | A | 3,303 | GitHub Copilot |
| deno copilot-instructions.mddenoland/deno | Instructions file | 109k | today | MIT | A | 3,077 | GitHub Copilot |