agent.rs — Core Agent Lifecycle
The Agent struct is the heart of Oxyde. It manages emotion, memory, goal selection, and LLM inference.
🔧 Key Structs & Methods
pub struct Agent {
pub id: String,
pub memory: MemoryManager,
pub emotion: EmotionState,
pub goals: GoalManager,
pub llm: Box<dyn LLMProvider>,
}🌀 Lifecycle Methods
fn receive_input(&mut self, input: &str) -> AgentResponseMain entry point for user/player dialogue
Updates memory, emotion, goals, and triggers inference
fn tick(&mut self)Called every frame or interaction cycle
Can decay emotions or reprioritize goals
fn apply_emotion_delta(&mut self, delta: EmotionDelta)Adjusts the current emotional state
🗣️ Inference Path
let response = agent.receive_input("What's down that tunnel?");This will:
Recall relevant memories
Construct a prompt
Route the prompt via
llm_serviceParse response and update memory/emotion accordingly
🔁 Trait Example
trait AgentInterface {
fn receive_input(&self, input: &str) -> AgentResponse;
fn tick(&mut self);
}Used by CLI demos and future multiplayer agent servers.
