Agents and policies¶
Agents represent decision makers such as players, bots, or scripted actors. The Agent class provides a convenience wrapper whose think(engine) method can return an action decision or whose run(engine) method can perform work. Decisions ultimately need to use engine.dispatch().
The Engine's agent:* actions maintain the replicated doc.agents map for game state such as agent records, resources, and cards. This CRDT registry is separate from the legacy Agent convenience wrapper and its own session/space bindings; do not assume the two objects are interchangeable.
An agent proposes moves; game code checks whether they are legal. An Engine Policy checks a condition after an action and can trigger a follow-up effect. Keep legality checks in the game itself so the same checks apply to a human player, a scripted policy, or a trained model. For a training interface, expose the player's observation and legal moves through an RL environment.