Skip to main content

Complete Agent Trust Stack — one install for provenance, reputation, agreements, accountability, lifecycle, discovery, and economics

Project description

agent-trust-stack

License: Apache 2.0 Python 3.8+ PyPI

Complete institutional infrastructure for the autonomous agent economy.

One install gives you all seven trust protocols from the Theory of Agent Trust:

Protocol Package What It Does
Chain of Consciousness chain-of-consciousness Cryptographic provenance — tamper-evident operational history
Agent Rating Protocol agent-rating-protocol Reputation — multidimensional bilateral blind evaluation
Agent Justice Protocol agent-justice-protocol Accountability — forensics, disputes, actuarial risk
Agent Service Agreements agent-service-agreements Contracts — machine-readable agreements with quality verification
Agent Lifecycle Protocol agent-lifecycle-protocol Lifecycle — birth, fork, succession, death, reputation inheritance
Agent Matchmaking Protocol agent-matchmaking Discovery — cross-platform matching weighted by trust signals
Context Window Economics context-window-economics Economics — bilateral cost allocation for agent interactions

Quick Start

pip install agent-trust-stack
from agent_trust_stack import TrustStack

stack = TrustStack(agent_id="did:example:my-agent")
stack.coc.add("boot", "Agent initialized")
print(stack.status_summary())

CLI

# Initialize a trust stack
trust-stack init did:example:my-agent

# Check status
trust-stack status did:example:my-agent

# Run full trust verification
trust-stack verify did:example:my-agent --json

Full Integration Example

from agent_trust_stack import (
    TrustStack,
    RatingRecord,
    Agreement,
    UCPBuilder,
)
from agent_service_agreements import Identity, ServiceSpec
from agent_justice_protocol import AgentReference, IncidentReport

# 1. Initialize the stack
stack = TrustStack(agent_id="did:example:provider-1", storage_root="./my-stack")

# 2. Record provenance
stack.coc.add("boot", "Service provider online")
stack.coc.add("note", "Ready for work")

# 3. Get rated by a client
rating = RatingRecord(
    rater_id="did:example:client-1",
    ratee_id="did:example:provider-1",
    interaction_id="job-042",
    reliability=85,
    accuracy=90,
    latency=75,
    protocol_compliance=80,
    cost_efficiency=70,
)
stack.arp_store.append(rating)

# 4. Create a service agreement
agreement = Agreement(
    agreement_id="asa-042",
    status="active",
    client=Identity(agent_id="did:example:client-1"),
    provider=Identity(agent_id="did:example:provider-1"),
    service=ServiceSpec(
        service_type="research",
        description="Literature review on agent trust",
        input_spec={"query": "string"},
        output_spec={"report": "markdown"},
    ),
)
stack.asa_store.save(agreement)

# 5. Meter the interaction cost
cmr = stack.meter.record_interaction(
    responder_id="did:example:client-1",
    request_tokens=5000,
    response_tokens=3000,
)
print(f"Interaction cost: ${cmr.total_cost_usd:.4f}")

# 6. Build a capability profile for matchmaking
ucp = (
    UCPBuilder()
    .identity(amp_id="did:example:provider-1", coc_chain_id="./my-stack/coc")
    .add_capability(
        domain="research",
        subdomain="literature_review",
        description="Comprehensive literature reviews",
    )
    .availability(status="operational", uptime_percent=99.5)
    .build()
)

# 7. Cross-protocol: lifecycle change syncs to matchmaking
stack.bus.sync_lifecycle_to_matchmaking("did:example:provider-1", "active")

# 8. Cross-protocol: dispute outcome updates reputation
stack.bus.apply_dispute_outcome_to_reputation(
    dispute_id="dispute-001",
    at_fault_agent_id="did:example:provider-1",
    severity="minor",
    fault_percentage=25.0,
)

# 9. Run full trust verification across all protocols
report = stack.bus.run_full_trust_verification("did:example:provider-1")
print(f"Composite trust score: {report['composite_trust_score']}/100")

# 10. Verify chain integrity
result = stack.coc.verify()
print(f"Chain integrity: {'VALID' if result.valid else 'BROKEN'}")

Cross-Protocol Integration

The IntegrationBus wires feedback loops between protocols:

  • CoC -> ARP: Chain age provides trust tier signals for reputation context
  • ARP -> AJP: Anomalous ratings trigger investigation flags
  • AJP -> ARP: Dispute outcomes update reputation scores
  • ASA -> AMP: Completed agreements feed performance metrics for matchmaking
  • ALP -> AMP: Lifecycle state changes sync to availability status
  • CWEP -> ASA: Cost metering validates agreement budget compliance
  • ALP -> ARP: Fork/succession events trigger reputation inheritance

Architecture

                    TrustStack
                        |
        +-------+-------+-------+-------+-------+-------+
        |       |       |       |       |       |       |
       CoC     ARP     AJP     ASA     ALP     AMP    CWEP
    (prov)  (rep)   (just)  (agree) (life) (match) (econ)
        |       |       |       |       |       |       |
        +-------+---+---+-------+---+---+-------+-------+
                    |               |
              IntegrationBus   IntegrationBus
            (feedback loops)  (data flows)

API Reference

TrustStack

TrustStack(
    agent_id: str,              # Agent identifier
    storage_root: str = None,   # Storage directory (default: .trust-stack)
    model: str = "claude-sonnet-4-6",  # For CWEP metering
    provider: str = "anthropic",       # For CWEP metering
)

Attributes:

  • coc — Chain instance (provenance)
  • arp_store — RatingStore instance (reputation)
  • ajp_store — JusticeStore instance (accountability)
  • asa_store — AgreementStore instance (contracts)
  • alp_store — LifecycleStore instance (lifecycle)
  • amp_store — MatchmakingStore instance (discovery)
  • meter — Meter instance (cost metering)
  • bus — IntegrationBus instance (cross-protocol wiring)

Methods:

  • status() — Returns dict of ProtocolStatus for all seven protocols
  • status_summary() — Human-readable status string
  • verify_all() — Run verification across all protocols
  • add_chain_entry(event_type, data) — Convenience wrapper for CoC
  • get_chain_age_days() — Chain age in days
  • build_ucp() — Build a UCP pre-populated with agent identity

IntegrationBus

  • get_chain_age_trust_signal(agent_id) — CoC -> ARP trust signal
  • check_rating_anomaly(rating) — ARP -> AJP anomaly detection
  • apply_dispute_outcome_to_reputation(...) — AJP -> ARP reputation update
  • record_agreement_completion(...) — ASA -> AMP performance data
  • sync_lifecycle_to_matchmaking(...) — ALP -> AMP availability sync
  • check_cost_compliance(cmr, agreement) — CWEP -> ASA budget check
  • inherit_reputation_on_fork(...) — ALP -> ARP reputation inheritance
  • run_full_trust_verification(agent_id) — Cross-protocol trust report

Configuration

Each protocol stores data in its own subdirectory under the storage root:

.trust-stack/
  coc/      # Chain of Consciousness (JSONL chain)
  arp/      # Agent Rating Protocol (JSONL ratings)
  ajp/      # Agent Justice Protocol (disputes, investigations)
  asa/      # Agent Service Agreements (agreements)
  alp/      # Agent Lifecycle Protocol (agent records)
  amp/      # Agent Matchmaking Protocol (UCPs, matches)
  cwep/     # Context Window Economics (CMRs, settlements)

VAM-SEC Disclaimer

This software is provided for research and development purposes. It has not been independently audited for production security. Deployments handling real economic value should undergo professional security review. The protocols implement cryptographic integrity checking (SHA-256 hash chains) but do not provide encryption at rest. See vibeagentmaking.com for details.

License

Apache 2.0 — See LICENSE for details.

Links

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

agent_trust_stack-0.1.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

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

agent_trust_stack-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agent_trust_stack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0b1e14fbcec1eb202e249d75cfa58f0f5ec4a40a2484eef1151941b0eb5eb69
MD5 b77e9692bc94d0b726cb028fc29810b9
BLAKE2b-256 91c97677ff63eaba4ac7abed69a986dba0ef507597bd95cd7589fcdefa47ac20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agent_trust_stack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eee66b4d86a6c29c0b6941680e94e94a0eead7c59fc28d3b6d6ecbfb0e7de9dd
MD5 b5b80d7bf324ea15cc4dfbd22a3b7c7f
BLAKE2b-256 371e1c7e80ad00b0fdacfbb6588b030aa6589e05c3704362a0b3f9234da8b837

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