pub trait Agent:
Digest
+ Apoptose
+ Sense {
Show 16 methods
// Required methods
fn id(&self) -> AgentId;
fn position(&self) -> Position;
fn set_position(&mut self, position: Position);
fn agent_type(&self) -> &str;
fn tick(&mut self, substrate: &dyn Substrate) -> AgentAction;
fn age(&self) -> u64;
// Provided methods
fn export_vocabulary(&self) -> Option<Vec<u8>> { ... }
fn integrate_vocabulary(&mut self, _data: &[u8]) -> bool { ... }
fn profile(&self) -> AgentProfile { ... }
fn evaluate_symbiosis(&self, _other: &AgentProfile) -> Option<SymbiosisEval> { ... }
fn absorb_symbiont(
&mut self,
_profile: AgentProfile,
_data: Vec<u8>,
) -> bool { ... }
fn permeability(&self) -> f64 { ... }
fn modulate_boundary(&mut self, _context: &BoundaryContext) { ... }
fn externalize_vocabulary(&self) -> Vec<String> { ... }
fn internalize_vocabulary(&mut self, _terms: &[String]) { ... }
fn vocabulary_size(&self) -> usize { ... }
}Expand description
The fundamental unit of computation in Phago — a biological cell.
Every agent must be able to:
- Digest input (consume, break down, present fragments)
- Apoptose (self-assess health, gracefully die when compromised)
- Sense the substrate (detect signals, follow gradients)
Additional biological capabilities (Wire, Transfer, Emerge, etc.) are opt-in through additional trait implementations.
Required Methods§
Sourcefn set_position(&mut self, position: Position)
fn set_position(&mut self, position: Position)
Set the agent’s position.
Sourcefn agent_type(&self) -> &str
fn agent_type(&self) -> &str
The agent’s type name (for display and logging).
Sourcefn tick(&mut self, substrate: &dyn Substrate) -> AgentAction
fn tick(&mut self, substrate: &dyn Substrate) -> AgentAction
Execute one tick of the agent’s lifecycle.
This is the main loop body. Each tick, the agent:
- Senses the environment
- Decides what to do
- Returns an action for the runtime to execute
The runtime calls this once per simulation tick.
Provided Methods§
Sourcefn export_vocabulary(&self) -> Option<Vec<u8>>
fn export_vocabulary(&self) -> Option<Vec<u8>>
Export this agent’s vocabulary as serialized bytes. Returns None if the agent has no vocabulary to export.
Sourcefn integrate_vocabulary(&mut self, _data: &[u8]) -> bool
fn integrate_vocabulary(&mut self, _data: &[u8]) -> bool
Integrate foreign vocabulary from serialized bytes. Returns true if integration succeeded.
Sourcefn profile(&self) -> AgentProfile
fn profile(&self) -> AgentProfile
Build a profile describing this agent’s capabilities.
Sourcefn evaluate_symbiosis(&self, _other: &AgentProfile) -> Option<SymbiosisEval>
fn evaluate_symbiosis(&self, _other: &AgentProfile) -> Option<SymbiosisEval>
Evaluate whether to absorb another agent as a symbiont.
Sourcefn absorb_symbiont(&mut self, _profile: AgentProfile, _data: Vec<u8>) -> bool
fn absorb_symbiont(&mut self, _profile: AgentProfile, _data: Vec<u8>) -> bool
Absorb another agent’s profile and vocabulary data as a symbiont. Returns true if absorption succeeded.
Sourcefn permeability(&self) -> f64
fn permeability(&self) -> f64
Current boundary permeability (0.0 = rigid, 1.0 = fully dissolved).
Sourcefn modulate_boundary(&mut self, _context: &BoundaryContext)
fn modulate_boundary(&mut self, _context: &BoundaryContext)
Adjust boundary permeability based on environmental context.
Sourcefn externalize_vocabulary(&self) -> Vec<String>
fn externalize_vocabulary(&self) -> Vec<String>
Return vocabulary terms to externalize (reinforce in the substrate).
Sourcefn internalize_vocabulary(&mut self, _terms: &[String])
fn internalize_vocabulary(&mut self, _terms: &[String])
Absorb nearby concept terms from the substrate.
Sourcefn vocabulary_size(&self) -> usize
fn vocabulary_size(&self) -> usize
Return the size of this agent’s vocabulary (for metrics).