simvx.core.ai.brain¶
The perceive -> decide -> act contract shared by classical and LLM AI.
A Brain perceives (sensors write the blackboard), decides (returns an
Action or None), and acts (executes the action and feeds the result
back onto the blackboard). Classical brains decide every frame from a cheap
behaviour tree / state machine / utility scorer; an LLM brain decides
asynchronously and infrequently, writing high-level intent the classical
layer executes. They are interchangeable because they share this contract and
a Blackboard.
Module Contents¶
Classes¶
Outcome of an action, fed back so the next decision stays consistent. |
|
Everything a brain needs to perceive, decide, and act this tick. |
|
A unit of behaviour the engine executes deterministically. |
|
Base class for any decision-maker driving an agent. |
Data¶
API¶
- simvx.core.ai.brain.LAST_RESULT_KEY¶
‘last_action_result’
- class simvx.core.ai.brain.ActionResult[source]¶
Outcome of an action, fed back so the next decision stays consistent.
- ok: bool¶
None
- message: str = <Multiline-String>¶
- data: Any¶
None
- classmethod success(message: str = '', data: Any = None) simvx.core.ai.brain.ActionResult[source]¶
- classmethod failure(message: str = '', data: Any = None) simvx.core.ai.brain.ActionResult[source]¶
- class simvx.core.ai.brain.AIContext[source]¶
Everything a brain needs to perceive, decide, and act this tick.
- agent: Any¶
None
- blackboard: simvx.core.ai.blackboard.Blackboard¶
‘field(…)’
- dt: float¶
0.0
- now: float¶
0.0
- world: Any¶
None
- class simvx.core.ai.brain.Action[source]¶
Bases:
abc.ABCA unit of behaviour the engine executes deterministically.
- abstractmethod execute(ctx: simvx.core.ai.brain.AIContext) simvx.core.ai.brain.ActionResult[source]¶
- __slots__¶
()
- class simvx.core.ai.brain.Brain[source]¶
Bases:
abc.ABCBase class for any decision-maker driving an agent.
- perception: simvx.core.ai.sensor.Perception | None¶
None
- perceive(ctx: simvx.core.ai.brain.AIContext) None[source]¶
- abstractmethod decide(ctx: simvx.core.ai.brain.AIContext) simvx.core.ai.brain.Action | None[source]¶
Return the action to take, or
Noneto do nothing this tick.
- act(action: simvx.core.ai.brain.Action, ctx: simvx.core.ai.brain.AIContext) simvx.core.ai.brain.ActionResult[source]¶
- tick(ctx: simvx.core.ai.brain.AIContext) simvx.core.ai.brain.ActionResult | None[source]¶
Run one full perceive -> decide -> act cycle.
- __slots__¶
()