Thank you for your interest in contributing to AgentGuard. This document provides guidelines and instructions for contributing.
Be respectful. Be constructive. Assume good intent. We are building security infrastructure — precision and clarity matter more than speed.
- Python 3.12+
- uv (Python package manager)
- Node.js 20+ (for console frontend)
- Docker & Docker Compose (for integration tests)
# Clone the repository
git clone https://github.com/hidearmoon/agentguard.git
cd agentguard
# Start dependencies
make dev
# Install core engine dependencies
cd packages/core && uv sync --extra dev
# Install SDK dependencies
cd packages/sdk-python && uv sync --extra dev
# Install frontend dependencies
cd packages/console/frontend && npm install# Run the primary test suite (unit + security)
make test
# Run individual test suites
make test-unit # 218 unit tests
make test-security # 92 security tests
make test-integration # Integration tests (requires Docker services)
make test-perf # Performance benchmarks
# Run with coverage
make test-coverage- Security vulnerabilities: Please report security issues privately. Do NOT open a public issue. Email the maintainers directly.
- Bugs: Open an issue with a minimal reproduction case, your Python version, and the output of
uv pip list. - Feature requests: Open an issue describing the use case, not just the solution.
- Fork the repository and create a branch from
main. - If you've added code, add tests. Security-related changes require security tests in
packages/core/tests/security/. - Ensure all tests pass:
make test - Ensure code passes linting:
make lint - Write a clear PR description explaining why, not just what.
Use conventional commits:
feat(core): add time-based condition to rule DSL
fix(sdk-python): handle connection timeout in guard decorator
test(security): add encoding bypass test for base64 payloads
docs: update trust model documentation
| Package | Description | Language |
|---|---|---|
packages/core |
Security engine — the brain | Python (FastAPI) |
packages/proxy |
Transparent sidecar proxy | Python |
packages/console |
Management UI | React (frontend) + Python (backend) |
packages/sdk-python |
Python SDK | Python |
packages/sdk-typescript |
TypeScript SDK | TypeScript |
packages/sdk-go |
Go SDK | Go |
- Python: Enforced by Ruff with strict settings. Run
make formatbefore committing. - TypeScript: Enforced by Prettier and TypeScript strict mode.
- Go: Standard
gofmt.
Key conventions:
- Type annotations on all public functions (Python)
- No
# type: ignorewithout an explanation comment - Security-sensitive code must have explicit test coverage
- Custom rules in YAML DSL should include a
reasonfield
Security tests live in packages/core/tests/security/. When adding a new detection rule or modifying the security pipeline, you must add corresponding tests.
Test categories:
test_attack_samples.py— Tests against real-world attack payloads (JSONL format)test_bypass_attempts.py— Tests for known bypass techniquestest_encoding_bypass.py— Unicode, base64, and other encoding attackstest_header_forgery.py— Trust level spoofing via headerstest_trust_escalation.py— Privilege escalation attemptstest_combined_attacks.py— Multi-vector attack chainstest_fuzz.py— Fuzzing with random inputs
Attack samples are stored in tests/security/samples/ as JSONL files. Each line contains:
{"input": "the attack payload", "expected": "BLOCK", "category": "direct_injection"}- Add the rule logic in
packages/core/src/agentguard_core/engine/intent/rule_engine.py - Register it in
configs/builtin_rules.yaml - Add unit tests in
packages/core/tests/unit/test_rule_engine.py - Add security tests with attack samples that the rule should catch
- Update the rule count in documentation if applicable
- Create
packages/sdk-python/src/agentguard/integrations/your_framework.py - Export it from
packages/sdk-python/src/agentguard/integrations/__init__.py - Add tests in
packages/sdk-python/tests/test_integrations.py - Add an example in
examples/ - Update the SDK README
By contributing to AgentGuard, you agree that your contributions will be licensed under the Apache License 2.0.