Skip to main content
Learning modes control when and how a Learning Machine captures information. Each store can use a different mode.
ModeHow it worksTradeoff
AlwaysExtraction runs automatically after each responseExtra LLM call per interaction
AgenticAgent receives tools and decides what to saveMay miss implicit information
ProposeAgent proposes learnings, user confirms before savingRequires user interaction

Always Mode

Extraction happens automatically in the background. No agent tools involved.
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.learn import LearningMachine, LearningMode, UserProfileConfig
from agno.models.openai import OpenAIResponses

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    db=PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai"),
    learning=LearningMachine(
        user_profile=UserProfileConfig(mode=LearningMode.ALWAYS),
    ),
)

# Profile info extracted automatically - no tool calls visible
agent.print_response(
    "I'm Alice Chen, but please call me Ali.",
    user_id="alice@example.com",
)
Best for: User Profile, User Memory, Session Context

Agentic Mode

The agent receives tools and decides when to save.
from agno.learn import LearningMachine, LearningMode, UserProfileConfig

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    db=db,
    learning=LearningMachine(
        user_profile=UserProfileConfig(mode=LearningMode.AGENTIC),
    ),
)

# Agent decides to call update_user_profile tool
agent.print_response(
    "Remember that I prefer dark mode interfaces.",
    user_id="alice@example.com",
)
Best for: Learned Knowledge, Entity Memory, Decision Log

Tools by Store

StoreTools
User Profileupdate_user_profile
User Memorysave_user_memory, delete_user_memory
Entity Memorysearch_entities, create_entity, update_entity, add_fact, add_event
Learned Knowledgesearch_learnings, save_learning
Decision Loglog_decision, record_outcome, search_decisions

Propose Mode

The agent proposes learnings. User must confirm before saving.
from agno.learn import LearningMachine, LearningMode, LearnedKnowledgeConfig

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    db=db,
    learning=LearningMachine(
        knowledge=knowledge,
        learned_knowledge=LearnedKnowledgeConfig(mode=LearningMode.PROPOSE),
    ),
)

# Agent proposes, user confirms
agent.print_response(
    "That's a great insight about API rate limits - we should remember that.",
    user_id="alice@example.com",
)
Best for: High-stakes knowledge, regulated environments, quality control

Combining Modes

Use different modes for different stores:
from agno.learn import (
    LearningMachine,
    LearningMode,
    UserProfileConfig,
    UserMemoryConfig,
    LearnedKnowledgeConfig,
)

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    db=db,
    learning=LearningMachine(
        user_profile=UserProfileConfig(mode=LearningMode.ALWAYS),     # Automatic
        user_memory=UserMemoryConfig(mode=LearningMode.ALWAYS),       # Automatic
        learned_knowledge=LearnedKnowledgeConfig(mode=LearningMode.AGENTIC),  # Agent-driven
    ),
)

Defaults by Store

StoreDefault modeReason
User ProfileAlwaysNames and preferences should be captured consistently
User MemoryAlwaysObservations accumulate passively
Session ContextAlwaysSession state needs continuous tracking
Entity MemoryAgenticAgent builds knowledge graph as needed
Learned KnowledgeAgenticAgent decides what insights are worth saving
Decision LogAgenticAgent logs significant decisions explicitly

Choosing a Mode

ScenarioMode
Capture user names and preferencesAlways
Build user memory automaticallyAlways
Track session progressAlways
Agent-driven knowledge captureAgentic
Build entity knowledge graphsAgentic
Audit agent decisionsAgentic
High-value collective knowledgePropose
Compliance-sensitive learningPropose