Skip to main content

Constitutional Swarm Mesh — orchestrator-free multi-agent governance via embedded Agent DNA

Project description

constitutional-swarm

PyPI Python License: AGPL-3.0

Orchestrator-free multi-agent governance.

constitutional-swarm packages the core swarm patterns for governed multi-agent systems: embedded agent DNA validation, task-DAG coordination, peer-validated mesh consensus, and manifold-constrained trust propagation.

Installation

constitutional-swarm supports Python 3.11+.

pip install constitutional-swarm
pip install constitutional-swarm[bittensor]

Quick Start

Agent DNA

from constitutional_swarm import AgentDNA

dna = AgentDNA.default(agent_id="agent-1")
result = dna.validate("deploy to production")

print(result.valid, result.constitutional_hash)

Stigmergic Task DAGs

from constitutional_swarm import TaskDAG, TaskNode

dag = TaskDAG(goal="Build governed AI system")
dag = dag.add_node(
    TaskNode(
        node_id="research",
        title="Research requirements",
        domain="research",
        required_capabilities=("research",),
    )
)
dag = dag.add_node(
    TaskNode(
        node_id="implement",
        title="Implement core",
        domain="engineering",
        depends_on=("research",),
        required_capabilities=("coding",),
    )
)

dag = dag.mark_ready()
assert dag.nodes["research"].status.value == "ready"

dag = dag.claim_node("research", agent_id="agent-1")
dag = dag.complete_node("research", artifact_id="spec-001")
dag = dag.mark_ready()
assert dag.nodes["implement"].status.value == "ready"

Constitutional Mesh Validation

from acgs_lite import Constitution
from constitutional_swarm import ConstitutionalMesh

mesh = ConstitutionalMesh(Constitution.default(), peers_per_validation=3, quorum=2)
mesh.register_agent("agent-1", domain="platform")
mesh.register_agent("agent-2", domain="security")
mesh.register_agent("agent-3", domain="compliance")
mesh.register_agent("agent-4", domain="operations")

assignment = mesh.request_validation(
    producer_id="agent-1",
    content="deploy payment module",
    artifact_id="artifact-1",
)

mesh.validate_and_vote(assignment.assignment_id, "agent-2")
mesh.validate_and_vote(assignment.assignment_id, "agent-3")

result = mesh.get_result(assignment.assignment_id)
print(result.quorum_met, result.accepted, result.proof is not None)

Governance Manifold

from constitutional_swarm import GovernanceManifold

manifold = GovernanceManifold(num_agents=3)
manifold.update_trust(0, 1, 0.8)
manifold.update_trust(1, 2, 0.5)
projection = manifold.project()

print(projection.converged, projection.spectral_bound)

Key Features

  • Embedded AgentDNA validation with decorator support and halt/resume controls.
  • DAG-based task coordination through TaskDAG, TaskNode, and SwarmExecutor.
  • Peer-validated consensus and Merkle-style proof generation via ConstitutionalMesh.
  • Trust-matrix projection and composition through GovernanceManifold.
  • Supporting artifact, capability, contract, compiler, and benchmark primitives.

Testing

python -m pytest packages/constitutional_swarm/tests/ -v --import-mode=importlib
python -m pytest packages/constitutional_swarm/tests/ -m "not slow" -v --import-mode=importlib

License

AGPL-3.0-or-later. Commercial licensing is available; contact hello@acgs.ai.

Links

Constitutional Hash: 608508a9bd224290

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

constitutional_swarm-0.1.0.tar.gz (165.5 kB view details)

Uploaded Source

Built Distribution

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

constitutional_swarm-0.1.0-py3-none-any.whl (114.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for constitutional_swarm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa586809c60c69105bf76fe91d46e36a2004d50bbcc2f7a7ed73c5434637701a
MD5 4b6207462772108b7cfdb34a9f8ae121
BLAKE2b-256 6cd0959c7a12d40e5a3c4a90c89a9816540afa4948f4d5953c9d1b8660b05510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for constitutional_swarm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e347b8fe3a085a1c2158d5cc5b715a11f7bdb04e029f32b400ab49d71211ca
MD5 8688380f250016a9a755069e8333a16d
BLAKE2b-256 c9d31e80a207f8611bf123540ce732146d6523f3a5784e467a063fec11b3a5de

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