Calls a PolicyFn each frame to decide which actions to press.
Great for heuristic AI, external policy calls, or Claude-driven play.
The runner awaits the policy, so it can do anything from a decision-tree
based on ctx.snapshot() to an external HTTP / preview_eval round-trip
where Claude reads scene state and replies with an action set.
The returned record is applied as a full action state — actions absent
from the record are released. Read ctx.snapshot() if you want to
preserve current state and only flip some keys.
Calls a PolicyFn each frame to decide which actions to press. Great for heuristic AI, external policy calls, or Claude-driven play.
The runner awaits the policy, so it can do anything from a decision-tree based on
ctx.snapshot()to an external HTTP /preview_evalround-trip where Claude reads scene state and replies with an action set.The returned record is applied as a full action state — actions absent from the record are released. Read
ctx.snapshot()if you want to preserve current state and only flip some keys.Example: Simple heuristic