<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/10.4-dependency-management -->

# Dependency Management

- .gitignore

## Purpose and Scope

This document describes the dependency management strategy for PraisonAI, covering the core and optional dependencies for both the `praisonai` and `praisonaiagents` packages. It explains the modular dependency system that allows users to install only the features they need, reducing installation size and startup time.

For information about how lazy loading optimizes module imports at runtime, see [Lazy Loading System](/MervinPraison/PraisonAI/10.3-lazy-loading-system). For package structure and organization, see [praisonaiagents Package](/MervinPraison/PraisonAI/10.1-praisonaiagents-package) and [praisonai Package](/MervinPraison/PraisonAI/10.2-praisonai-package).

## Package Architecture

PraisonAI consists of two main packages with distinct dependency profiles:

The `praisonai` package depends on `praisonaiagents`, creating a layered dependency structure where users can choose to install only the core library or the full wrapper with additional features.

Sources: Based on Diagram 5 package structure

## Dependency Layers

### Diagram: Package Dependency Architecture

```

```

This diagram shows the installation flow from user commands to package setup files and their respective dependency groups.

Sources: Diagram 5 from system overview

## Core Dependencies

### PraisonAIAgents Core

The `praisonaiagents` package requires the following core dependencies for basic agent functionality:

These dependencies are always installed and provide the minimal functionality for creating and executing agents.

### PraisonAI Core

The `praisonai` wrapper package has a simpler core dependency set:

The wrapper delegates most functionality to `praisonaiagents`, adding only orchestration and framework integration on top.

Sources: Diagram 5 core dependencies section

## Optional Feature Groups

### Diagram: Feature Group Dependencies

```

```

This diagram maps feature groups to their specific package dependencies, showing how modular installation targets translate to concrete library requirements.

Sources: Diagram 5 optional dependencies section

### PraisonAI Feature Groups

### PraisonAIAgents Feature Groups

Sources: Diagram 5 optional feature groups

## Installation Patterns

### Basic Installation

Install only the core agent library:

```

```

This provides the `Agent`, `Task`, and basic execution capabilities without any optional features.

### Full Installation

Install the wrapper with all core dependencies:

```

```

This includes the CLI, configuration system, and framework orchestration, but not optional features.

### Feature-Specific Installation

Install with specific feature groups:

```

```

Multiple feature groups can be combined in a single installation command.

### Development Installation

Install in editable mode with all dependencies:

```

```

Sources: Standard pip installation patterns

## Version Constraints

### Constraint Strategy

PraisonAI uses minimum version constraints for most dependencies, allowing users to benefit from upstream improvements while ensuring compatibility:

### Critical Version Requirements

**Pydantic >=2.10.0**: Required for modern Pydantic v2 validation features and performance improvements. The configuration system relies on Pydantic models throughout.

**LiteLLM >=1.81.0**: Ensures support for the latest LLM providers and tool calling protocols. Earlier versions may lack support for newer models.

**OpenAI >=2.0.0**: The v2 API introduced breaking changes that the codebase depends on, particularly for async client support and response types.

**Aiohttp >=3.8.0**: Provides stable async HTTP functionality required for concurrent agent operations.

Sources: Diagram 5 version constraints, standard Python packaging practices

## Dependency Resolution Strategy

### Diagram: Dependency Resolution Flow

```

```

This diagram shows how pip resolves dependencies during installation, including the recursive resolution of the `praisonaiagents` dependency.

Sources: Standard pip resolution behavior

### Resolution Behavior

1. Core Dependencies First : Pip resolves all core dependencies before processing optional features, ensuring the base package is installable.
2. Recursive Resolution : When praisonai depends on praisonaiagents , pip recursively resolves praisonaiagents and its dependencies before continuing with praisonai optional features.
3. Conflict Detection : If two feature groups require incompatible versions of the same package, pip raises a conflict error. PraisonAI's modular design minimizes such conflicts.
4. Lazy Loading Integration : After installation, the lazy loading system (see Lazy Loading System ) ensures that optional dependencies are only imported when their corresponding features are accessed, maintaining fast startup times even with many installed features.

## Dependency Organization in Code

### Setup File Structure

Both packages use standard Python packaging with `setup.py` or `pyproject.toml` files defining dependencies.

**Expected structure for praisonaiagents/setup.py:**

```

```

**Expected structure for praisonai/setup.py:**

```

```

Note: Actual file paths and line numbers not provided in source material, but these structures follow standard Python packaging conventions.

Sources: Diagram 5 package structure, standard Python packaging

## UV Package Manager Integration

PraisonAI's development and CI/CD pipelines use UV package manager for faster dependency installation:

UV is used in:

- GitHub Actions workflows (see CI/CD Pipeline )
- Development Docker containers
- Local development setups

The speed improvements significantly reduce CI/CD pipeline execution time, especially when running multiple test workflows in parallel.

Sources: Diagram 4 UV integration, GitHub Actions workflows

## Dependency Security and Maintenance

### Dependency Updates

Dependencies are kept up-to-date through:

1. Automated dependency scanning : GitHub Dependabot monitors for security vulnerabilities
2. Regular manual updates : Core team reviews and updates dependencies quarterly
3. CI/CD testing : All dependency updates must pass comprehensive test suites before merging

### Security Considerations

### Minimum Viable Dependencies

The core `praisonaiagents` package intentionally keeps dependencies minimal:

- Only 5 core dependencies
- Optional features are truly optional
- No unnecessary transitive dependencies
- Lazy loading prevents import overhead

This design philosophy ensures:

- Small installation size (~50MB core, ~500MB with all features)
- Fast startup time (~20ms core, ~420ms with all features loaded)
- Reduced attack surface
- Easier maintenance and updates

Sources: Diagram 5 lazy loading architecture, security best practices

## Troubleshooting Dependency Issues

### Common Issues and Solutions

### Debugging Installation

To verify installed dependencies:

```

```

### Clean Installation

For persistent issues, perform a clean installation:

```

```

Sources: Standard pip troubleshooting practices
