Spaces:
Running
Running
File size: 1,187 Bytes
988a157 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # ============================================================
# app/models/agent_delegate.py — AIDA Delegate Model
# ============================================================
# Stores the "My Agent" mandate a user gives AIDA for a DM thread.
# One record per (conversation_id, user_id) pair.
# ============================================================
from datetime import datetime
class AgentDelegate:
COLLECTION = "aida_delegates"
@staticmethod
def create_document(
conversation_id: str,
user_id: str,
instruction: str,
) -> dict:
now = datetime.utcnow()
return {
"conversation_id": conversation_id,
"user_id": user_id,
"instruction": instruction, # the private mandate from the user
"active": True,
"turns_without_progress": 0,
# Snapshot of last numeric offer/price seen in agent output.
# Used by the progress-tracking logic to detect deadlock.
"last_offer_snapshot": None,
"created_at": now,
"updated_at": now,
}
|