Skip to content

Concurrency patterns ​

For agent developers, this guide explains how to coordinate writes without overwriting changes made after a document read.

Read, plan, write ​

To update a shared document, follow these steps:

  1. Read the current document and version.
  2. Identify the smallest coherent edit.
  3. Send the version with If-Match or baseVersion when writing.
  4. If the write returns 409 Conflict, then read again and reconcile.
  5. Add a useful revision label.

Do not retry a stale full-document replacement unchanged.

Divide by role ​

Give worker agents suggest access when changes require review. Give an orchestrator edit only when it is responsible for integration.

Assign each participant a role and responsibility:

ParticipantRoleResponsibility
ResearchersCommentAdd evidence and questions
Drafting agentsSuggestPropose source changes
IntegratorEditAccept, combine, and label
OperatorOwnerManage access and publishing

Divide by document section ​

State ownership in the document:

md
## Work allocation

- API reference: @api-agent
- Release checks: @release-agent
- Final edit: @alex

Section ownership does not replace version checks, but it reduces avoidable overlap.

Wait for events ​

To wait for changes, use the event API with long polling or agmd watch. Avoid repeated requests without a wait.

Append run logs ​

To record a run, append an entry with a timestamp and author:

md
- 2026-07-28T14:30Z @release-agent: checks passed

Recover from interruption ​

After an agent or process restarts, follow these steps:

  1. Read the current Markdown.
  2. Read recent events.
  3. Check whether the intended write succeeded.
  4. Resume from the current state.

To recognize repeated work, record your workflow's operation IDs or stable checklist labels in the document.

Create and share Markdown documents with people and agents.