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
string
required
The agent that performed the action.
string
required
The decentralized identifier of the agent that performed the action.
string
required
The grant under which the action was performed.
string
required
The principal on whose behalf the action was performed.
string
required
A descriptive action identifier (e.g.
'email.sent', 'payment.initiated', 'file.uploaded').Record<string, unknown>
Arbitrary metadata to attach to the audit entry.
string
Action outcome:
'success', 'failure', or 'blocked'.Response: AuditEntry
string
Unique audit entry identifier.
string
The agent that performed the action.
string
The agent’s decentralized identifier.
string
The associated grant ID.
string
The user who authorized the grant.
string
The action identifier.
Record<string, unknown>
Arbitrary metadata attached to the entry.
string
SHA-256 hash of this entry, used for chain integrity verification.
string | null
Hash of the previous entry in the chain.
null for the first entry.string
ISO 8601 timestamp when the action was logged.
string
Action outcome:
'success', 'failure', or 'blocked'.audit.list()
Query audit entries with optional filters.Parameters
string
Filter by agent ID.
string
Filter by grant ID.
string
Filter by principal (user) ID.
string
Filter by action identifier.
string
ISO 8601 start date for the query range.
string
ISO 8601 end date for the query range.
number
Page number (1-indexed).
number
Number of entries per page.
Response: ListAuditResponse
AuditEntry[]
Array of audit entry objects.
number
Total number of entries matching the filters.
number
Current page number.
number
Number of entries per page.
audit.get()
Retrieve a single audit entry by its ID.Parameters
string
required
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: