Skip to main content

Agent Protocol

Draft

This section is under construction.

Connection Handshake (Duplex v2)

The SimpleX agent manages the connection handshake, which establishes a bidirectional encrypted channel between two parties.

Step 1: Joiner → Contact Queue

Joiner sends AgentConnInfoReply (tag 'D', 0x44) containing:

  • Reply Queue addresses
  • Joiner's profile (ConnInfo)

Step 2: Initiator → Reply Queue

Initiator sends AgentConfirmation (tag 'C', 0x43) containing:

  • Agent version
  • E2E encryption parameters (X3DH keys)
  • Encrypted ConnInfo (Initiator's profile)

Step 3: Joiner → Reply Queue

Joiner sends AgentConfirmation (tag 'C') to confirm.

Step 4: HELLO Exchange

Both parties exchange HELLO messages (tag 'H', 0x48) to signal the connection is secured.

AgentMsgEnvelope Tags

TagHexNameContent
'C'0x43AgentConfirmationVersion + E2E params + ConnInfo
'M'0x4DAgentMessageAMessage header + body
'I'0x49AgentInvitationInvitation data

AMessage Tags (within AgentMessage)

TagHexNameContent
'I'0x49AgentConnInfoProfile only (no queues)
'D'0x44AgentConnInfoReplyReply queues + profile
'H'0x48HELLOEmpty — connection secured signal
'M'0x4DA_MSGChat message body
'A'0x41A_RCVDDelivery receipt

ClientMessage Format

After decrypting all encryption layers, the ClientMessage contains:

┌─────────────────┬────────────────────────────┐
│ PrivHeader │ Body (AgentMsgEnvelope) │
└─────────────────┴────────────────────────────┘

PrivHeader Values

ByteMeaning
0x00PHEmpty — No additional header
0x4B ('K')PHConfirmation — Contains Ed25519 auth key