Overview
Theaudit sub-client provides a tamper-evident, append-only audit trail for all agent actions. Each entry is hash-chained to the previous entry, providing cryptographic integrity guarantees.
audit.log()
Log an agent action to the audit trail.Parameters
The agent that performed the action.
The grant under which the action was performed.
A descriptive action identifier (e.g.
'email.sent', 'payment.initiated', 'file.uploaded').Arbitrary metadata to attach to the audit entry.
Action outcome:
'success', 'failure', or 'blocked'.Response: AuditEntry
Unique audit entry identifier.
The agent that performed the action.
The agent’s decentralized identifier.
The associated grant ID.
The user who authorized the grant.
The action identifier.
Arbitrary metadata attached to the entry.
SHA-256 hash of this entry, used for chain integrity verification.
Hash of the previous entry in the chain.
null for the first entry.ISO 8601 timestamp when the action was logged.
Action outcome:
'success', 'failure', or 'blocked'.audit.list()
Query audit entries with optional filters.Parameters
Filter by agent ID.
Filter by grant ID.
Filter by principal (user) ID.
Filter by action identifier.
ISO 8601 start date for the query range.
ISO 8601 end date for the query range.
Page number (1-indexed).
Number of entries per page.
Response: ListAuditResponse
Array of audit entry objects.
Total number of entries matching the filters.
Current page number.
Number of entries per page.
audit.get()
Retrieve a single audit entry by its ID.Parameters
The audit entry ID to retrieve.
Response
Returns anAuditEntry object.
Chain integrity
Each audit entry contains ahash of its contents and a prevHash linking it to the previous entry. This creates a tamper-evident chain similar to a blockchain. If any entry is modified after the fact, the hash chain breaks.
Use the Compliance evidence pack to verify chain integrity programmatically: