pub struct InterAgentMessage {
pub id: Uuid,
pub from_agent: String,
pub to_agent: String,
pub task: String,
pub payload: Value,
pub reply_to: Option<Uuid>,
pub ttl: Duration,
pub created_at_ms: i64,
}Expand description
A message exchanged between agents via the [AgentBus].
Each message has a unique ID, sender/recipient agent IDs, a task
description, and an arbitrary JSON payload. Messages can optionally
reference a parent message via reply_to for request/response patterns.
§TTL enforcement
Messages have a time-to-live. If undelivered within this duration,
they are dropped and logged at warn level.
Fields§
§id: UuidUnique message identifier.
from_agent: StringAgent ID of the sender.
to_agent: StringAgent ID of the recipient.
task: StringTask description or intent.
payload: ValueArbitrary JSON payload.
reply_to: Option<Uuid>If this is a reply, the ID of the original message.
ttl: DurationTime-to-live: message expires if undelivered within this duration.
created_at_ms: i64Timestamp when the message was created (milliseconds since epoch).
Implementations§
Source§impl InterAgentMessage
impl InterAgentMessage
Sourcepub fn new(
from_agent: impl Into<String>,
to_agent: impl Into<String>,
task: impl Into<String>,
payload: Value,
ttl: Duration,
) -> Self
pub fn new( from_agent: impl Into<String>, to_agent: impl Into<String>, task: impl Into<String>, payload: Value, ttl: Duration, ) -> Self
Create a new inter-agent message.
Sourcepub fn reply(
original: &InterAgentMessage,
payload: Value,
ttl: Duration,
) -> Self
pub fn reply( original: &InterAgentMessage, payload: Value, ttl: Duration, ) -> Self
Create a reply to an existing message.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check whether this message has expired based on its TTL.
Trait Implementations§
Source§impl Clone for InterAgentMessage
impl Clone for InterAgentMessage
Source§fn clone(&self) -> InterAgentMessage
fn clone(&self) -> InterAgentMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more