Learn vs Train

Understanding the difference between passive learning and active training

PraisonAI provides two distinct systems for improving agent behavior: Agent Learn (passive) and Agent Train (active). Understanding when to use each is key to building effective agents.

Agent Learn (Passive)

Automatically captures patterns during normal interactions:

Diagram

💬 User Interaction

🧠 Auto-Capture

💾 Learn Stores

🔍 Retrieve

⚡ Enhanced Response

Agent Train (Active)

Explicit iterative improvement with feedback:

Diagram

Score + Feedback

📋 Scenario

🤖 Execute

📝 Output

👤 Grade

📈 Improve


Quick Comparison

AspectAgent LearnAgent Train
TypePassive / AutomaticActive / Explicit
WhenDuring normal interactionsDedicated training sessions
FeedbackImplicit (auto-detected patterns)Explicit (human/LLM scores)
PurposeRemember preferences & patternsImprove specific behaviors
Storage7 specialized storesScenarios & reports
IterationsContinuousFixed (1-N iterations)
Code Locationpraisonaiagents (core SDK)praisonai (wrapper)

When to Use Each

Diagram

Remember user preferences

Improve specific behaviors

Adapt over time

Focused improvement session

Automatic capture

Human feedback

What do you need?

✅ Use Agent Learn

✅ Use Agent Training

Use Agent Learn When:

  • Remembering user preferences – Dark mode, language, communication style
  • Capturing domain knowledge – Project-specific terms, codebase patterns
  • Building context over time – Session history, conversation threads
  • Automatic adaptation – No intervention needed
  • Long-term memory – Persistent across sessions

Use Agent Training When:

  • Improving specific responses – Better greetings, more accurate answers
  • Quality assurance – Iterative refinement with scoring
  • Human feedback loops – Expert-in-the-loop improvement
  • Benchmarking behavior – Measurable improvement metrics
  • One-time improvement sessions – Focused training runs

Data Flow Comparison

Agent Learn Flow

Diagram
StoresLearnManagerAgentUserStoresLearnManagerAgentUserPersisted automatically“I prefer Python”Auto-captureStore in PersonaStore“Set up my environment”Get contextRetrieve preferences“User prefers Python”Python-focused setup

Key Points:

  • Happens automatically during agent.start()
  • No explicit feedback required
  • Stores in 7 specialized stores
  • Retrieved automatically for future interactions

Agent Training Flow

Diagram
GraderAgentAgentTrainerUserGraderAgentAgentTrainerUserAdd scenarioExecuteResponseGrade (score 7/10)“Needs more detail”Improved promptBetter responseGrade (score 9/10)Training report

Key Points:

  • Explicit training session
  • Human or LLM provides scores
  • Iterative improvement loop
  • Generates measurable reports

Storage Comparison

Agent Learn Stores

StorePurposeAuto-Captured
PersonaStoreUser preferences, profile✅ Yes
InsightStoreObservations, learnings✅ Yes
ThreadStoreSession/conversation context✅ Yes
PatternStoreReusable knowledge patternsOptional
DecisionStoreDecision loggingOptional
FeedbackStoreOutcome signalsOptional
ImprovementStoreSelf-improvement proposalsOptional

Agent Training Storage

DataPurposeFormat
TrainingScenarioInput + expected outputJSON
TrainingIterationPer-iteration resultsJSON
TrainingReportSummary with scoresJSON

Code Examples

Agent Learn

python
from praisonaiagents import Agent

# Enable learning with simple shorthand
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant",
    learn=True  # Enables AGENTIC mode (auto-learning)
)

# Learnings captured automatically
agent.start("I prefer concise answers")
agent.start("Always use Python examples")

# Later - agent remembers preferences
agent.start("How do I sort a list?")
# Agent gives concise Python answer

Agent Training

python
from praisonai.train.agents import AgentTrainer, TrainingScenario, apply_training
from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant"
)

# Create explicit training session
trainer = AgentTrainer(
    agent=agent,
    iterations=5,
    human_mode=True  # Get human feedback
)

trainer.add_scenario(TrainingScenario(
    id="greeting",
    input_text="Hello!",
    expected_output="Friendly, welcoming response"
))

# Run training with feedback
report = trainer.run()
print(f"Score improved: {report.improvement:+.1f}")

# Apply the best iteration at runtime
apply_training(agent, session_id=report.session_id)

# Now agent uses learned improvements
response = agent.start("Hello!")

Using Both Together

Agent Learn and Agent Training are complementary. Use them together for best results:

python
from praisonaiagents import Agent
from praisonai.train.agents import AgentTrainer, TrainingScenario

# Create agent with learning enabled
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant",
    learn=True  # Passive learning always on
)

# Periodically run training sessions
trainer = AgentTrainer(agent=agent, iterations=3, human_mode=True)
trainer.add_scenario(TrainingScenario(
    id="quality_check",
    input_text="Explain machine learning",
    expected_output="Clear, accurate explanation"
))

# Training improves specific behavior
report = trainer.run()

# Agent continues learning passively
# AND benefits from training improvements
Diagram

Combined Approach

🤖 Agent

📚 Learns Continuously

🏋️ Trains Periodically

Better Context


Summary

FeatureAgent LearnAgent Training
Enablelearn=TrueAgentTrainer(agent)
TriggerAutomaticManual
FeedbackNone neededScore + suggestions
Best forPreferences, contextQuality improvement
PersistenceLearn storesTraining reports
CLIpraisonai memory learnpraisonai train agents

Related