Skip to main content

Reputation-gated authority resolver for AgentMesh. Composes trust scoring with delegation chains via monotonic narrowing.

Project description

agentmesh-reputation-gate

Reputation-gated authority resolver for AgentMesh. Implements the AuthorityResolver protocol from microsoft/agent-governance-toolkit#275.

Composes AgentMesh's TrustManager scoring (0-1000) with delegation chains via component-wise monotonic narrowing: effective authority is the intersection of delegated capabilities and trust-tier permissions.

Design proposal: PR #274 (merged into main)

How it works

Agent requests action
  -> delegation.verify()           # existing AgentMesh
  -> trust_manager.get_score()     # existing AgentMesh
  -> resolve_effective_authority()  # THIS PACKAGE
     capability scope = delegation ∩ tier_allowed
     spend limit = min(delegation, tier_cap)
  -> allow / allow_narrowed / deny / audit

Install

pip install agentmesh-reputation-gate

Quick start

from agentmesh_reputation_gate import (
    AuthorityResolver, DelegationInfo, TrustInfo, ActionRequest
)

resolver = AuthorityResolver()

decision = resolver.resolve(
    delegation=DelegationInfo(
        delegation_id="d1",
        delegator_id="alice",
        agent_id="bot-1",
        capabilities=["read:data", "write:reports", "financial:low"],
        spend_limit=500.0,
    ),
    trust=TrustInfo(agent_id="bot-1", score=450),  # Standard tier
    action=ActionRequest(agent_id="bot-1", action="read:data"),
)

print(decision.decision)          # Decision.ALLOW
print(decision.effective_scope)   # ('read:data', 'write:reports')  -- financial:low excluded
print(decision.effective_spend_limit)  # 100.0  -- tier caps at $100
print(decision.trust_tier)        # "standard"

AgentMesh protocol integration

For use with PolicyEngine.set_authority_resolver():

from agentmesh_reputation_gate import AuthorityResolver, AuthorityRequest

resolver = AuthorityResolver()

# Single-arg form matching AgentMesh protocol
request = AuthorityRequest(delegation=d, trust=t, action=a)
decision = resolver.resolve(request)

Both calling conventions produce identical results.

6 Invariants

Every resolution enforces these properties:

  1. No widening -- effective authority never exceeds delegated authority
  2. Trust monotonicity -- lower trust never increases effective authority
  3. Revocation precedence -- revoked delegations always deny
  4. Enforcement freshness -- uses current trust score, not cached
  5. Deterministic resolution -- same inputs produce same output
  6. Lineage bound -- child trust <= parent trust at delegation time

Decision types

Decision Meaning
allow Action permitted as requested
allow_narrowed Action permitted but parameters were capped
deny Action blocked by trust-tier or delegation limits
audit Action permitted but logged for review

Default tier map

Tier Score Capabilities Spend cap
Untrusted 0-199 read:own $0
Limited 200-399 read:*, write:own $10
Standard 400-599 read:*, write:shared, execute:bounded $100
Trusted 600-799 Above + financial:low, admin:observability $1,000
Privileged 800-1000 Above + admin:policy, admin:identity, financial:high Delegation limit

Custom tiers: pass your own list[TierDefinition] to AuthorityResolver(tiers=...).

Capability matching

  • read:data -- exact match only
  • read:* -- single-level wildcard (covers read:data, not read:data:sensitive)
  • read:** -- recursive wildcard (covers any depth)
  • admin:* does NOT imply read:* (no implicit inheritance)
  • Intersection always produces the narrower bound

Tests

PYTHONPATH=src python3 -m pytest tests/ -v

62 tests covering all 6 invariants, capability matching, tier resolution, wildcard intersection, agent identity checks, lineage bound enforcement, adversarial inputs, and AgentMesh protocol compatibility.

References

License

MIT

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

agentmesh_reputation_gate-0.2.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

agentmesh_reputation_gate-0.2.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file agentmesh_reputation_gate-0.2.0.tar.gz.

File metadata

File hashes

Hashes for agentmesh_reputation_gate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dec5fb86e86513de9ac4942fa21680a8910b7894d4b32db4b53a8b5a9aa3e5d7
MD5 6167bcc4a3ac96a1287e9bf4dd423f49
BLAKE2b-256 715e832ff52e448f185e6329c9c25b5d03c1c6c59e252e00731e5bc50a5b7428

See more details on using hashes here.

File details

Details for the file agentmesh_reputation_gate-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentmesh_reputation_gate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 530c1233d07b74a4fe7b0b78f2964b162b071d890bb58f76892f4f8fa7cf16d5
MD5 b42ae64c958b2c76d38196018ff34d49
BLAKE2b-256 20c815bccbe4b5121ce8002195ff823e7bd7da38583d16ea0f4fdd18a836a233

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