Skip to content

pingu-73/protomesh

Repository files navigation

ProtoMesh

Cross-framework orchestration for AI agents.

ProtoMesh is a middleware for orchestrating multi-agent systems, enabling seamless integration between frameworks like LangGraph and CrewAI with shared state, optimistic locking, and policy-based governance.

Features

  • Shared State Fabric: In-memory store with optimistic concurrency control (versioning).
  • Governance Engine: Pre-execution hooks for policies (e.g., AllowLists).
  • Adapters: Native integration for LangGraph (Nodes) and CrewAI (Tools).
  • Observability: JSON-based event tracing.

Installation

Requires Python 3.12+.

# Using uv (recommended)
uv venv
source .venv/bin/activate
uv pip install -e .

Usage

Core Concepts

from protomesh.core.mesh import ProtoMesh
from protomesh.core.governance import AllowListPolicy

# Initialize Mesh
mesh = ProtoMesh()

# Add Governance Policy
policy = AllowListPolicy(name="SecureWrite", allowed_actions=["write"])
mesh.governance.register_policy(policy)

# Write State (with tracing and policy check)
mesh.write("key1", {"status": "active"}, agent_id="agent-007")

# Read State
entity = mesh.read("key1")
print(entity.data)

Running the Demo

A full example integrating CrewAI and LangGraph is available in protomesh/examples/demo_workflow.py.

Requires GOOGLE_API_KEY for Gemini/ or you can modify it for other LLMs in protomesh/examples/demo_workflow.py as it uses LiteLLM.

export GOOGLE_API_KEY=your_key_here
python protomesh/examples/demo_workflow.py

Execution Flow (demo_workflow.py)

sequenceDiagram
    participant User
    participant CrewAI
    participant ProtoMesh
    participant LangGraph

    User->>CrewAI: Kickoff researcher task
    CrewAI->>ProtoMesh: write("research_topic", {...})
    ProtoMesh->>ProtoMesh: Check AllowListPolicy
    ProtoMesh->>ProtoMesh: Increment version (v1)
    ProtoMesh->>ProtoMesh: Emit trace: state_update
    CrewAI-->>User: Task complete
    User->>LangGraph: Invoke workflow
    LangGraph->>ProtoMesh: read("research_topic")
    ProtoMesh-->>LangGraph: Return entity (v1)
    LangGraph->>LangGraph: Summarize topic
    LangGraph-->>User: Final result
Loading

Testing

Run unit tests:

pytest tests/

About

Cross-framework orchestration for AI agents.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages