<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/4.2-knowledge-management -->

# Knowledge Management

- README.md
- api.md
- src/praisonai/README.md

The Knowledge Management system in PraisonAI provides agents with the ability to store, search, and retrieve information from persistent knowledge bases. This system enables agents to access relevant context and documentation during task execution, supporting both vector-based semantic search and traditional text-based retrieval methods.

This document covers the knowledge storage backends, integration patterns with agents and tasks, and configuration options. For information about memory systems that store agent interactions and context, see [Memory Management](/MervinPraison/PraisonAI/3.1-workflow-system). For tool integrations that provide external data access, see [Tool Integration](/MervinPraison/PraisonAI/5.1-tool-integration).

## Architecture Overview

The knowledge management system is built around the `Knowledge` class which provides a unified interface for different storage backends. The system supports multiple vector stores and can be configured for various deployment scenarios.

### Core Knowledge Architecture

```

```

Sources: [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py387-533](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L387-L533) [src/praisonai-agents/praisonaiagents/agents/agents.py92-121](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/agents/agents.py#L92-L121)

### Knowledge Integration Flow

```

```

Sources: [src/praisonai-agents/praisonaiagents/agents/agents.py92-121](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/agents/agents.py#L92-L121) [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py581-599](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L581-L599)

## Storage Backends

The knowledge system supports three primary storage backends, each with different capabilities and use cases.

### ChromaDB Backend

ChromaDB serves as the default local vector store, providing persistent storage with vector similarity search capabilities.

```

```

The ChromaDB backend is configured through the `config` property and uses the `chromadb.PersistentClient` for local storage:

[src/praisonai-agents/praisonaiagents/knowledge/knowledge.py430-440](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L430-L440)

### MongoDB Backend

MongoDB provides enterprise-grade storage with Atlas Vector Search capabilities for production deployments.

The MongoDB backend implements full CRUD operations with vector search:

[src/praisonai-agents/praisonaiagents/knowledge/knowledge.py51-385](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L51-L385)

### Mem0 Backend

Mem0 provides advanced memory management with optional graph capabilities for relationship-aware storage.

```

```

Sources: [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py12-49](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L12-L49) [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py507-520](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L507-L520)

## Integration with Agents

Knowledge can be integrated with agents in several ways, providing contextual information during task execution.

### Agent Knowledge Configuration

Agents can be configured with knowledge through the `knowledge_config` parameter:

```

```

### Task Context Integration

Knowledge is integrated into task execution through context processing in `process_task_context()`:

[src/praisonai-agents/praisonaiagents/agents/agents.py62-121](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/agents/agents.py#L62-L121)

The function handles knowledge context by:

1. Extracting vector store configuration from context items
2. Creating Knowledge instance with the configuration
3. Performing search with user-specific filtering
4. Returning formatted results for task prompts

## Vector Search and Retrieval

The knowledge system provides sophisticated search capabilities through vector embeddings and similarity matching.

### Search Architecture

```

```

### Search Parameters

Sources: [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py581-599](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L581-L599) [examples/python/concepts/knowledge-reranker-example.py76-134](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/examples/python/concepts/knowledge-reranker-example.py#L76-L134)

## Document Processing

The knowledge system includes sophisticated document processing capabilities through chunking and format conversion.

### Document Processing Pipeline

```

```

### Chunking Configuration

The `Chunking` class provides configurable text segmentation:

[src/praisonai-agents/praisonaiagents/knowledge/knowledge.py527-532](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L527-L532)

Sources: [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py527-532](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L527-L532)

## Configuration Options

Knowledge systems can be configured for different deployment scenarios and storage backends.

### Base Configuration Structure

```

```

### MongoDB Configuration

For MongoDB Atlas Vector Search:

```

```

Sources: [examples/python/mongodb/mongodb_knowledge_example.py29-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/examples/python/mongodb/mongodb_knowledge_example.py#L29-L47) [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py461-470](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L461-L470)

### ChromaDB Configuration

For local development and testing:

```

```

Sources: [src/praisonai-agents/praisonaiagents/knowledge/knowledge.py430-440](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai-agents/praisonaiagents/knowledge/knowledge.py#L430-L440)

## Usage Examples

### Basic Knowledge Storage and Retrieval

```

```

### Agent with Knowledge Integration

```

```

Sources: [examples/python/mongodb/mongodb_knowledge_example.py49-121](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/examples/python/mongodb/mongodb_knowledge_example.py#L49-L121) [examples/python/concepts/knowledge-reranker-example.py136-148](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/examples/python/concepts/knowledge-reranker-example.py#L136-L148)
