pub struct Message {
pub id: String,
pub from: AgentId,
pub to: AgentId,
pub content: Content,
pub timestamp: DateTime<Utc>,
pub metadata: HashMap<String, Value>,
pub priority: u8,
}Expand description
Message between agents
Fields§
§id: StringUnique message ID
from: AgentIdSender agent ID
to: AgentIdRecipient agent ID
content: ContentMessage content
timestamp: DateTime<Utc>Message timestamp
metadata: HashMap<String, Value>Message metadata
priority: u8Message priority (0-255, higher = more urgent)
Implementations§
Source§impl Message
impl Message
Sourcepub fn system(to: AgentId, content: Content) -> Self
pub fn system(to: AgentId, content: Content) -> Self
Create a system message (from system to agent)
Sourcepub fn system_welcome(to: &AgentId) -> Self
pub fn system_welcome(to: &AgentId) -> Self
Create a system welcome message
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set message priority
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata
Sourcepub fn is_tool_call(&self) -> bool
pub fn is_tool_call(&self) -> bool
Check if message is a tool call
Sourcepub fn is_tool_result(&self) -> bool
pub fn is_tool_result(&self) -> bool
Check if message is a tool result
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more