Contributing to AgentMesh

February 25, 2026 ยท View on GitHub

Thank you for your interest in contributing! AgentMesh is the secure nervous system for cloud-native agent ecosystems. This guide will help you get set up and make your first contribution.


Table of Contents


๐Ÿš€ Getting Started

Fork and Clone

# 1. Fork the repository on GitHub, then clone your fork
git clone https://github.com/<your-username>/agent-mesh.git
cd agent-mesh

# 2. Add upstream remote
git remote add upstream https://github.com/imran-siddique/agent-mesh.git

# 3. Install in development mode
pip install -e ".[dev]"

# 4. Run tests to verify your setup
python -m pytest

# 5. Install pre-commit hooks
pip install pre-commit
pre-commit install

# 6. Verify the CLI works
agentmesh --help

Pre-commit Hooks

This project uses pre-commit to enforce code quality on every commit. The hooks include:

  • Trailing whitespace and end-of-file fixes
  • YAML validation and merge conflict detection
  • Private key detection (security)
  • Ruff linting and formatting
  • mypy type checking (excludes tests)
  • pytest check on push

Hooks are configured in .pre-commit-config.yaml. After installing with pre-commit install, they run automatically on git commit.


๐Ÿ› ๏ธ Development Setup

Python Version

AgentMesh requires Python 3.11 or higher. We recommend using pyenv to manage Python versions:

pyenv install 3.12
pyenv local 3.12

Virtual Environment

Always use a virtual environment for development:

python -m venv .venv

# Linux/macOS
source .venv/bin/activate

# Windows
.venv\Scripts\activate

# Install all dev dependencies
pip install -e ".[dev]"

Optional Extras

Depending on what you're working on, install additional extras:

pip install -e ".[dev,server]"        # FastAPI server components
pip install -e ".[dev,storage]"       # Redis/SQLAlchemy storage backends
pip install -e ".[dev,observability]" # OpenTelemetry & Prometheus
pip install -e ".[dev,grpc]"          # gRPC transport
pip install -e ".[dev,agent-os]"      # Agent-OS/IATP integration
pip install -e ".[dev,all]"           # Everything

IDE Recommendations

  • VS Code with the Python, Ruff, and mypy extensions
  • PyCharm Professional with built-in type checking enabled
  • Enable format-on-save with Ruff for consistent formatting

๐Ÿ“ Code Style

Formatting and Linting

We use Ruff for linting and formatting, and mypy for type checking:

# Format code
ruff format .

# Lint (with auto-fix)
ruff check . --fix

# Type check
mypy src/

Rules

RuleDetails
Line length100 characters maximum
Target versionPython 3.11
Type hintsRequired on all function signatures
DocstringsRequired for all public modules, classes, and functions
Docstring styleGoogle style
Import orderEnforced by Ruff (I rule) โ€” stdlib โ†’ third-party โ†’ local

Type Hints

All function signatures must include type hints. Use from __future__ import annotations for modern syntax:

from __future__ import annotations

def verify_agent(
    agent_id: str,
    credentials: AgentCredentials,
    *,
    strict: bool = True,
) -> VerificationResult:
    """Verify an agent's identity and credentials.

    Args:
        agent_id: The unique identifier of the agent.
        credentials: The agent's cryptographic credentials.
        strict: If True, enforce strict verification rules.

    Returns:
        The verification result containing trust score and status.

    Raises:
        VerificationError: If the agent cannot be verified.
    """
    ...

Docstrings (Google Style)

class TrustBridge:
    """Bridge for cross-protocol trust verification.

    Manages trust relationships between agents using different
    identity protocols (SPIFFE, DID, X.509).

    Attributes:
        protocol: The primary protocol for this bridge.
        trust_anchors: Set of trusted root certificates.

    Example:
        >>> bridge = TrustBridge(protocol="spiffe")
        >>> result = bridge.verify(agent_id="spiffe://example/agent-1")
    """

๐Ÿ”€ Making Changes

Branch Naming

Create a branch from main using one of these prefixes:

PrefixUse For
feat/New features (e.g., feat/oidc-identity-provider)
fix/Bug fixes (e.g., fix/trust-score-overflow)
docs/Documentation changes (e.g., docs/api-reference)
test/Test additions/improvements (e.g., test/governance-edge-cases)
refactor/Code refactoring (e.g., refactor/identity-module)
security/Security changes (e.g., security/key-rotation-fix)
# Sync with upstream before branching
git fetch upstream
git checkout -b feat/my-feature upstream/main

Commit Messages

We follow Conventional Commits:

<type>(<scope>): <description>

[optional body]

[optional footer(s)]

Types: feat, fix, docs, test, refactor, security, chore, ci

Scopes (optional): identity, trust, governance, reward, cli, transport, storage

Examples:

feat(trust): add SPIFFE workload identity verification
fix(identity): handle expired certificates in rotation
docs: update architecture diagrams for L2 trust
test(governance): add OPA policy evaluation edge cases
security(identity): rotate default key algorithm to Ed25519

Pull Request Process

  1. Fork the repository and create your branch
  2. Make changes following the code style and design philosophy
  3. Write/update tests โ€” all new features need test coverage
  4. Run the full check suite:
    ruff format .
    ruff check .
    mypy src/
    python -m pytest
    
  5. Push your branch and open a Pull Request
  6. Fill out the PR description with:
    • What changed and why
    • How to test the changes
    • Related issue numbers (e.g., Closes #167)
  7. Address review feedback โ€” maintainers may request changes
  8. Merge โ€” a maintainer will merge once approved

Review Criteria

PRs are evaluated on:

  • Correctness and security implications
  • Test coverage for new/changed behavior
  • Adherence to the layer dependency guidelines
  • Type safety (mypy must pass with --strict)
  • Documentation for public APIs

๐Ÿงช Testing

Running Tests

# Run all tests
python -m pytest

# Run with verbose output
python -m pytest -v

# Run a specific test file
python -m pytest tests/test_identity.py -v

# Run a specific test
python -m pytest tests/test_trust.py::test_trust_score_calculation -v

# Run tests by marker
python -m pytest -m "not slow"          # Skip long-running tests
python -m pytest -m fuzz                # Fuzzing tests only
python -m pytest -m benchmark           # Benchmark tests only

# Run with coverage report
python -m pytest --cov=src/agentmesh --cov-report=html --cov-report=term-missing

# Run examples as smoke tests
python examples/mcp_secure_relay.py
python examples/a2a_customer_service.py

Writing Tests

  • Test file location: Place tests in tests/ at the repo root, mirroring the module structure
  • Naming convention: test_<module>.py for files, test_<behavior> for functions
  • Async tests: Use pytest-asyncio โ€” tests are auto-detected (asyncio_mode = "auto")
  • Property-based tests: Use Hypothesis for fuzzing (mark with @pytest.mark.fuzz)
import pytest
from agentmesh.identity import AgentIdentity

class TestAgentIdentity:
    """Tests for agent identity creation and verification."""

    def test_create_identity_with_valid_params(self) -> None:
        identity = AgentIdentity(name="test-agent", protocol="spiffe")
        assert identity.name == "test-agent"
        assert identity.agent_id is not None

    def test_create_identity_rejects_empty_name(self) -> None:
        with pytest.raises(ValueError, match="name"):
            AgentIdentity(name="", protocol="spiffe")

    @pytest.mark.asyncio
    async def test_async_credential_fetch(self) -> None:
        identity = AgentIdentity(name="async-agent", protocol="did")
        creds = await identity.fetch_credentials()
        assert creds.is_valid()

Coverage Requirements

  • Minimum coverage: 80% for new code
  • Critical paths (identity, trust, governance): aim for 90%+
  • Run python -m pytest --cov=src/agentmesh --cov-report=term-missing to identify uncovered lines

Test Markers

MarkerDescription
@pytest.mark.fuzzFuzzing tests with malformed inputs
@pytest.mark.benchmarkCrypto operation benchmarks
@pytest.mark.slowLong-running load tests (skip with -m "not slow")

๐Ÿ“‹ Issue Guidelines

Bug Reports

When filing a bug, include:

  1. AgentMesh version (agentmesh --version or pip show agentmesh-platform)
  2. Python version (python --version)
  3. Operating system
  4. Steps to reproduce โ€” minimal code snippet or CLI commands
  5. Expected behavior vs. actual behavior
  6. Full error traceback if applicable

Feature Requests

For feature requests, describe:

  1. Use case โ€” what problem does this solve?
  2. Proposed solution โ€” how should it work?
  3. Alternatives considered โ€” what else did you look at?
  4. Which layer does this belong to (L1โ€“L4)?

Good First Issues

New to the project? Look for issues labeled:

LabelDescription
good-first-issueSmall, well-defined tasks
documentationImprove docs and examples
needs-testsAdd test coverage

๐Ÿ—๏ธ Architecture Overview

Project Structure

agent-mesh/
โ”œโ”€โ”€ src/agentmesh/          # Main package
โ”‚   โ”œโ”€โ”€ identity/           # L1: Agent identity & credentials
โ”‚   โ”œโ”€โ”€ trust/              # L2: Trust protocols & bridges
โ”‚   โ”œโ”€โ”€ governance/         # L3: Policies, compliance & audit
โ”‚   โ”œโ”€โ”€ reward/             # L4: Reputation & learning
โ”‚   โ”œโ”€โ”€ cli/                # Command-line interface (Click)
โ”‚   โ”œโ”€โ”€ core/               # Shared core utilities
โ”‚   โ”œโ”€โ”€ events/             # Event bus and messaging
โ”‚   โ”œโ”€โ”€ integrations/       # Third-party integrations (LangChain, Django)
โ”‚   โ”œโ”€โ”€ marketplace/        # Agent marketplace
โ”‚   โ”œโ”€โ”€ observability/      # OpenTelemetry & Prometheus metrics
โ”‚   โ”œโ”€โ”€ sdk/                # Public SDK for consumers
โ”‚   โ”œโ”€โ”€ services/           # Backend service layer (FastAPI)
โ”‚   โ”œโ”€โ”€ storage/            # Storage backends (Redis, SQL)
โ”‚   โ”œโ”€โ”€ transport/          # gRPC & WebSocket transport
โ”‚   โ”œโ”€โ”€ dashboard/          # Dashboard rendering
โ”‚   โ”œโ”€โ”€ constants.py        # Shared constants
โ”‚   โ”œโ”€โ”€ exceptions.py       # Exception hierarchy
โ”‚   โ””โ”€โ”€ providers.py        # Dependency injection providers
โ”œโ”€โ”€ schemas/                # JSON schemas for validation
โ”œโ”€โ”€ proto/                  # Protocol buffer definitions
โ”œโ”€โ”€ services/               # Microservice definitions
โ”œโ”€โ”€ integrations/           # Integration packages
โ”œโ”€โ”€ sdks/                   # SDK packages
โ”œโ”€โ”€ examples/               # Working demos and tutorials
โ”œโ”€โ”€ docs/                   # Documentation
โ”œโ”€โ”€ tests/                  # Test suite (50+ test modules)
โ”œโ”€โ”€ charts/                 # Helm charts for Kubernetes
โ”œโ”€โ”€ dashboards/             # Grafana dashboards
โ”œโ”€โ”€ deployments/            # Deployment configurations
โ””โ”€โ”€ notebooks/              # Jupyter notebooks

Key Modules

ModulePurposeKey Abstractions
identityAgent IDs, credentials, key managementAgentIdentity, Credential, KeyStore
trustCross-protocol trust verificationTrustBridge, TrustScore, HandshakeProtocol
governancePolicy enforcement, audit trailsPolicy, AuditLog, ComplianceChecker
rewardReputation scoring, incentive learningRewardEngine, ReputationScore
transportNetwork communication (gRPC, WS)Transport, Channel, Message
storagePersistence (Redis, SQL)StorageBackend, AuditStore
eventsInternal event busEventBus, Event
observabilityMetrics and tracingTracer, MetricsExporter

Layer Dependency Rules

Layers follow strict dependency rules โ€” never depend upward:

LayerMay Depend OnFocus
L1: IdentityNothingAgent IDs, credentials
L2: TrustL1Protocol bridges, verification
L3: GovernanceL1, L2Policies, compliance, audit
L4: RewardL1, L2, L3Reputation, learning

๐ŸŽฏ Design Philosophy

"Zero-Trust by Default" โ€” Every agent interaction is verified, every action is audited.

We โœ… Want

  • Protocol-agnostic identity (SPIFFE, DID, X.509)
  • Cryptographic trust verification
  • Immutable audit trails (hash chain trees)
  • Compliance-first design (SOC2, HIPAA, EU AI Act)
  • Minimal attack surface
  • Agent-OS integration for IATP

We โŒ Avoid

  • Implicit trust between agents
  • Unaudited agent actions
  • Protocol-specific lock-in
  • Centralized identity authorities
  • Feature bloat

๐ŸŽ Integration Bounties

We're actively looking for integration contributions:

IntegrationDescriptionStatus
A2A ProtocolGoogle's Agent-to-Agent๐ŸŸข Complete
MCP ProtocolModel Context Protocol๐ŸŸข Complete
IATP ProtocolInter-Agent Trust Protocol๐ŸŸข Via agent-os
OpenID ConnectOIDC identity integration๐ŸŸก In Progress
SPIFFE/SPIREWorkload identity๐ŸŸก In Progress
KubernetesK8s service mesh integration๐Ÿ”ด Open

๐Ÿ”— Relationship with Agent-OS

AgentMesh is designed to work seamlessly with Agent-OS:

# Install with Agent-OS integration
pip install agentmesh-platform[agent-os]

# This enables IATP protocol support via Agent-OS nexus module

Division of Responsibility:

  • Agent-OS: Kernel architecture, verification (CMVK), trust protocol (IATP)
  • AgentMesh: Identity management, multi-protocol bridges, governance, audit

๐Ÿ’ฌ Getting Help


๐Ÿ“œ License

By contributing, you agree that your contributions will be licensed under the Apache-2.0 License.