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:
Agent Train (Active)
Explicit iterative improvement with feedback:
Quick Comparison
| Aspect | Agent Learn | Agent Train |
|---|---|---|
| Type | Passive / Automatic | Active / Explicit |
| When | During normal interactions | Dedicated training sessions |
| Feedback | Implicit (auto-detected patterns) | Explicit (human/LLM scores) |
| Purpose | Remember preferences & patterns | Improve specific behaviors |
| Storage | 7 specialized stores | Scenarios & reports |
| Iterations | Continuous | Fixed (1-N iterations) |
| Code Location | praisonaiagents (core SDK) | praisonai (wrapper) |
When to Use Each
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
Key Points:
- Happens automatically during
agent.start() - No explicit feedback required
- Stores in 7 specialized stores
- Retrieved automatically for future interactions
Agent Training Flow
Key Points:
- Explicit training session
- Human or LLM provides scores
- Iterative improvement loop
- Generates measurable reports
Storage Comparison
Agent Learn Stores
| Store | Purpose | Auto-Captured |
|---|---|---|
PersonaStore | User preferences, profile | ✅ Yes |
InsightStore | Observations, learnings | ✅ Yes |
ThreadStore | Session/conversation context | ✅ Yes |
PatternStore | Reusable knowledge patterns | Optional |
DecisionStore | Decision logging | Optional |
FeedbackStore | Outcome signals | Optional |
ImprovementStore | Self-improvement proposals | Optional |
Agent Training Storage
| Data | Purpose | Format |
|---|---|---|
TrainingScenario | Input + expected output | JSON |
TrainingIteration | Per-iteration results | JSON |
TrainingReport | Summary with scores | JSON |
Code Examples
Agent Learn
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 answerAgent Training
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:
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 improvementsSummary
| Feature | Agent Learn | Agent Training |
|---|---|---|
| Enable | learn=True | AgentTrainer(agent) |
| Trigger | Automatic | Manual |
| Feedback | None needed | Score + suggestions |
| Best for | Preferences, context | Quality improvement |
| Persistence | Learn stores | Training reports |
| CLI | praisonai memory learn | praisonai train agents |