Skip to content

Latest commit

 

History

History
82 lines (64 loc) · 2.46 KB

CONTRIBUTING.md

File metadata and controls

82 lines (64 loc) · 2.46 KB

Contributing to AgentGuard

Thank you for your interest in contributing to AgentGuard! AgentGuard is a community-driven open-source project dedicated to securing autonomous AI agents and making LLM-driven development safe for everyone.


🛠️ Development Setup

  1. Clone the repository:

    git clone https://github.com/agentguard-ai/agentguard.git
    cd agentguard
  2. Create a virtual environment:

    python -m venv .venv
    # Windows:
    .venv\Scripts\activate
    # Linux / macOS:
    source .venv/bin/activate
  3. Install dependencies in editable mode:

    pip install -e ".[dev]"
  4. Run tests:

    pytest

🏗️ Architecture Overview

AgentGuard is structured into clean modular layers:

  • agentguard/config.py: Pydantic v2 schemas and validation for agentguard.yaml.
  • agentguard/engine/:
    • policy_engine.py: Master orchestrator coordinating all security layers.
    • filesystem.py: Path canonicalization, traversal defense, sensitive pattern matching.
    • shell_parser.py: AST tokenization, subshell restriction, pipeline inspection, dangerous command heuristics.
    • secret_redactor.py: Multi-pattern regex & entropy credential scrubber.
    • rate_limiter.py: Sliding window action count and byte throughput quotas.
    • approval_prompter.py: Rich TUI interactive Human-in-the-Loop approval modal.
  • agentguard/proxy/:
    • process_runner.py: Subprocess execution wrapper with environment scrubbing and live stream redaction.
    • mcp_gateway.py: Model Context Protocol (MCP) JSON-RPC stdio proxy.
  • agentguard/telemetry/:
    • logger.py: Structured JSONL and Rich terminal logger.
    • auditor.py: Aggregates session statistics and security reports.
  • agentguard/sdk.py: Programmatic Python SDK (Guard) and @guard.guard_tool decorator.

🧪 Testing Guidelines

  • All new features and rule additions must include unit tests under tests/.
  • Ensure 100% pass rate before submitting a pull request:
    pytest -v --tb=short
  • Check code formatting and style:
    ruff check .

📝 Pull Request Process

  1. Fork the repo and create your branch from main:
    git checkout -b feature/my-cool-defense
  2. Commit your changes with clear, descriptive commit messages.
  3. Push to your fork and submit a Pull Request to main.
  4. Ensure all CI checks pass.

Thank you for helping make AI agents safe and secure!