Records every action taken by a digital employee.
| 11 | |
| 12 | |
| 13 | class AgentActivityLog(Base): |
| 14 | """Records every action taken by a digital employee.""" |
| 15 | |
| 16 | __tablename__ = "agent_activity_logs" |
| 17 | |
| 18 | id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) |
| 19 | agent_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("agents.id"), nullable=False, index=True) |
| 20 | action_type: Mapped[str] = mapped_column( |
| 21 | Enum( |
| 22 | "chat_reply", "tool_call", "feishu_msg_sent", "agent_msg_sent", |
| 23 | "web_msg_sent", "task_created", "task_updated", "file_written", "error", |
| 24 | "schedule_run", "heartbeat", "plaza_post", |
| 25 | name="activity_action_enum", |
| 26 | create_constraint=False, |
| 27 | ), |
| 28 | nullable=False, |
| 29 | ) |
| 30 | summary: Mapped[str] = mapped_column(String(500), nullable=False) |
| 31 | detail_json: Mapped[dict | None] = mapped_column(JSON, default=None) |
| 32 | related_id: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True)) |
| 33 | created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True) |
| 34 | |
| 35 | class DailyTokenUsage(Base): |
| 36 | """Rolled up token consumption per agent per day for time-series analytics.""" |
no outgoing calls
no test coverage detected