# pipecat-ai/pipecat-flows architecture

> Architecture diagram of the GitHub repository pipecat-ai/pipecat-flows, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pipecat-ai/pipecat-flows
- Repository: https://github.com/pipecat-ai/pipecat-flows

## Overview

##### Project type and purpose
- Pipecat-Flows is a hybrid open-source toolkit:
- A Python conversation-flow framework (FlowManager, FlowsFunctionSchema, adapters, actions, context strategies)
- A standalone web-based visual flow editor (built with Vite, Tailwind, vanilla JS)
- Purpose: let developers design, manage, and run both static and dynamic LLM-driven conversational flows, with optional TTS, event hooks, and external integrations.

##### File structure
Top‐level:
- src/pipecat_flows/ → core Python library modules: manager.py, actions, adapters, types, exceptions
- editor/ → self‐contained frontend app (index.html, js/, css/, build config, examples)
- examples/ → sample Python scripts (static & dynamic flows) and assets demonstrating real‐world usage
- tests/ → pytest suite verifying core library behavior
- . github/workflows/ → CI/CD pipelines for testing and publishing to PyPI
- pyproject.toml, requirements.txt → packaging & dependencies
Patterns & configs: plugin architecture (adapters, actions), config-driven flows (JSON or dict), LLM function‐calling abstractions.

##### README for insights
- Architecture outline: FlowManager core, function schemas, node vs edge functions, context strategies
- Supported LLM providers (OpenAI, Anthropic, Gemini), TTS, transport (Daily), built-in & custom actions
- Usage scenarios: static vs dynamic flows, pre/post actions, examples in examples/ and editor/examples.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layer 1: Design
    subgraph "Design Layer"
        direction TB
        Editor["Visual Editor (Frontend)"]:::core
        FlowConfig["Flow Configurations"]:::data
    end

    %% Layer 2: Execution
    subgraph "Execution Layer"
        direction TB
        subgraph "Core Python Library"
            direction TB
            Manager["FlowManager"]:::core
            Types["Types & Schemas"]:::core
            Actions["Action Hooks"]:::plugin
            Adapters["Adapter Interfaces"]:::plugin
            Exceptions["Exceptions"]:::core
        end
    end

    %% Layer 3: Integration
    subgraph "Integration Layer"
        direction TB
        LLM["LLM Provider APIs"]:::external
        TTS["TTS / ASR Engine"]:::external
        Transport["Transport / Event System"]:::external
    end

    %% Layer 4: Infrastructure
    subgraph "Infrastructure Layer"
        direction TB
        CICD["CI/CD Pipelines"]:::infra
        Packaging["Packaging & Dependencies"]:::infra
    end

    %% Examples & Tests
    subgraph "Examples & Tests"
        direction TB
        Examples["Examples"]:::data
        Tests["Test Suite"]:::infra
    end

    %% Connections
    Editor -->|exports flow_config JSON| FlowConfig
    FlowConfig -->|consumed by| Manager
    Manager -->|uses| Types
    Manager -->|invokes| Adapters
    Manager -->|wraps calls with| Actions
    Manager -->|handles errors via| Exceptions
    Manager -->|calls| LLM
    Manager -->|executes pre/post actions on| TTS
    Manager -->|handles events from| Transport
    Manager -->|tested by| Tests
    Examples -->|demonstrates via| Manager
    CICD -->|runs tests on| Tests
    CICD -->|publishes to PyPI/npm| Packaging

    %% Click Events
    click Editor "https://github.com/pipecat-ai/pipecat-flows/tree/main/editor/"
    click FlowConfig "https://github.com/pipecat-ai/pipecat-flows/tree/main/editor/examples/"
    click Examples "https://github.com/pipecat-ai/pipecat-flows/tree/main/examples/"
    click Tests "https://github.com/pipecat-ai/pipecat-flows/tree/main/tests/"
    click Manager "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/manager.py"
    click Types "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/types.py"
    click Actions "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/actions.py"
    click Adapters "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/adapters.py"
    click Exceptions "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/exceptions.py"
    click LLM "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/adapters.py"
    click TTS "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/actions.py"
    click Transport "https://github.com/pipecat-ai/pipecat-flows/blob/main/src/pipecat_flows/actions.py"
    click CICD "https://github.com/pipecat-ai/pipecat-flows/tree/main/.github/workflows/"
    click Packaging "https://github.com/pipecat-ai/pipecat-flows/blob/main/pyproject.toml"
    click Packaging "https://github.com/pipecat-ai/pipecat-flows/blob/main/requirements.txt"
    click Packaging "https://github.com/pipecat-ai/pipecat-flows/blob/main/editor/package.json"

    %% Styles
    classDef core fill:#E0F2FF,stroke:#0288D1,stroke-width:2px
    classDef plugin fill:#E8F5E9,stroke:#388E3C,stroke-width:2px
    classDef external fill:#FFF3E0,stroke:#F57C00,stroke-width:2px
    classDef infra fill:#ECEFF1,stroke:#607D8B,stroke-width:2px
    classDef data fill:#F3E5F5,stroke:#8E24AA,stroke-width:2px
```
