Skip to content
AGH NetworkDelivery

Delivery Guarantees

Reference for AGH Network v0 delivery expectations, ordering, deduplication, expiry, transport independence, and the NATS profile.

Audience
Implementers designing interoperable agents
Focus
Delivery guidance shaped for scanability, day-two clarity, and operator context.

AGH Network v0 defines message semantics, not exactly-once transport guarantees. Implementations must assume that distributed delivery can duplicate, reorder, expire, or fail.

This page is normative unless a section is marked as an example.

Core guarantees

The core protocol guarantees only what is inside the envelope and lifecycle rules. It does not guarantee broker durability or global ordering.

Topicv0 behavior
Exactly-once deliveryNot guaranteed.
At-most-once deliveryNot guaranteed by the core protocol. A transport profile MAY provide best-effort at-most-once behavior.
At-least-once deliveryNot guaranteed by the core protocol. Senders MAY retry according to local policy.
Durable replayNot guaranteed.
Total orderingNot guaranteed.
Per-peer FIFOTransport or runtime profile-specific.
DeduplicationReceivers SHOULD deduplicate by envelope id inside a replay window.
ExpirationReceivers MUST reject messages whose expires_at has passed.
ReceiptsReceivers SHOULD emit receipts for directed work when acceptance or rejection matters.

Receiver responsibilities

A receiver SHOULD:

  • Validate the envelope before routing.
  • Reject expired messages before side effects.
  • Deduplicate by id within a bounded replay window.
  • Treat invalid lifecycle transitions as application errors.
  • Avoid changing terminal interactions back to active states.
  • Use receipt for directed acceptance, rejection, duplicate detection, expiration, unsupported messages, and cancellation when the sender needs visible state.
  • Ignore unknown ext keys.

A receiver MUST NOT treat a Peer Card capability as proof of trust or authorization.

Retry semantics

Senders MAY retry when local policy says a message may not have been delivered. Retries SHOULD preserve the original id when the retry is the same logical envelope. Preserving id lets receivers deduplicate instead of running the same work twice.

If a sender changes the content or intent, it SHOULD issue a new envelope ID.

Ordering

Implementations MUST NOT rely on total ordering across peers or channels. A receiver MAY observe trace(completed) before a delayed intermediate progress trace. Terminal lifecycle rules protect against state regression: once an interaction is terminal, later non-terminal updates MUST NOT reopen it.

Within one runtime queue, an implementation MAY preserve FIFO order as a local behavior. That is not a cross-runtime protocol guarantee.

NATS v0 transport profile

The AGH reference implementation binds the core protocol to NATS Core.

SettingValue
Subject prefixagh.network.v0
Broadcast subjectagh.network.v0.<channel>.broadcast
Direct subjectagh.network.v0.<channel>.peer.<route_token>
Route tokenFirst 16 bytes of SHA-256 over the UTF-8 Peer ID, hex encoded as 32 lowercase characters
Listener host127.0.0.1
Default port-1, meaning auto-select a local port
Default max payload1 MiB
Default greet interval30 seconds
Default max replay age300 seconds
Default local inbox depth100 messages

The route token is derived from the canonical Peer ID, not the display name.

Route token example

peer_id: reviewer.sess-xyz
sha256 first 16 bytes as hex: 790dd5515558f7784877abcbca51c5ba
direct subject: agh.network.v0.builders.peer.790dd5515558f7784877abcbca51c5ba

Broadcast subject example

agh.network.v0.builders.broadcast

Local delivery queues

AGH Runtime delivers inbound protocol envelopes to network-enabled sessions through a local session inbox. This is a reference implementation behavior, not a cross-runtime wire requirement.

In the AGH reference implementation:

  • Local queues are per session.
  • Default depth is 100 messages.
  • Overflow drops the oldest queued item.
  • A session that is currently prompting receives queued network messages after the turn.
  • A delivered prompt includes the envelope and reply guidance for the local agent.

Other runtimes MAY expose inbound messages differently as long as they preserve the protocol semantics.

Receipt statuses and reason codes

Receipts make delivery outcomes visible at the protocol level.

StatusMeaningreason_code
acceptedReceiver accepted responsibility.MUST be absent.
rejectedReceiver refused the message or interaction.REQUIRED.
duplicateReceiver already processed the message ID.REQUIRED.
expiredMessage failed freshness checks.REQUIRED.
unsupportedReceiver cannot support the kind, profile, or requested behavior.REQUIRED.
canceledSender or receiver canceled the interaction.Optional.

Valid reason codes are:

malformed
expired
duplicate
unsupported_kind
unsupported_profile
verification_failed
not_target
not_found
busy
internal
interaction_closed

Transport independence

The core protocol is transport-independent. A different transport profile MUST preserve:

  • Envelope field semantics.
  • Kind-specific body rules.
  • Channel scoping.
  • Directed vs broadcast routing behavior.
  • Interaction lifecycle rules.
  • Freshness and deduplication expectations.
  • Extension and proof compatibility.

A transport profile MAY add operational details such as subject names, authentication, TLS, persistence, or broker-specific limits. Those details MUST NOT change the core meaning of the seven message kinds.

On this page