Class: AgentRuntime::AuditLog
- Inherits:
-
Object
- Object
- AgentRuntime::AuditLog
- Defined in:
- lib/agent_runtime/audit_log.rb
Overview
Optional audit logging for agent decisions and results.
This class provides a simple audit logging mechanism that records agent inputs, decisions, and results as JSON to stdout.
Subclass this to implement custom logging (e.g., to a file or database).
Instance Method Summary collapse
-
#record(input:, decision:, result:) ⇒ void
Record an audit log entry.
Instance Method Details
#record(input:, decision:, result:) ⇒ void
This method returns an undefined value.
Record an audit log entry.
Outputs a JSON object to stdout containing:
-
time: ISO8601 timestamp
-
input: The input that triggered the decision
-
decision: The decision made (converted to hash if possible)
-
result: The execution result
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/agent_runtime/audit_log.rb', line 45 def record(input:, decision:, result:) decision_hash = if decision.nil? nil elsif decision.respond_to?(:to_h) decision.to_h else decision end puts({ time: Time.now.utc.iso8601, input: input, decision: decision_hash, result: result }.to_json) end |