The event log is the source of truth for all agent execution. It enables deterministic replay, auditability, and divergence detection.
pub struct Event {
pub id: EventId, // Unique: run_id:sequence
pub parent_id: Option<EventId>,
pub kind: EventKind,
pub timestamp: LogicalTime,
pub payload: EventPayload,
pub payload_hash: Hash,
pub state_hash_before: Option<Hash>,
pub state_hash_after: Option<Hash>,
}Events are identified by run_id:sequence:
run_id: Unique identifier for an execution run
sequence: Monotonically increasing counter starting at 0
Example: E(42:5) = 5th event of run 42
| Kind | Description | Payload Type |
|---|---|---|
AgentInit |
Agent initialized | AgentInitPayload |
StateTransition |
State changed | StateTransitionPayload |
ToolRequest |
Tool execution requested | ToolRequestPayload |
ToolResponse |
Tool response received | ToolResponsePayload |
CapabilityDenied |
Capability check failed | CapabilityDeniedPayload |
Observation |
Environment observation | ObservationPayload |
Decision |
Agent decision | DecisionPayload |
MemoryWrite |
Memory written | MemoryPayload |
MemoryRead |
Memory read | MemoryPayload |
PatchProposal |
Self-patch proposed | PatchPayload |
PatchApplied |
Patch applied | PatchPayload |
PatchRejected |
Patch rejected | PatchRejectedPayload |
Error |
Error occurred | ErrorPayload |
Snapshot |
Snapshot created | SnapshotPayload |
pub struct AgentInitPayload {
pub agent_type: String,
pub agent_version: String,
pub config: BTreeMap<String, String>,
}pub struct ToolRequestPayload {
pub tool_name: String,
pub tool_version: String,
pub request_hash: Hash,
pub capabilities: Vec<Capability>,
pub input: String, // JSON string for stability
}pub struct ToolResponsePayload {
pub tool_name: String,
pub request_hash: Hash,
pub response_hash: Hash,
pub output: String, // JSON string
pub success: bool,
pub error: Option<String>,
pub duration_ms: u64,
}- Sequence continuity: Events are numbered 0, 1, 2, ... without gaps
- Parent exists:
parent_idmust reference a valid earlier event - Hash validity:
payload_hashmust matchhash(payload) - Time monotonicity: Timestamps never decrease
- Detection: Event sequence mismatch or hash failure
- Recovery: Restore from last valid snapshot
- Prevention: Atomic appends, immediate verification
- Detection: Parent event ID not in index
- Recovery: Reject event, log error
- Prevention: Verify parent exists before append
- Detection:
payload_hash != hash(payload) - Recovery: Reject event, investigate tampering
- Prevention: Compute hash during creation