Examples
Personalization
Infer, store, and utilize user preferences to adapt agent behavior.
Intelligence Module
Scenario: Learning Emma's communication style
When to Use
Use this module to make your agent "feel" like it knows the user. It explicitly manages preferences distinct from general facts. Perfect for:
- Communication style (Formal vs Casual)
- User interests and hobbies
- Settings and defaults (Dark mode, Metric system)
Key Operations
add_preference()Explicitly set a user preference
infer_preferences()Auto-discover prefs from chat history
Code Example
We can add preferences manually or let the system infer them from a conversation transcript.
Key Takeaways
- Explicit vs Implicit: supports both "User told me" and "I guessed it".
- Conflict Resolution: Use
reconcile()(not shown) to handle conflicting preferences (e.g., User liked running, now hates it). - Personalization context is automatically injected into
get_context()calls for relevant users.