Concurrent State Conflict
Multiple agents/users modify same object without coordination.
9 patterns for this goal
State tracking fails when an agent loses track of variables it set on earlier turns, when a variable binding gets corrupted or overwritten by a subsequent tool call, when failure signals are not propagated to downstream operations, or when state assumptions become invalid as agents iterate. The 9 state-tracking patterns documented here cover the challenge of maintaining consistent state across agent turns where each turn adds new information, modifies existing state, or discovers that prior assumptions were wrong. State tracking is particularly fragile in agents because state is often implicit (stored in prompt context or model memory rather than explicit data structures) and updates are not transactional — an agent might update a variable on turn 5, crash on turn 6, and on recovery have no way to know whether the state on turn 5 was actually persisted or was merely in-flight.
The 9 state-tracking patterns describe systems where state is implicit, largely invisible, and not validated: agents store state in prompts, in model context, in side-effect results, or in brief memory keys without explicit schema, versioning, or consistency checks. When state is lost, agents don’t fail loudly — they hallucinate a plausible value and continue. When state is stale, agents don’t know because they never checked the timestamp. When assumptions fail, agents have no fallback because the assumptions were never made explicit. Most teams discover state-tracking failures only after agents start producing inconsistent outputs or making decisions based on hallucinated state, at which point tracing the failure back to the specific turn it started is nearly impossible. The mitigation that recurs across nearly every pattern here is the same architectural move — make state explicit and validated: use explicit state storage (not implicit prompt storage), version state and validate versions on every read, add pre- and post-condition checks to every state-mutating operation, and fail fast when state assumptions are violated rather than attempting to hallucinate missing state. No agent should silently proceed with stale or hallucinated state.
Per Stale State Use and State Loss, stale state is retrievable but outdated (you can find it, but its timestamp shows it’s old), while lost state can’t be found at all (you look for it and it’s not there). Use timestamps and versions on all state: retrieve state, check its version/timestamp, reject if older than acceptable, and only then use it. If state is completely missing, treat it as lost and fail or request it explicitly.
Per Variable Binding Error, use namespacing or explicit scoping: prefix variables with agent ID or tool ID (e.g., tool_A_result, not just result), use structured data types (dicts/objects) not just string keys, and validate that the variable you’re reading has the expected type and schema before using it.
Partially — per Cross-Turn Contamination, use strict isolation at the agent or conversation level: separate agents or conversation threads should not share state storage or memory contexts unless explicitly intended. Tooling can enforce this (e.g., sandbox each agent’s state, require explicit sharing to pass state between threads), but human design still matters — state sharing must be intentional, not accidental.
Per Untracked Assumptions, fail explicitly with clear error messaging rather than attempting to recover or hallucinate: “State variable X is missing (expected from turn 5). Cannot proceed without it. Request: restart conversation or provide X explicitly.” Explicit failure enables operators to fix the issue; silent hallucination causes cascading errors downstream.
| Pattern | Mechanism |
|---|---|
| Concurrent State Conflict | Multiple agents update the same state variable simultaneously; final state reflects only one update, other agent’s changes are lost |
| Cross-Turn Contamination | State or variables from one agent turn or conversation thread bleed into another turn |
| Intermediate Result Corruption | Tool result is corrupted during variable binding or state storage; agent operates on corrupted data |
| Lost Failure Signal | Tool call fails but failure signal is not propagated; downstream agent proceeds as if operation succeeded |
| Stale State Use | Agent retrieves state from time T1 and uses it as if it’s current at time T2; state has been updated by another agent in between |
| State Hallucination | When state is lost or unavailable, agent generates a plausible-looking value rather than requesting it or failing |
| State Loss | Agent sets state on turn N but it’s lost by turn M (not persisted, garbage-collected, or lost in serialization) |
| Untracked Assumptions | Agent assumes state is available or has specific properties without explicit validation; behavior is undefined when assumptions fail |
| Variable Binding Error | Variable gets bound to wrong value due to naming collisions, scoping errors, or cardinality mismatches |
Total: 9 patterns
Multiple agents/users modify same object without coordination.
Current task is polluted by unrelated previous context.
Agent misreads/transforms tool output incorrectly.
Agent ignores tool warning/error and continues.
Agent uses old tool results after new data arrives.
Agent believes a step happened when it did not.
Agent forgets completed steps or user-provided constraints.
Agent makes assumptions then treats them as facts.
Agent attaches wrong value to wrong entity.