Skip to main content

Module agent_registry

Module agent_registry 

Source
Expand description

First-class agent identities: registry + lifecycle (GL #433, H3 Epic D).

An agent stops being an anonymous process with a role config and becomes a registered identity: stable agent_id, mandatory human owner (accountability principle — orphaned agents are the security hole of the agent era), lifecycle state, best-effort attestation and a SPIFFE-compatible identity string for workload-IAM integration.

Storage: <data_dir>/agents/registry.json, advisory-file-locked like the audit trail (multiple concurrent agent processes are LeanCTX’s normal operating mode). Every lifecycle transition writes a tamper-evident audit entry (OCP Part 4, additive event types).

Structs§

AgentRecord
Attestation
IdentityCheck
Outcome of an identity check on a call path (team server middleware, enforce mode).

Enums§

AgentStatus

Functions§

attest
Best-effort attestation: hash the running binary and the role file. Detects drift; does NOT stop a determined attacker who controls the host (documented in docs/enterprise/agent-identity.md).
check
Identity check for enforce paths (team-server middleware): registered AND active. Unregistered agents are reported (monitor mode logs, enforce mode rejects — the caller decides).
decommission
Decommission closes the identity with a final audit entry; the record stays in the registry (auditability) but can never act again.
get
heartbeat
Heartbeat: liveness + re-attestation. Returns drift against the registration-time attestation, if any.
list
Read-only registry snapshot.
register
Register a new agent identity. The role must exist; the owner is mandatory (accountability). Creating an identity also provisions its Ed25519 keypair.
resume
spiffe_id
SPIFFE-compatible workload identity: spiffe://<trust_domain>/agent/<role>/<agent_id>.
suspend
suspend_agents_for_owner
Owner offboarding (SCIM active=false hook, GL #399): suspend every active agent owned by owner. Returns the suspended agent ids.