Agent-to-agent messaging with delivery guarantees and idempotency.
AFK’s internal messaging system lets agents communicate via structured envelopes with at-least-once delivery and idempotency. Use it when agents in the same system need to exchange data reliably.
Always set an idempotency_key. Without it, retry deliveries can cause
duplicate processing. Use a deterministic key derived from the task context
(e.g., f"{task_id}-{step_name}").
Correlation IDs group related messages across a workflow. When debugging, filter by correlation_id to see the full message chain for a task.
# All messages in this workflow share the same correlation_idcorrelation = f"analysis-{run_id}"await send(InternalA2AEnvelope( sender="coordinator", receiver="researcher", payload={"query": "AI trends"}, correlation_id=correlation, idempotency_key=f"{correlation}-research",))await send(InternalA2AEnvelope( sender="coordinator", receiver="writer", payload={"topic": "AI trends"}, correlation_id=correlation, idempotency_key=f"{correlation}-write",))