Skip to main content

Inter-Agent Collaboration Protocol (IACP) - A 5-layer protocol for AI agent synergies

Project description

IACP Protocol - Inter-Agent Collaboration Protocol

Python Version License: MIT CI PyPI Version Code Style: black

A 5-layer protocol enabling AI agents to synergize through long-term memory federation, self-improvement exchange, modality-native transport, and governance primitives.


๐ŸŽฏ Why IACP?

Existing agent protocols (A2A, MCP, ACP, ANP, AIP, ANX) force all communication through human-readable text, creating massive bottlenecks. IACP breaks this by enabling agents to share native modalities (embeddings, KV-cache, LoRA adapters) directly โ€” 100x more efficient for ML workloads.

Bottleneck Existing Protocols IACP
Embeddings (768-d) 300+ tokens text 3 KB binary
KV-cache transfer Not supported Native binary frames
LoRA adapter sharing Not supported Native safetensors frames
Skill versioning Manual Versioned diffs + benchmarks
Agent governance Ad-hoc Constitutional + fork/merge

โœจ Features

L1 โ€” Identity & Discovery

  • did:iacp DIDs with Ed25519 keys (W3C DID Core compliant)
  • Capability Manifests โ€” skills, modalities, compute profiles, reputation, governance rights
  • IBCT Tokens โ€” interoperable capability tokens (from AIP paper)

L2 โ€” Modality-Native Transport

  • Binary WebSocket frames โ€” not forced through text bottleneck
  • Frame types: EMBEDDINGS, KV_CACHE, LORA_ADAPTER, ACTIVATIONS, TEXT, CAPABILITY_NEGOTIATION
  • Resource quotas โ€” token bucket + sliding window rate limiting
  • Capability negotiation โ€” agents declare supported modalities

L3 โ€” Memory Federation

  • CRDT sync โ€” Yjs/Automerge compatible, eventual consistency
  • Merkle DAG (CIDv1) โ€” immutable, content-addressed, deduplicated
  • Provenance chains โ€” creator, tools, confidence, tags, derivation method
  • Capability-based access control โ€” read/write/admin per agent
  • Sync protocols โ€” incremental, bloom filter, vector clock

L4 โ€” Self-Improvement Exchange

  • Skill diffs โ€” unified patches + benchmark results
  • Benchmark suites โ€” 3ร— runs, median aggregation, regression detection
  • ZK-attestation ready โ€” verifiable skill improvements

L5 โ€” Governance & Coordination

  • Propose/Vote/Veto/Dissent/Fork/Merge โ€” full democratic primitives
  • Agent Constitution โ€” Asimov principles + IACP principles
  • EigenTrust reputation โ€” weighted transitive trust
  • Quorum/Threshold/Veto โ€” configurable governance parameters

๐Ÿ“ฆ Installation

# From GitHub
pip install git+https://github.com/bigstar-gh/HRMS.git

# Or locally
git clone https://github.com/bigstar-gh/HRMS.git
cd HRMS
pip install -e .

Requirements: Python 3.10+


๐Ÿš€ Quick Start

from iacp import (
    generate_agent_did, CapabilityManifest, SkillInfo, ModalityInfo,
    TransportLayer, TransportConfig,
    MemoryStore, MemoryChunk, ContentRef, Provenance,
    SkillDiff, generate_skill_diff, ImprovementType,
    GovernanceProposal, ProposalKind, VoteOption,
)

# 1. Create agent identity
did, keypair = generate_agent_did()
print(f"Agent DID: {did.did}")

# 2. Create capability manifest
manifest = CapabilityManifest(did=did.did, name="My Agent")
manifest.add_skill(SkillInfo(name="systematic-debugging", version="1.2.0", benchmark_score=0.9))
manifest.add_modality(ModalityInfo(type="embeddings", encoding="float32", dimensions=768))

# 3. Store memory with provenance
store = MemoryStore(local_did=did.did)
chunk = MemoryChunk(
    cid="",
    memory_type=MemoryType.SEMANTIC,
    content=ContentRef(
        cid="", size_bytes=1024, 
        modality=ContentModality.TEXT, 
        encoding=EncodingFormat.UTF8, 
        sha256="..."
    ),
    provenance=Provenance(
        creator_did=did.did, 
        created_at=time.time(), 
        source_session_id="session-1", 
        tools_used=["web_search"],
        confidence=0.95,
        tags=["debugging", "asyncio"]
    ),
)
chunk.cid = chunk.compute_cid()
await store.put_chunk(chunk)

# 4. Create skill improvement diff
skill_diff = generate_skill_diff(
    skill_id="async-debugging",
    old_skill={"version": "1.0", "steps": ["step1"]},
    new_skill={"version": "1.1", "steps": ["step1", "step2"]},
    improvement_type=ImprovementType.FEATURE,
    benchmarks=[{"task": "debug-test", "success_rate": 1.0, "median_turns": 8, "baseline_turns": 10}],
    author_did=did.did,
)

# 5. Governance proposal
proposal = GovernanceProposal(
    proposer_did=did.did,
    title="Adopt async-debugging v1.1",
    kind=ProposalKind.SKILL_ADOPTION,
    rationale="25% turn reduction on debugging tasks",
    payload={"skill_diff": skill_diff.to_dict(), "benchmarks": [...]},
    quorum=0.67, threshold=0.60,
    veto_holders=[other_agent_did],
)

๐Ÿค– Hermes Agent Integration

from iacp.integration.hermes_integration import create_iacp_hermes_agent

# Create autonomous IACP-enabled Hermes agent
agent = await create_iacp_hermes_agent("research-agent")

# Run self-improvement cycle (pattern analysis โ†’ gaps โ†’ skills โ†’ memory grooming โ†’ benchmarks)
results = await agent.run_self_improvement_cycle()
# Results: patterns, gaps, new skills, memory usage, benchmark regressions

# 5 cron jobs automatically created:
# - nightly-iacp-maintenance (02:00)
# - weekly-iacp-deep-dive (Sun 03:00)
# - iacp-memory-sync (every 15 min)
# - iacp-skill-exchange (every hour)
# - iacp-governance-check (every 30 min)

await agent.stop()

Cron jobs are defined in HermesIntegration.create_cron_jobs() and integrate with Hermes' cron system.


๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        IACP Stack                                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚    L1       โ”‚    L2       โ”‚    L3       โ”‚    L4       โ”‚   L5    โ”‚
โ”‚  Identity   โ”‚  Transport  โ”‚   Memory    โ”‚ Improvement โ”‚ Govern. โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ DID +       โ”‚ WebSocket   โ”‚ CRDT +      โ”‚ SkillDiff   โ”‚ Propose โ”‚
โ”‚ Manifests   โ”‚ + Frames    โ”‚ Merkle DAG  โ”‚ + Bench     โ”‚ Vote    โ”‚
โ”‚             โ”‚ (binary)    โ”‚ + Provenanceโ”‚             โ”‚ Veto    โ”‚
โ”‚             โ”‚             โ”‚             โ”‚             โ”‚ Fork    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ฌ Multi-Agent Demo

Run the 3-agent collaboration demo:

python examples/multi_agent_demo.py

Output:

โœ… Initialized 3 agents:
   - Research Agent (web-research, arxiv-search, synthesis)
   - Debugging Agent (systematic-debugging, python-debugpy, async-debugging)
   - Code Review Agent (requesting-code-review, security-review, style-review)

๐Ÿ”ฌ Debug agent created skill improvement: async-debugging v1.0โ†’v1.1
๐Ÿ“ฆ Created skill diff: 230 chars, 2 benchmarks
๐Ÿ“š Research agent stored memory chunk (tags: asyncio, debugging, patterns)
๐Ÿ—ณ๏ธ Governance Proposal: Adopt async-debugging v1.1.0 (Passed)
๐Ÿ”€ Fork/Merge protocol demonstrated

๐Ÿงช Testing

# Basic protocol tests
python tests/test_basic.py

# Integration tests (Hermes + IACP)
python -m pytest tests/test_integration.py -v

# Run multi-agent demo
python examples/multi_agent_demo.py

Expected output: All tests pass โœ…


๐Ÿ“ Project Structure

HRMS/
โ”œโ”€โ”€ src/iacp/
โ”‚   โ”œโ”€โ”€ identity/          # L1: DID, manifests, credentials
โ”‚   โ”œโ”€โ”€ transport/         # L2: WebSocket, frames, quotas
โ”‚   โ”œโ”€โ”€ memory/            # L3: CRDT, Merkle DAG, sync
โ”‚   โ”œโ”€โ”€ improvement/       # L4: Skill diffs, benchmarks
โ”‚   โ”œโ”€โ”€ governance/        # L5: Proposals, voting, reputation
โ”‚   โ””โ”€โ”€ integration/       # Hermes Agent integration
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ demo.py            # Basic protocol demo
โ”‚   โ””โ”€โ”€ multi_agent_demo.py # 3-agent collaboration
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_basic.py      # Core protocol tests
โ”‚   โ””โ”€โ”€ test_integration.py # Hermes + IACP integration
โ”œโ”€โ”€ .github/workflows/ci.yml # GitHub Actions CI
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

๐Ÿ“‹ Protocol Specification

Full protocol specification available in the Hermes Agent skill:

cat ~/.hermes/skills/autonomous-ai-agents/iacp-protocol/SKILL.md

Includes:

  • JSON schemas for all message types
  • 4-phase 26-week implementation roadmap
  • Integration patterns for MCP/A2A/ACP/ANP/AIP/ANX
  • Security/privacy threat model
  • CID format specification (multicodec 0x0129 + multihash 0x1220)

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Run tests: python -m pytest tests/
  4. Run linting: black src/ tests/ && isort src/ tests/ && ruff check src/
  5. Commit: git commit -m 'feat: add amazing feature'
  6. Push: git push origin feature/amazing-feature
  7. Open Pull Request

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.


๐Ÿ™ Acknowledgments

  • Nous Research โ€” Hermes Agent framework
  • W3C DID Working Group โ€” Decentralized Identifiers
  • IPFS/IPLD โ€” Content addressing and Merkle DAG
  • Yjs/Automerge โ€” CRDT implementations
  • EigenTrust โ€” Reputation algorithm

Built for the agent ecosystem โ€” enabling AI agents to collaborate, improve, and govern themselves at scale. ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iacp_protocol-0.1.0.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iacp_protocol-0.1.0-py3-none-any.whl (83.8 kB view details)

Uploaded Python 3

File details

Details for the file iacp_protocol-0.1.0.tar.gz.

File metadata

  • Download URL: iacp_protocol-0.1.0.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for iacp_protocol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 171c9ed7064e02c03873b5d036137b9676a40001b24859065e956c8ef6161228
MD5 07a399c9d24c1c07039e738a8f77c3ca
BLAKE2b-256 b94f7b24c70ab934c5a203eb9c1f94d1bd7ff6b3ac22915efe84476dfacb71f9

See more details on using hashes here.

File details

Details for the file iacp_protocol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iacp_protocol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 83.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for iacp_protocol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ad15d063c79b1b12953cd5c79649382b2ccab54ca8a446ae8b53afcc78beda
MD5 1eaa556ca313adce51b18a7dde9048d6
BLAKE2b-256 7b1964f66397e819f8c5403e796bb35e608a8c9ac89218a20f8d3aaa094bd7d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page