set_state
Atomically store a checkpoint with an optional version guard to ensure conflict-safe updates when multiple agents coordinate.
Instructions
Atomically write a checkpoint with optional version guard. Pass expected_version from a prior get_state call. expected_version=0 → create-only (fails if key exists). expected_version=N → update only if stored version matches (conflict-safe). Omit expected_version or pass -1 → unconditional write. Use force_set_state for simpler unconditional writes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Checkpoint key | |
| value | Yes | Value to store (must be JSON-encoded string) | |
| expected_version | No | Version guard: -1=unconditional, 0=create-only, N=versioned update |