Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Understanding how agents access and store information is key to building effective AI applications.

Quick Comparison

AspectContextMemoryKnowledgeRAG
WhatRuntime data flowPersistent storagePre-loaded docsSearch technique
WhenDuring executionAcross sessionsBefore executionQuery time
LifetimeSession onlyPermanentPermanentN/A
DirectionRead-onlyRead + WriteRead-onlyRead-only
Agent Paramcontext=memory=knowledge=Part of knowledge
DependenciesNoneNone (file)chromadbchromadb

The Four Concepts Explained

1. Context = Runtime Data Flow

What it is: Data passed between agents during a single workflow execution.
from praisonaiagents import Agent, AgentTeam

researcher = Agent(
    name="Researcher",
    instructions="Research the topic"
)

writer = Agent(
    name="Writer",
    instructions="Write based on research"
)

# Context flows automatically: Researcher → Writer
team = AgentTeam(
    agents=[researcher, writer],
    process="sequential"
)

result = team.start("Write about AI")
# Context is LOST after this completes
Key Point: Context is ephemeral - lost when the session ends. Use for workflow data flow.

2. Memory = Persistent Learning

What it is: Information stored and recalled across sessions. The agent “remembers”.
from praisonaiagents import Agent

# Session 1: Agent learns
agent = Agent(
    name="Assistant",
    instructions="Remember user preferences",
    memory=True  # Enable persistent memory
)
agent.start("I prefer dark mode and formal responses")

# Session 2 (later): Agent recalls
agent = Agent(
    name="Assistant",
    instructions="Remember user preferences",
    memory=True
)
agent.start("What are my preferences?")
# Agent remembers: "dark mode and formal responses"
Key Point: Memory persists across sessions. Use for user preferences, learning, conversation history.

3. Knowledge = Pre-loaded Documents

What it is: Reference documents loaded before the agent runs. Static information.
from praisonaiagents import Agent

agent = Agent(
    name="Support Agent",
    instructions="Answer questions using the documentation",
    knowledge=["docs/manual.pdf", "docs/faq.txt"]
)

# Agent searches knowledge to answer
agent.start("How do I reset my password?")
Key Point: Knowledge is read-only reference data. Use for manuals, FAQs, documentation.

4. RAG = Retrieval Augmented Generation

What it is: A technique (not a separate system) that powers Knowledge search.
from praisonaiagents import Agent, KnowledgeConfig

agent = Agent(
    name="RAG Agent",
    instructions="Answer using the knowledge base",
    knowledge=KnowledgeConfig(
        sources=["docs/"],
        retrieval_k=5,        # Return top 5 chunks
        rerank=True,          # Rerank for relevance
        chunking_strategy="semantic"
    )
)
Key Point: RAG is HOW knowledge search works, not a separate system. It’s the retrieval technique.

Decision Tree: Which to Use?


When to Use What

Context

Use for: Agent-to-agent data flow, tool results, single-session workflowsDon’t use for: Anything that needs to persist

Memory

Use for: User preferences, conversation history, learning over timeDon’t use for: Large document collections

Knowledge

Use for: Reference docs, manuals, FAQs, static informationDon’t use for: Dynamic data that changes frequently

RAG

Use for: Semantic search over large documentsNote: This is a technique, not a separate param

Agent Parameters Summary

from praisonaiagents import Agent, MemoryConfig, KnowledgeConfig

agent = Agent(
    name="Complete Agent",
    instructions="You are a helpful assistant",
    
    # CONTEXT: Auto-enabled when using AgentTeam
    # Manages token limits, deduplication, summarization
    context=True,  # or ManagerConfig for advanced settings
    
    # MEMORY: Persistent storage across sessions
    memory=MemoryConfig(
        session_id="user-123",
        user_id="user-123",
        backend="file",      # file, sqlite, redis, postgres
        auto_memory=True,    # Auto-extract important info
    ),
    
    # KNOWLEDGE: Pre-loaded documents with RAG
    knowledge=KnowledgeConfig(
        sources=["docs/"],
        retrieval_k=5,
        rerank=True,
    ),
)

Parameter Quick Reference

ParameterTypeDescription
context=TrueboolEnable context management
context=ManagerConfig(...)ManagerConfigCustom context settings
memory=TrueboolEnable file-based memory
memory={"session_id": "..."}dictMemory with session
memory=MemoryConfig(...)MemoryConfigFull memory config
knowledge=["file.pdf"]listSimple knowledge sources
knowledge=KnowledgeConfig(...)KnowledgeConfigFull knowledge config

Using All Together

The most powerful pattern combines all three:
from praisonaiagents import Agent, AgentTeam, MemoryConfig

# Agent with Knowledge + Memory
support_agent = Agent(
    name="Support",
    instructions="Answer questions using docs. Remember user issues.",
    knowledge=["docs/manual.pdf"],  # Pre-loaded reference
    memory=MemoryConfig(            # Persistent learning
        session_id="support-session",
        auto_memory=True
    )
)

# Agent receives Context from support_agent
escalation_agent = Agent(
    name="Escalation",
    instructions="Handle complex issues based on support findings"
)

# Context flows between agents in workflow
team = AgentTeam(
    agents=[support_agent, escalation_agent],
    process="sequential"
)

result = team.start("My account is locked")

Performance Comparison

SystemSetup TimeQuery TimeDependenciesStorage
Context0ms0msNoneMemory only
Memory (file)0ms1-5msNoneJSON files
Memory (sqlite)0ms5-10msBuilt-inSQLite DB
Knowledge1-5s/doc50-200mschromadbVector DB

Summary

ConceptOne-liner
ContextRuntime data flow between agents (lost after session)
MemoryPersistent storage for learning and recall
KnowledgePre-loaded reference documents
RAGSemantic search technique powering Knowledge

Memory

Detailed memory configuration

Knowledge

Knowledge base setup

Context Management

Context optimization

RAG Features

Advanced RAG configuration