Skip to main content

AgentMesh governance components for Haystack pipelines — policy enforcement, trust scoring, and tamper-evident audit trails

Project description

haystack-agentmesh

AgentMesh governance components for Haystack pipelines — policy enforcement, trust scoring, and tamper-evident audit trails.

Installation

pip install haystack-agentmesh

With Haystack:

pip install "haystack-agentmesh[haystack]"

Components

GovernancePolicyChecker

Enforces governance policies loaded from YAML files. Checks tool allowlists/blocklists, content patterns, token limits, and rate limits.

from haystack_agentmesh import GovernancePolicyChecker

checker = GovernancePolicyChecker(policy_path="policy.yaml")
result = checker.run(action="search", params={"query": "hello"}, agent_id="agent-1")
# {"decision": "allow", "reason": "All policy checks passed", "passed": True}

Policy YAML example:

allowed_tools:
  - search
  - summarize
blocked_tools:
  - delete_all
blocked_patterns:
  - pattern: "DROP TABLE"
    type: substring
  - pattern: "rm\\s+-rf"
    type: regex
max_tokens: 4096
rate_limit:
  max_calls: 10
  window_seconds: 60

TrustGate

Trust scoring with time-based decay and routing decisions.

from haystack_agentmesh import TrustGate

gate = TrustGate(pass_threshold=0.7, review_threshold=0.4)

gate.record_success("agent-1")
result = gate.run(agent_id="agent-1")
# {"trusted": False, "score": 0.55, "action": "review"}

Actions: pass (trusted), review (marginal), block (below threshold).

AuditLogger

Append-only audit log with SHA-256 hash chain hashing for tamper evidence.

from haystack_agentmesh import AuditLogger

logger = AuditLogger()
result = logger.run(action="search", agent_id="agent-1", decision="allow")
# {"entry_id": "a1b2c3d4e5f67890", "chain_hash": "sha256..."}

assert logger.verify_chain()  # Verify integrity
logger.export_jsonl("audit.jsonl")  # Export for analysis

Pipeline Example

from haystack import Pipeline
from haystack_agentmesh import GovernancePolicyChecker, TrustGate, AuditLogger

pipe = Pipeline()
pipe.add_component("trust_gate", TrustGate())
pipe.add_component("policy_checker", GovernancePolicyChecker(policy_path="policy.yaml"))
pipe.add_component("audit", AuditLogger())

Component Reference

Component Inputs Outputs
GovernancePolicyChecker action: str, params: dict, agent_id: Optional[str] decision: str, reason: str, passed: bool
TrustGate agent_id: str, min_score: Optional[float] trusted: bool, score: float, action: str
AuditLogger action: str, agent_id: str, decision: str, metadata: Optional[dict] entry_id: str, chain_hash: str

Development

pip install -e ".[dev]"
pytest tests/ -v

License

Apache-2.0

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

haystack_agentmesh-3.5.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

haystack_agentmesh-3.5.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file haystack_agentmesh-3.5.0.tar.gz.

File metadata

  • Download URL: haystack_agentmesh-3.5.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for haystack_agentmesh-3.5.0.tar.gz
Algorithm Hash digest
SHA256 2d840c779e132b47b6c962e341c3e66da9510ebc3d8685c75343eae382e2be4e
MD5 ef91a2f3f897a0d80778fe06262859aa
BLAKE2b-256 e2ba9989c834609ed6986a7910ee5f3e968dc0e9e1ead464cd097683bb118ff9

See more details on using hashes here.

File details

Details for the file haystack_agentmesh-3.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for haystack_agentmesh-3.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2089cf0824fab27cb68203db8a8f4fff5cbbe2f7e98124dc7e459eaa73d0de61
MD5 e44dd049cc4f681fcd89e6b78f7c31b9
BLAKE2b-256 c5b91db3597d907988aae763372d6e35f142d2c1285943a983cdfb8d772aeaad

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