Skip to main content

Agent

Trait Agent 

Source
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§

Source

fn id(&self) -> AgentId

The agent’s unique identity.

Source

fn position(&self) -> Position

The agent’s current position in the substrate.

Source

fn set_position(&mut self, position: Position)

Set the agent’s position.

Source

fn agent_type(&self) -> &str

The agent’s type name (for display and logging).

Source

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:

  1. Senses the environment
  2. Decides what to do
  3. Returns an action for the runtime to execute

The runtime calls this once per simulation tick.

Source

fn age(&self) -> u64

How many ticks this agent has been alive.

Provided Methods§

Source

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.

Source

fn integrate_vocabulary(&mut self, _data: &[u8]) -> bool

Integrate foreign vocabulary from serialized bytes. Returns true if integration succeeded.

Source

fn profile(&self) -> AgentProfile

Build a profile describing this agent’s capabilities.

Source

fn evaluate_symbiosis(&self, _other: &AgentProfile) -> Option<SymbiosisEval>

Evaluate whether to absorb another agent as a symbiont.

Source

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.

Source

fn permeability(&self) -> f64

Current boundary permeability (0.0 = rigid, 1.0 = fully dissolved).

Source

fn modulate_boundary(&mut self, _context: &BoundaryContext)

Adjust boundary permeability based on environmental context.

Source

fn externalize_vocabulary(&self) -> Vec<String>

Return vocabulary terms to externalize (reinforce in the substrate).

Source

fn internalize_vocabulary(&mut self, _terms: &[String])

Absorb nearby concept terms from the substrate.

Source

fn vocabulary_size(&self) -> usize

Return the size of this agent’s vocabulary (for metrics).

Implementors§