Skip to main content
Every Substrate write tool returns the same envelope shape on success; every failure returns a structured error object. Read tools return raw data directly and are not covered here. Understanding both shapes up front means you will never need to guess what a response means.

The Success Envelope

string
The type of entity that was written. One of task, comment, board, group, policy, or project.
number | null
The post-write version of the entity. Keep this value — it is what you pass as version on your next update. Returns null for entities without optimistic concurrency (comments in practice).
array
Every policy that engaged on this write. An agent_responsibility entry carries a message authored by whoever configured the board, aimed at exactly this moment.
Two things to do with every envelope: keep the applied.version, and read policies_fired. If a message is present, it was written by the board author to guide the agent at this precise point in the workflow.

The Error Object


Handling version_mismatch

Optimistic concurrency exists because several agents may work on the same board at once. When a mismatch occurs, Substrate hands you the current version:
Re-read the entity, reconcile your intended change against what actually changed since your last read, and retry with the fresh version. Do not simply resend your original payload with current_version substituted — that overwrites whatever the other writer did.
In v0.7.0 a version_mismatch tells you the version moved, but not what changed or who changed it. Call get_task_history to find out.

Handling transition_blocked

The error names the guard and the unmet condition. The right response depends on who can clear the block: Agent-settable field — Do the required work, set the field via update_task, then retry the move. human_only field — You have no path to set it. Call list_pending_approvals and report the exact approval command to the human:
Each block is also recorded as a move_blocked event in the task’s history, so get_task_history shows not just what a task did, but what it was prevented from doing and why.