30 lines
723 B
Python
30 lines
723 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from datetime import datetime, timezone
|
||
|
|
from typing import Any, Literal
|
||
|
|
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
AgentMessageType = Literal[
|
||
|
|
"task_request",
|
||
|
|
"task_update",
|
||
|
|
"handoff",
|
||
|
|
"verification_request",
|
||
|
|
"verification_feedback",
|
||
|
|
"interrupt_notice",
|
||
|
|
]
|
||
|
|
|
||
|
|
|
||
|
|
class AgentMessage(BaseModel):
|
||
|
|
message_id: str
|
||
|
|
thread_id: str
|
||
|
|
from_agent_id: str
|
||
|
|
to_agent_id: str
|
||
|
|
task_id: str | None = None
|
||
|
|
reply_to_message_id: str | None = None
|
||
|
|
message_type: AgentMessageType = "task_update"
|
||
|
|
content_summary: str
|
||
|
|
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
||
|
|
payload: dict[str, Any] = Field(default_factory=dict)
|