Recommended configuration, audit persistence, trust tuning, performance, and monitoring for production Attesta deployments
This guide covers everything you need to deploy Attesta in a production environment — from YAML configuration to audit log persistence, trust engine tuning, performance optimization, and monitoring.
Start with this production-ready configuration and adjust to your needs:
attesta.yaml
# ─────────────────────────────────────────────────────────# Attesta Production Configuration# ─────────────────────────────────────────────────────────policy: # Deny actions when the approval system is unavailable fail_mode: deny # Minimum review times prevent rubber-stamping minimum_review_seconds: low: 0 medium: 3 high: 10 critical: 30 # Multi-party approval for critical actions require_multi_party: critical: 2 # Timeout for pending approvals (5 minutes) timeout_seconds: 300 # Safety: CRITICAL actions are NEVER downgraded by trust critical_always_verify: true# ─────────────────────────────────────────────────────────# Risk scoring# ─────────────────────────────────────────────────────────risk: # Explicit overrides for known dangerous actions overrides: delete_production_database: critical drop_table: critical transfer_funds: critical deploy_to_production: high modify_permissions: high send_bulk_email: high # Patterns that amplify risk amplifiers: - pattern: "production" target: "any" boost: 0.3 - pattern: "pii|phi|ssn|credit_card" target: "args" boost: 0.4# ─────────────────────────────────────────────────────────# Trust engine# ─────────────────────────────────────────────────────────trust: initial_score: 0.3 ceiling: 0.85 decay_rate: 0.01 influence: 0.25# ─────────────────────────────────────────────────────────# Audit trail# ─────────────────────────────────────────────────────────audit: backend: legacy # or "trailproof" for enhanced features path: /var/log/attesta/audit.jsonl# ─────────────────────────────────────────────────────────# Domain profile (optional)# ─────────────────────────────────────────────────────────# domain: my-domain# domain:# - profile-a# - profile-b
Use Attesta.from_config("attesta.yaml") to load this configuration. The rich format (with policy:, risk:, trust: sections) automatically initializes the trust engine, domain scorer, audit logger, and terminal renderer.
When using copytruncate, the hash chain resumes correctly because the audit logger reads the last entry’s hash on startup. However, the chain integrity check (verify_chain() or verify()) should be run on each rotated file individually.
For enhanced audit features like HMAC signing and multi-tenancy, consider using the TrailProof backend. See the TrailProof Integration Guide for details.
CREATE TABLE attesta_audit ( entry_id TEXT PRIMARY KEY, chain_hash TEXT NOT NULL, action_name TEXT NOT NULL, agent_id TEXT DEFAULT '', risk_score REAL NOT NULL, risk_level TEXT NOT NULL, challenge_type TEXT DEFAULT '', challenge_passed BOOLEAN, verdict TEXT NOT NULL, review_duration_seconds REAL DEFAULT 0, environment TEXT DEFAULT '', intercepted_at TIMESTAMPTZ, decided_at TIMESTAMPTZ, metadata JSONB DEFAULT '{}', created_at TIMESTAMPTZ DEFAULT NOW());CREATE INDEX idx_audit_agent ON attesta_audit(agent_id);CREATE INDEX idx_audit_verdict ON attesta_audit(verdict);CREATE INDEX idx_audit_risk_level ON attesta_audit(risk_level);CREATE INDEX idx_audit_created ON attesta_audit(created_at);
Enable S3 Object Lock in compliance mode to make audit entries truly immutable. This satisfies SOC-2, HIPAA, and PCI-DSS requirements for tamper-proof audit trails.
# View trust profile for an agentattesta trust show --agent deploy-bot# List all agent trust profilesattesta trust list# Revoke trust after an incidentattesta trust revoke --agent compromised-bot
Programmatically:
from attesta.core.trust import TrustEnginefrom pathlib import Pathengine = TrustEngine(storage_path=Path(".attesta/trust.json"))# Check trustscore = engine.compute_trust("deploy-bot", domain="my-infra")print(f"Trust score: {score:.2f}")# Record an incident (drops trust significantly)engine.record_incident( agent_id="deploy-bot", action_name="unauthorized_access", severity="high",)# Emergency revocationengine.revoke("compromised-bot")
The trust engine has a critical safety invariant: CRITICAL-level actions are never downgraded by trust, regardless of how trusted the agent is. This ensures that the most dangerous actions always require full verification.
The DefaultRiskScorer is fast (sub-millisecond) and suitable for high-throughput environments. Custom scorers that involve I/O (database lookups, ML model inference) add latency.
Scorer Type
Typical Latency
Recommendation
DefaultRiskScorer
< 1ms
No optimization needed
Rule-based custom
1-5ms
No optimization needed
ML model inference
10-100ms
Cache predictions, use CompositeRiskScorer as fallback
The built-in audit logger provides a method to find suspiciously fast approvals:
from attesta.core.audit import AuditLoggerlogger = AuditLogger(path="/var/log/attesta/audit.jsonl")# Find approvals that were too fast for their risk levelstamps = logger.find_rubber_stamps( max_review_seconds=5.0, min_risk="high",)if stamps: print(f"Found {len(stamps)} potential rubber stamps:") for entry in stamps: print( f" {entry.action_name} by {entry.agent_id} " f"({entry.review_duration_seconds:.1f}s, " f"risk={entry.risk_level})" )