Files
defiQUG c052b07662
Some checks failed
Tests / test (3.10) (push) Has been cancelled
Tests / test (3.11) (push) Has been cancelled
Tests / test (3.12) (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / docker (push) Has been cancelled
Initial commit: add .gitignore and README
2026-02-09 21:51:42 -08:00

39 lines
1.1 KiB
Python

"""Audit log schemas for AGI governance."""
from datetime import datetime, timezone
from enum import Enum
from typing import Any
from pydantic import BaseModel, Field
def _utc_now() -> datetime:
return datetime.now(timezone.utc)
class AuditEventType(str, Enum):
"""Type of auditable event."""
DECISION = "decision"
TOOL_CALL = "tool_call"
DATA_SOURCE = "data_source"
STATE_CHANGE = "state_change"
TASK_SUBMIT = "task_submit"
TASK_COMPLETE = "task_complete"
OVERRIDE = "override"
POLICY_CHECK = "policy_check"
OTHER = "other"
class AuditEntry(BaseModel):
"""Single audit log entry: every material decision, tool call, source, outcome."""
entry_id: str = Field(..., min_length=1)
event_type: AuditEventType = Field(default=AuditEventType.OTHER)
actor: str = Field(default="", description="Agent or system component")
task_id: str | None = Field(default=None)
action: str = Field(default="")
payload: dict[str, Any] = Field(default_factory=dict)
outcome: str = Field(default="")
timestamp: datetime = Field(default_factory=_utc_now)