agent_version.py 1.2 KB

123456789101112131415161718192021222324
  1. from datetime import datetime
  2. from sqlalchemy import DateTime, Integer, String, Text
  3. from sqlalchemy.dialects.sqlite import JSON
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. from core_db import AuditMixin, Base, TenantMixin, VersionMixin
  6. from core_shared import JSONValue
  7. class AgentVersion(TenantMixin, AuditMixin, VersionMixin, Base):
  8. __tablename__ = "agent_version"
  9. agent_id: Mapped[str] = mapped_column(String(36), index=True)
  10. version_no: Mapped[int] = mapped_column(Integer)
  11. status: Mapped[str] = mapped_column(String(32), default="draft", index=True)
  12. role: Mapped[str] = mapped_column(String(64), default="assistant")
  13. goal: Mapped[str | None] = mapped_column(Text, nullable=True)
  14. system_prompt: Mapped[str] = mapped_column(Text)
  15. model_config_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict)
  16. memory_policy_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict)
  17. tool_refs_json: Mapped[list[dict[str, JSONValue]]] = mapped_column(JSON, default=list)
  18. skill_refs_json: Mapped[list[dict[str, JSONValue]]] = mapped_column(JSON, default=list)
  19. published_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)