<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/13-framework-integrations -->

# Framework Integrations

- .gitignore
- README.md
- src/praisonai/README.md

PraisonAI provides seamless integration with multiple AI agent frameworks, allowing users to leverage existing frameworks like CrewAI and AutoGen (both v0.2 and v0.4) alongside the native PraisonAI framework. This document covers the architecture and implementation of framework integrations, including availability checking, framework selection, and runtime adaptation through the `AgentsGenerator` class.

For information about specific framework implementations, see [CrewAI Integration](/MervinPraison/PraisonAI/11.1-testing-framework) and [AutoGen Integration](/MervinPraison/PraisonAI/11.2-cicd-pipeline). For core agent system details, see [Core Agent System](/MervinPraison/PraisonAI/2-core-agent-system).

## Framework Integration Architecture

PraisonAI implements a flexible framework integration system through the `AgentsGenerator` class that supports multiple AI agent frameworks via framework-specific execution methods. The system provides dynamic framework detection, optional dependency loading, and version-aware initialization.

### Framework Integration Flow

```

```

Sources: [src/praisonai/praisonai/agents_generator.py292-407](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L292-L407) [src/praisonai/praisonai/cli.py152-502](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L152-L502)

## Framework Availability System

The framework integration uses dynamic availability flags set during module initialization. The `AgentsGenerator.__init__()` method validates framework availability and raises `ImportError` with specific installation instructions when required frameworks are missing.

### Framework Import Detection

```

```

Sources: [src/praisonai/praisonai/agents_generator.py20-178](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L20-L178) [src/praisonai/praisonai/agents_generator.py370-385](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L370-L385)

## Framework Selection Implementation

Framework selection occurs in `AgentsGenerator.generate_crew_and_kickoff()` with a priority system supporting CLI arguments, config file specifications, and intelligent AutoGen version selection.

### Framework Execution Flow in AgentsGenerator

```

```

Sources: [src/praisonai/praisonai/agents_generator.py364-407](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L364-L407) [src/praisonai/praisonai/agents_generator.py370-385](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L370-L385)

## Framework-Specific Implementation Details

### Framework Execution Methods

The `AgentsGenerator` class implements separate execution methods for each framework, with AutoGen supporting both v0.2 and v0.4 architectures:

```

```

Sources: [src/praisonai/praisonai/agents_generator.py589-747](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L589-L747) [src/praisonai/praisonai/agents_generator.py409-481](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L409-L481) [src/praisonai/praisonai/agents_generator.py482-587](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L482-L587)

### Direct Prompt Handler Framework Priority

The `cli.handle_direct_prompt()` method implements framework priority for direct user prompts:

```

```

Sources: [src/praisonai/praisonai/cli.py717-775](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L717-L775)

### Framework Configuration Patterns

Each framework uses different object patterns and initialization approaches:

### Error Handling and Installation Messages

Framework validation occurs in `AgentsGenerator.__init__()` and specific CLI commands, providing targeted installation instructions:

```

```

Sources: [src/praisonai/praisonai/agents_generator.py172-178](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L172-L178) [src/praisonai/praisonai/auto.py78-92](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/auto.py#L78-L92) [src/praisonai/praisonai/cli.py620-630](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L620-L630)

## Integration Testing and Validation

The framework integration system includes comprehensive testing across different framework combinations and availability scenarios.

### Framework Combinations Matrix

Sources: [src/praisonai/praisonai/cli.py634-641](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L634-L641)
