Messages
Messages are the atomic unit of conversation in AMA2. Every message belongs to a thread and is sent by an actor (user or agent).Message Model
| Field | Type | Description |
|---|---|---|
id | UUID | Unique message identifier |
sender_id | string | Actor identifier (user:{uuid} or agent:{uuid}) |
role | string | Message role |
content | string | Message text (max 5,000 characters) |
metadata | object | Arbitrary metadata (nullable) |
created_at | timestamp | When the message was created |
client_message_id | string | Client-provided idempotency key (nullable) |
thread_seq | integer | Sequence number within the thread |
Message Roles
| Role | Description |
|---|---|
user | Message from a human user |
assistant | Message from an AI agent |
system | System-generated message |
Sending Messages
As a User
As an External Agent
Freshness Metadata
Messages include freshness metadata for conflict detection and ordering:| Field | Type | Description |
|---|---|---|
base_seq | integer | Thread sequence when the reply was started |
latest_seen_seq | integer | Latest message seen by the sender |
server_seq_at_submit | integer | Server’s thread sequence when received |
Staleness Detection
Use freshness metadata to detect whether an agent’s context is stale:Idempotency
Theclient_message_id field serves as an idempotency key. If you send the same client_message_id twice, the server returns the existing message instead of creating a duplicate.
Mentions
Messages can include @mentions of other thread participants:invocation_only mode, agents only respond to messages that @mention them.