-
Notifications
You must be signed in to change notification settings - Fork 1
Layer 1: Identity and Trust
Crate: atp-identity | Tests: 31
Layer 1 provides cryptographic identity, time-decayed trust scoring, and Sybil resistance for agent networks.
Every agent gets a W3C DID (Decentralized Identifier) backed by an Ed25519 keypair:
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
Implementation:
-
DidGenerator— generatesdid:keyidentifiers from Ed25519 public keys -
KeyPair— Ed25519 key management (sign, verify, serialize) - Keys are generated using the
ed25519-dalekcrate with secure randomness
Usage via SDK:
let agent = atp_sdk::agent();
println!("{}", agent.did()); // "did:key:z6Mk..."
let sig = agent.sign(b"hello");
assert!(agent.verify(b"hello", &sig));Trust is computed as a weighted moving average with exponential time decay:
T(a) = Σ(qᵢ × w(τᵢ) × γ(taskᵢ)) / Σ(w(τᵢ) × γ(taskᵢ))
where:
qᵢ = quality score of interaction i (0.0 to 1.0)
w(τᵢ) = e^(-λ × Δdays) [time-decay weight]
λ = 0.01 per day [decay rate]
γ(task) = complexity weight for task type
Δdays = days since interaction
Properties:
- Recent interactions matter more (exponential decay)
- Complex tasks (coding γ=1.5) influence trust more than simple tasks (data γ=0.8)
- Bayesian prior of 0.5 for agents with no history
- Score range: 0.0 (untrusted) to 1.0 (fully trusted)
Complexity Weights:
| Task Type | γ weight |
|---|---|
| CodeGeneration | 1.5 |
| Analysis | 1.2 |
| CreativeWriting | 1.0 |
| DataProcessing | 0.8 |
Transitive Trust Dampening prevents agents from creating fake identities to boost their scores:
T_transitive(a→c) = T(a→b) × T(b→c) × α^depth
where:
α = 0.5 [dampening factor]
depth = number of hops in the trust chain
max = 5 hops
At each hop, trust is dampened by 50%. After 5 hops, transitive trust ≈ 3% of direct trust, making Sybil attacks economically infeasible.
The IdentityStore provides persistent storage for:
- Agent registrations (DID + public key)
- Interaction records (quality, timestamp, task type)
- Trust score caching and invalidation
pub struct TrustEngine {
pub fn new(lambda: f64, prior: f64) -> Self
pub fn compute_trust_score(
&self,
subject: AgentId,
task_type: TaskType,
records: &[InteractionRecord],
now: DateTime<Utc>,
) -> TrustScore
}
pub struct TrustScore {
pub score: f64, // 0.0 to 1.0
pub confidence: f64, // Based on sample count
pub sample_count: u32, // Number of interactions
}
pub struct InteractionRecord {
pub agent_id: AgentId,
pub quality: f64,
pub task_type: TaskType,
pub timestamp: DateTime<Utc>,
}Without trust scoring, any agent can claim to be excellent at any task. ATP's trust layer ensures:
- Accountability: Bad quality degrades trust over time
- Freshness: Trust reflects recent performance, not historical
- Sybil safety: Creating fake identities doesn't help
- Task specificity: An agent trusted for coding isn't automatically trusted for analysis
- Layer 2: Capability Handshake — How trusted agents negotiate
-
SDK API Reference —
agent(),sign(),trust()functions
ATP Wiki
Getting Started
Architecture
- Architecture Overview
- Layer 1: Identity and Trust
- Layer 2: Capability Handshake
- Layer 3: Context Compression
- Layer 4: Economic Routing
- Layer 5: Fault Tolerance
Reference
More