Thank you for considering contributing to AgentGuard Python SDK!
- Python 3.8 or higher
- pip or poetry
- Git
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/agentguard-python.git cd agentguard-python -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -e ".[dev]" -
Run tests
pytest
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test improvements
- Write clear, concise code
- Follow PEP 8 style guidelines
- Add type hints to all functions
- Add tests for new functionality
- Update documentation as needed
# Format code
black src tests
isort src tests
# Run linter
ruff check src tests
# Run type checker
mypy src
# Run tests
pytest
# Run tests with coverage
pytest --cov=agentguard --cov-report=htmlWe follow Conventional Commits:
git commit -m "feat: add new policy validation feature"
git commit -m "fix: resolve timeout issue in execute_tool"
git commit -m "docs: update API reference for PolicyBuilder"Commit message format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Test additions or changeschore:- Build process or auxiliary tool changes
git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
- Place tests in
tests/directory - Use descriptive test names
- Test both success and failure cases
- Aim for high code coverage (>80%)
Example test structure:
import pytest
from agentguard import AgentGuard
def test_client_initialization():
"""Test that client initializes correctly."""
guard = AgentGuard(
api_key="test-key",
ssa_url="http://localhost:3000"
)
assert guard.api_key == "test-key"
assert guard.ssa_url == "http://localhost:3000"
@pytest.mark.asyncio
async def test_async_execution():
"""Test async tool execution."""
guard = AgentGuard(
api_key="test-key",
ssa_url="http://localhost:3000"
)
# Test implementation
pass# Run all tests
pytest
# Run specific test file
pytest tests/test_client.py
# Run with coverage
pytest --cov=agentguard --cov-report=html
# Run with verbose output
pytest -v- Add docstrings to all public functions and classes
- Use Google-style docstrings
- Include parameter descriptions and return types
- Provide usage examples
def execute_tool(
self,
tool_name: str,
parameters: Dict[str, Any],
context: ExecutionContext,
) -> ExecutionResult:
"""Execute a tool with security evaluation.
Args:
tool_name: Name of the tool to execute
parameters: Tool parameters as a dictionary
context: Execution context with session info
Returns:
ExecutionResult containing data and security decision
Raises:
AgentGuardError: If validation or execution fails
Example:
>>> guard = AgentGuard(api_key="key", ssa_url="http://localhost:3000")
>>> result = guard.execute_tool_sync(
... "web-search",
... {"query": "AI security"},
... {"session_id": "123"}
... )
"""
pass- Keep examples up-to-date
- Add new features to the feature list
- Update API reference for new methods
- Follow PEP 8
- Use type hints for all functions
- Maximum line length: 100 characters
- Use meaningful variable names
We use Black for code formatting:
black src testsWe use isort for import sorting:
isort src testsWe use Ruff for linting:
ruff check src tests- Check if the bug has already been reported
- Try to reproduce with the latest version
- Gather relevant information
Use the bug report template when creating an issue.
- Check if the feature has already been requested
- Consider if it fits the project's scope
- Think about how it would work
Use the feature request template when creating an issue.
- Correctness - Does the code work as intended?
- Tests - Are there adequate tests?
- Documentation - Is the code well-documented?
- Style - Does it follow our style guidelines?
- Performance - Are there any performance concerns?
- Security - Are there any security implications?
- Initial review: Within 2-3 business days
- Follow-up reviews: Within 1-2 business days
- Merge: After approval from at least one maintainer
We are committed to providing a welcoming and inspiring community for all.
Positive behavior includes:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Unacceptable behavior includes:
- Harassment, trolling, or discriminatory comments
- Publishing others' private information
- Other conduct which could reasonably be considered inappropriate
Violations may result in:
- Warning
- Temporary ban
- Permanent ban
Report violations to: agentguard@proton.me
Contributors will be:
- Listed in our Contributors page
- Mentioned in release notes for significant contributions
- Invited to our contributors community
- Questions? Open a Discussion
- Bug? Open an Issue
- Security? Email agentguard@proton.me
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to AgentGuard Python SDK! 🎉