What is Learning Machine?
Learning Machine is a unified learning system that coordinates multiple learning stores, each handling a different type of knowledge:| Store | What It Captures | Scope | Use Case |
|---|---|---|---|
| User Profile | Structured fields (name, preferences) | Per user | Personalization |
| User Memory | Unstructured observations about users | Per user | Context, preferences |
| Session Context | Goal, plan, progress, summary | Per session | Task continuity |
| Entity Memory | Facts, events, relationships | Configurable | CRM, knowledge graph |
| Learned Knowledge | Insights, patterns, best practices | Configurable | Collective intelligence |
Quick Start
The simplest way to enable learning:learning=True, your agent automatically:
- Captures user profile information (name, preferences)
- Stores unstructured observations about users
- Tracks session context (summary, goals)
- Recalls relevant context in future interactions
Three Levels of Control
Level 1: Simple Toggle
Level 2: Pick What You Want
Level 3: Full Configuration
Learning Modes
Each store can operate in different modes:| Mode | Behavior | Best For |
|---|---|---|
| ALWAYS | Automatic extraction after conversations | Consistent, predictable learning |
| AGENTIC | Agent decides when to save via tools | More control, less noise |
| PROPOSE | Agent proposes, user confirms | High-stakes knowledge |
How It Works
1. Context Building (Before Response)
When you callagent.run() or agent.print_response(), the Learning Machine automatically:
- Retrieves the user’s profile
- Recalls relevant user memories
- Loads session context (summary, goals)
- Searches for relevant learned knowledge
2. Processing (After Response)
After the agent responds, stores in ALWAYS mode automatically:- Extract new profile information
- Save new observations about the user
- Update session summary and progress
3. Tool-Based Learning (During Response)
Stores in AGENTIC mode provide tools the agent can call:update_user_profile- Update structured profile fieldssave_user_memory- Store an observationsave_learning- Capture a reusable insightsearch_learnings- Find relevant past knowledge
Requirements
Learning Machine requires:- Database: For persisting learning data (PostgresDb, SqliteDb, etc.)
- Model: For extraction in ALWAYS mode (uses same model as agent)
- Knowledge Base (optional): For learned knowledge store (requires vector DB)
Learn More
Getting Started
Step-by-step guide to set up learning.
Learning Modes
Understand ALWAYS, AGENTIC, and PROPOSE modes.
User Profile Store
Capture structured user information.
User Memory Store
Store unstructured observations.
Session Context Store
Track session state and progress.
Entity Memory Store
Build knowledge graphs about entities.
Learned Knowledge Store
Capture reusable insights across users.
Custom Schemas
Extend stores with custom fields.