Expand description
AI Behavioral Simulation Engine
This module provides functionality to model users as narrative agents that:
- React to app state (e.g., “cart is empty” → intention: “browse products”)
- Form intentions (shop, browse, buy, abandon)
- Respond to errors (rage clicking on 500 errors, retry logic, cart abandonment on payment failure)
- Trigger multi-step interactions automatically
- Maintain session context across interactions
§Persona Integration Strategy
- Primary: Augment existing personas - Attach behavior policies to existing Smart Personas
- Secondary: Generate new personas - When system description introduces roles that don’t exist
§Example Usage
ⓘ
use mockforge_core::ai_studio::behavioral_simulator::{BehavioralSimulator, CreateAgentRequest};
use mockforge_core::intelligent_behavior::IntelligentBehaviorConfig;
async fn example() -> mockforge_core::Result<()> {
let config = IntelligentBehaviorConfig::default();
let simulator = BehavioralSimulator::new(config);
let request = CreateAgentRequest {
persona_id: Some("existing-persona-123".to_string()),
behavior_policy: Some("bargain-hunter".to_string()),
generate_persona: false,
};
let agent = simulator.create_agent(&request).await?;
Ok(())
}Structs§
- AppState
- App state awareness
- Behavior
Policy - Behavior policy attached to persona
- Behavioral
Simulator - Behavioral Simulator Engine
- Behavioral
Traits - Behavioral traits for the agent
- Cart
Item - Cart item
- Cart
State - Cart state
- Create
Agent Request - Request to create a narrative agent
- Error
Encounter - Error encounter
- Interaction
- Interaction record
- Narrative
Agent - Narrative agent that models user behavior
- Next
Action - Next action to take
- Policy
Rule - Policy rule for behavior
- Simulate
Behavior Request - Request to simulate behavior
- Simulate
Behavior Response - Response from behavior simulation
Enums§
- Intention
- User intention types