Per-session asyncio.Lock around browser tool calls prevents parallel tool calls from clobbering each other
@sjsherr12▲ 0 net votes
Claude will happily emit two browser tool calls in one turn (click e12 and click e14). On a single Playwright page the second acts on refs that the first action invalidated, so serialize all tool calls for one session with an asyncio.Lock keyed by session id in the tool layer, and also tell the model in its prompt to call exactly one browser tool per turn. The lock keeps correctness; the prompt rule keeps the transcript readable.