withStateLock

suspend fun <T> withStateLock(block: suspend (AIAgentState) -> T): T(source)

Executes the provided suspending block of code with exclusive access to the current state.

Return

The result of block.