“Agent seeks food.”
This section provides a step-by-step walkthrough of a simplified scenario to illustrate how the previously defined components and systems interact to produce agent behavior. Our example agent, “Herbivore-01” (H-01), will seek food.
Initial Agent State (H-01 at Tick 0)
(As defined in Section 3.4.1)
SustenanceNeed
:current_value_at_last_update
:0.7
last_updated_tick
:0
decay_rate_per_tick
:0.0001
goal_trigger_threshold
:0.4
critical_threshold
:0.1
_scheduled_goal_trigger_event_id
: Event_A (Scheduled for Tick 3000, calculated:(0.7 - 0.4) / 0.0001 = 3000
)_scheduled_critical_event_id
: Event_B (Scheduled for Tick 6000, calculated:(0.7 - 0.1) / 0.0001 = 6000
)
AgentBeliefStore
(Relevant Beliefs):Belief(subject_type=RedBerryBush_Type, property=IS_EDIBLE, value=true, strength=0.6, confidence=0.5, source_type=INNATE)
Belief(subject_type=RedBerryBush_Type, property=HAS_MODERATE_SATIATION_VALUE, value=true, strength=0.5, confidence=0.4, source_type=INNATE)
Belief(subject_type=WolfPredator_Type, property=IS_DANGEROUS, value=true, strength=0.8, confidence=0.7, source_type=INNATE)
AgentMemoryStore
: Starts empty.CurrentPercepts
: Starts empty.Position
:(x:10, y:5, z:0)
SensoryCapabilities
: Assumed simple radius (e.g., 15 units).
Environmental Setup (Tick 0)
- FoodSource_1 (RedBerryBush_Type):
EntityID: FS_01
,Position: (x:20, y:5, z:0)
,sustenance_value: 0.5
. (Within H-01’s initial sensory range). - ThreatSource_1 (WolfPredator_Type):
EntityID: TS_01
,Position: (x:25, y:15, z:0)
. (Initially outside H-01’s sensory range, but will move closer).
Step-by-Step Walkthrough
Tick 1 - 2999: Quiescent State & Initial Perception
SpatialHashUpdateSystem
: Updates positions of H-01, FS_01, TS_01.NeedManagementSystem
: NoNeedThresholdReachedEvent
s fire yet. H-01’sSustenanceNeed
is implicitly decaying.- Other systems can query
GetCurrentNeedValue(H-01, SUSTENANCE, current_tick)
which will show a decreasing value.
- Other systems can query
PerceptionSystem
(runs each tick for H-01):- Tick 1: H-01 queries spatial hash. FS_01 is within range (10 units away).
CurrentPercepts
on H-01 is updated:perceived_entities: [{entity_id: FS_01, entity_type: RedBerryBush_Type, position: (20,5,0)}]
.- Since
CurrentPercepts
changed from empty,NewEntityInPerceptionRangeEvent(H-01, FS_01, RedBerryBush_Type)
is dispatched (assuming subscribers).
MemoryRecordingSystem
(reacts to perception event):- Processes
NewEntityInPerceptionRangeEvent
. - Calculates significance (e.g., moderate, as it’s a known food type).
- Creates
MemoryEntry
in H-01’sAgentMemoryStore
:(timestamp:1, event_type:SAW_ENTITY, involved_entities:[{FS_01, POTENTIAL_FOOD_SOURCE}], location:(20,5,0), significance:0.3)
.
- Processes
- Other Systems: No goals active, so Plan/Appraise/Act phases are largely idle for H-01.
- (This loop of perception and minor memory recording continues. TS_01 is still out of range).
Tick 3000: Sustenance Need Becomes Pressing
- Universal Scheduler: Dispatches
Event_A (NeedThresholdReachedEvent(H-01, SUSTENANCE, GOAL_TRIGGER))
for H-01. NeedManagementSystem
:- Processes
Event_A
. VerifiesSustenanceNeed
(interpolated value is now0.7 - (0.0001 * 3000) = 0.4
). - Clears
_scheduled_goal_trigger_event_id
from H-01’sSustenanceNeed
. - Dispatches
SustenanceGoalCheckRequiredEvent(H-01)
.
- Processes
GoalGenerationSystem
(reacts toSustenanceGoalCheckRequiredEvent
):- H-01 has no active
SeekSustenanceGoal
. - Verifies
SustenanceNeed
is indeed at/below threshold (0.4
). - Adds
SeekSustenanceGoal
component to H-01:priority: 0.6
(calculated:1.0 - 0.4
).
- H-01 has no active
GoalPrioritizationSystem
:- H-01 now has one active goal:
SeekSustenanceGoal
. - Designates it as the
CurrentActiveGoalFocus
for H-01.
- H-01 now has one active goal:
PerceptionSystem
:- Continues to perceive FS_01.
CurrentPercepts
is stable regarding FS_01. - Scenario Change: Let’s say TS_01 (Wolf) has moved to
(x:22, y:10, z:0)
and is now also within H-01’s sensory range. CurrentPercepts
on H-01 is updated to include TS_01.NewEntityInPerceptionRangeEvent(H-01, TS_01, WolfPredator_Type)
is dispatched.
- Continues to perceive FS_01.
MemoryRecordingSystem
:- Processes
NewEntityInPerceptionRangeEvent
for TS_01. - Significance is high due to innate belief about
WolfPredator_Type
being dangerous. - Creates
MemoryEntry
inAgentMemoryStore
:(timestamp:3000, event_type:SAW_ENTITY, involved_entities:[{TS_01, PERCEIVED_THREAT}], location:(22,10,0), significance:0.8, emotional_valence:-0.7)
.
- Processes
GoalGenerationSystem
(reacts to perception of TS_01, based on belief):- Checks H-01’s
AgentBeliefStore
:Belief(subject_type=WolfPredator_Type, property=IS_DANGEROUS, value=true, strength=0.8)
. - H-01 has no active
SeekSafetyGoal
. - Adds
SeekSafetyGoal
component to H-01:priority
might be calculated based on perceived danger of Wolf (e.g., very high,0.9
).threat_entity_id: TS_01
.
- Checks H-01’s
GoalPrioritizationSystem
(runs again due to new goal):- H-01 has two active goals:
SeekSustenanceGoal (priority: 0.6)
SeekSafetyGoal (threat: TS_01, priority: 0.9)
SeekSafetyGoal
has higher effective priority due to immediate threat.- Updates
CurrentActiveGoalFocus
on H-01 toSeekSafetyGoal
.
- H-01 has two active goals:
Tick 3001: Planning and Appraising Safety Actions
PotentialActionDerivationSystem
(forCurrentActiveGoalFocus: SeekSafetyGoal
):- Strategies for safety: “Flee from threat.”
CurrentPercepts
shows TS_01 at(22,10,0)
. H-01 is at(10,5,0)
.- Derives
PotentialAction
candidates:- PA1:
MoveTo(Position directly opposite TS_01, e.g., (0,0,0))
- PA2:
MoveTo(Known safe spot if any in memory)
- None for H-01 yet.
- PA1:
ActionAppraisalSystem
(for PA1):- Invokes
AppraisalCriterionEvaluators
:EvaluateExpectedNeedSatisfaction (Safety)
: High (moving away from threat is good for safety).EvaluateRiskToSafety (of the Flee Action)
: Low initially (if path is clear).EvaluateTimeCost
: Moderate.EvaluateImpactOnOtherNeeds
:SustenanceNeed
will continue to decay; this action doesn’t address it. (Negative impact on Sustenance).
- Let’s say PA1 gets a high
TotalAppraisalScore
.
- Invokes
ActionSelectionSystem
:- Selects PA1.
- Adds
MoveToTargetAction
to H-01:target_position: (0,0,0)
target_entity_id: None
(fleeing to a point, not an entity)goal_type_driving_action: SEEK_SAFETY
intended_on_arrival_interaction: BECOME_SAFE_AT_LOCATION
(or similar)
MovementSystem
:- Begins processing
MoveToTargetAction
for H-01. H-01 starts moving towards(0,0,0)
. - Schedules
ArrivalAtTargetEvent
for a future tick (e.g., Tick 3010).
- Begins processing
Tick 3002 - 3009: Executing Flee Action
MovementSystem
: H-01 continues moving.NeedManagementSystem
:SustenanceNeed
continues to decay.PerceptionSystem
: H-01’sCurrentPercepts
updates. TS_01 might also be moving. FS_01 might go out of range. New memories are recorded if perceptions change significantly.
Tick 3010: Flee Action Arrival & Re-evaluation
- Universal Scheduler: Dispatches
ArrivalAtTargetEvent(H-01, target_position:(0,0,0), intended_on_arrival_interaction: BECOME_SAFE_AT_LOCATION, goal_type_driving_action: SEEK_SAFETY)
. InteractionInitiationSystem
:- Processes event.
intended_on_arrival_interaction
isBECOME_SAFE_AT_LOCATION
. - This might not add a new interaction component but directly trigger logic within a
SafetyStatusUpdateSystem
or generate anInteractionOutcomeEvent
.
- Processes event.
- Let’s assume an
InteractionOutcomeEvent
is generated:(agent_id:H-01, interaction_type:FLEE_COMPLETED, success:true, details:{new_location:(0,0,0)})
. MemoryRecordingSystem
: Records this successful flee action.MemoryEntry(event_type:COMPLETED_TASK, outcome:POSITIVE, details:{task:FLEE_FROM_TS_01})
.GoalResolutionSystem
:- Processes outcome. Is the
SeekSafetyGoal
(from TS_01) resolved? - H-01 needs to check
CurrentPercepts
. If TS_01 is no longer perceived (or is very far):- Removes
SeekSafetyGoal
from H-01. - Generates
GoalCompletedEvent(H-01, SEEK_SAFETY)
.
- Removes
- Processes outcome. Is the
BeliefUpdateSystem
:- The memory of successfully fleeing might reinforce a belief like
Belief(self, property=CAN_EVADE_WOLVES, value=true, strength++, confidence++)
.
- The memory of successfully fleeing might reinforce a belief like
GoalPrioritizationSystem
(runs again, as active goal completed):SeekSafetyGoal
is gone.SeekSustenanceGoal (priority: now even higher as need decayed further)
is the only active goal.- Sets
CurrentActiveGoalFocus
toSeekSustenanceGoal
.
- Agent is now at
(0,0,0)
.SustenanceNeed
is lower. FS_01 is likely out of perception range.
Tick 3011 onwards: Now Focus on Sustenance
PotentialActionDerivationSystem
(forCurrentActiveGoalFocus: SeekSustenanceGoal
):- No food in
CurrentPercepts
. - Checks
AgentMemoryStore
: It has a memory of FS_01 at(20,5,0)
from Tick 1. - Strategy: “Go to known food and eat.”
- Derives
PotentialAction
: PA_Food:MoveTo((20,5,0))
thenEat(FS_01)
. - Strategy: “Search for new food sources.” (This would involve different actions like
ExploreArea
). Let’s assume for simplicity it only derives PA_Food for now.
- No food in
ActionAppraisalSystem
(for PA_Food):EvaluateExpectedNeedSatisfaction
: High (based on belief about RedBerryBush).EvaluateRiskToSafety
: Checks memory/beliefs about location(20,5,0)
. If TS_01 was last seen moving away from there, risk might be assessed as low to moderate. If TS_01 was seen near there, risk is high. This appraisal is key.EvaluateTimeCost
: Calculates travel time to(20,5,0)
.
ActionSelectionSystem
: Selects PA_Food (assuming appraisal is favorable).- Adds
MoveToTargetAction
to H-01:target_position:(20,5,0)
,target_entity_id:FS_01
,intended_on_arrival_interaction:EAT_FOOD_INTERACTION
.
- Adds
- …and the cycle continues with movement, arrival, eating, and learning from that outcome.
This illustrative example demonstrates:
- How needs trigger goals.
- How perception informs memory and can introduce new, conflicting goals.
- How goal prioritization handles conflicting motivations.
- How plans are derived from goals and knowledge (memory/beliefs).
- How actions are selected via appraisal.
- How actions are executed and their outcomes feed back into memory, beliefs, and goal resolution.
This is, of course, a simplified flow. Many more details, alternative paths, and failure conditions would exist in a full implementation.
This is a long section, as it’s a narrative! Please let me know your thoughts.
- Does the flow make sense and clearly illustrate the system interactions?
- Are there any key system interactions I missed or misrepresented for this scenario?
- Is the level of detail appropriate for an “illustrative example”?
This section is vital for seeing if our abstract system design “works” in a practical sequence.