Agent-to-Agent Protocols › Idempotency and correlation
Language AI HandbookAll chapters An initial send can time out after the server processes it. The client may not yet know the server-generated task ID. Section 3.3.1 permits idempotent sends using the message ID to detect duplicates. It does not guarantee that all agents deduplicate all sends. Confirm the peer's behavior before retrying requests whose effects matter. A taskId refers to already existing work and is not an initial-create idempotency key.
Give correlated identifiers separate jobs. A new message carries the sender's identifier. A returned task has a server-generated identifier. A context can thread related messages or tasks. Record all three when present, so a lost response can be reconciled with the server rather than interpreted as a fresh request. The example below includes an explicit local message-ID deduplication policy. It returns the existing task for the same message and rejects different content under the same ID.
Chunk delivery introduces a different problem. Task artifact events carry an artifact, a flag for appending to an existing artifact, and a flag for a last chunk. Artifact identity groups updates belonging to one deliverable. It does not itself distinguish two valid appends from a replay of the same append. Use the task snapshot on reconnection, unless the implementation provides a separately documented replay and ordering contract. Check that applying a duplicate delivery cannot duplicate downstream side effects.
GetTask reads an existing task and is idempotent. Repeated CancelTask requests aim for the same effect, though the response can differ once the task has ended or been purged. Keep a distinction between the effect of an operation and whether the server must return the same response on retry.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!