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:
- Read the current document and version.
- Identify the smallest coherent edit.
- Send the version with
If-MatchorbaseVersionwhen writing. - If the write returns
409 Conflict, then read again and reconcile. - 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:
| Participant | Role | Responsibility |
|---|---|---|
| Researchers | Comment | Add evidence and questions |
| Drafting agents | Suggest | Propose source changes |
| Integrator | Edit | Accept, combine, and label |
| Operator | Owner | Manage access and publishing |
Divide by document section
State ownership in the document:
## Work allocation
- API reference: @api-agent
- Release checks: @release-agent
- Final edit: @alexSection 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:
- 2026-07-28T14:30Z @release-agent: checks passedRecover from interruption
After an agent or process restarts, follow these steps:
- Read the current Markdown.
- Read recent events.
- Check whether the intended write succeeded.
- Resume from the current state.
To recognize repeated work, record your workflow's operation IDs or stable checklist labels in the document.