Skip to content

kafein-technology/KAI-Flow

KAI‑Flow Banner

KAI Flow: a visual platform for building AI-powered assistants

Using a simple drag-and-drop interface, you can design workflows that answer questions, search the web, process documents, and automate tasks. All workflows are created and managed on a visual canvas, allowing you to see how each component works together. You can test your assistants in real time, adjust their behavior, and deploy them with confidence.

🎬 Showcase

KAI‑Flow Demo

KAI‑Flow Screenshot


πŸ“š Table of Contents

⚑ Quick Start with Docker 🐳

Step 1 β€” Configure Environment Variables

Rename `.env.example` to `.env` in the project root directory and update the values as needed.

Step 2 β€” Start the Backend & Frontend

docker compose up -d

Once running, open:

πŸ’» Local Development (Python venv / Conda)

Prerequisites

  • Python 3.11
  • Node.js β‰₯ 18.15

Step 1 β€” Configure Environment Variables

Rename `.env.example` to `.env` in the project root directory and update the values as needed.

Step 2 - Edit Constant in .env file

Replace host.docker.internal with 127.0.0.1 in the DATABASE_URL variable in the .env file.

Step 3 β€” Set Up a Python Environment

Option A β€” venv (recommended)

python -m venv .venv

# Windows (Command Prompt)
.venv\Scripts\activate

# macOS / Linux
source .venv/bin/activate

pip install --upgrade pip
pip install -r backend/requirements.txt

Option B β€” Conda

conda create -n kai-flow python=3.11 -y
conda activate kai-flow
pip install -r backend/requirements.txt

Step 4 β€” Start PostgreSQL

docker run --name kai ^
  -e POSTGRES_DB=kai ^
  -e POSTGRES_USER=kai ^
  -e POSTGRES_PASSWORD=kai ^
  -p 5432:5432 ^
  -d postgres:15

Step 5 β€” Initialize the Database Schema

Ensure your PostgreSQL container is running, then:

python backend/migrations/database_setup.py

Step 6 β€” Run the Backend

python backend/main.py

Step 7 β€” Run the Frontend open another terminal

cd client
npm install
npm run dev
# Open the printed Vite URL (e.g. http://localhost:5173)

SSL Certificates (Optional)

To run the backend with HTTPS locally, generate self-signed certificates:

cd backend/cert

# Windows (PowerShell)
$env:OPENSSL_CONF="C:\Program Files\Git\usr\ssl\openssl.cnf"; openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=TR/ST=Istanbul/L=Istanbul/O=KAI/OU=Dev/CN=localhost"

# macOS / Linux
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=TR/ST=Istanbul/L=Istanbul/O=KAI/OU=Dev/CN=localhost"

Widget (Embeddable)

A standalone chat widget for embedding KAI‑Flow agents into other sites.

cd widget
npm install
npm run dev

🧭 VS Code Debugging (.vscode/launch.json)

Create the folder: .vscode/ at the repository root and add launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Backend Main",
      "type": "python",
      "request": "launch",
      "program": "${workspaceFolder}/backend/main.py",
      "console": "integratedTerminal",
      "env": { "DOTENV_PATH": "${workspaceFolder}/.env" }
    }
  ]
}

🧱 Project Structure

KAI-Flow/
β”œβ”€ backend/                 # FastAPI Backend (Python 3.11)
β”‚  β”œβ”€ app/
β”‚  β”‚  β”œβ”€ api/               # REST API endpoints
β”‚  β”‚  β”œβ”€ auth/              # Authentication logic
β”‚  β”‚  β”œβ”€ core/              # Core utilities (config, engine, etc.)
β”‚  β”‚  β”œβ”€ middleware/         # Custom middleware
β”‚  β”‚  β”œβ”€ models/            # SQLAlchemy database models
β”‚  β”‚  β”œβ”€ nodes/             # Workflow node definitions
β”‚  β”‚  β”‚  β”œβ”€ agents/         # AI Agent nodes
β”‚  β”‚  β”‚  β”œβ”€ llms/           # LLM provider nodes
β”‚  β”‚  β”‚  β”œβ”€ tools/          # Tool nodes (web search, code, etc.)
β”‚  β”‚  β”‚  β”œβ”€ memory/         # Memory / context nodes
β”‚  β”‚  β”‚  β”œβ”€ embeddings/     # Embedding nodes
β”‚  β”‚  β”‚  β”œβ”€ vector_stores/  # Vector store nodes
β”‚  β”‚  β”‚  β”œβ”€ splitters/      # Text splitter nodes
β”‚  β”‚  β”‚  β”œβ”€ triggers/       # Workflow trigger nodes
β”‚  β”‚  β”‚  └─ document_loaders/
β”‚  β”‚  β”œβ”€ schemas/           # Pydantic schemas
β”‚  β”‚  β”œβ”€ services/          # Business logic services
β”‚  β”‚  └─ routes/            # Route definitions
β”‚  β”œβ”€ migrations/           # Database setup scripts
β”‚  β”œβ”€ main.py               # Application entry point
β”‚  └─ requirements.txt      # Python dependencies
β”œβ”€ client/                  # React 19 Frontend
β”‚  β”œβ”€ app/
β”‚  β”‚  β”œβ”€ components/        # React components
β”‚  β”‚  β”‚  β”œβ”€ canvas/         # Workflow canvas
β”‚  β”‚  β”‚  β”œβ”€ nodes/          # Node UI components
β”‚  β”‚  β”‚  └─ modals/         # Configuration modals
β”‚  β”‚  β”œβ”€ routes/            # Page routes
β”‚  β”‚  β”œβ”€ services/          # API service layer
β”‚  β”‚  β”œβ”€ stores/            # Zustand state stores
β”‚  β”‚  └─ lib/               # Utilities
β”‚  β”œβ”€ package.json
β”‚  └─ vite.config.ts
β”œβ”€ widget/                  # Embeddable Chat Widget
β”‚  β”œβ”€ src/                  # Widget source
β”‚  β”œβ”€ widget.js             # Pre-built widget bundle
β”‚  └─ package.json
β”œβ”€ docs/                    # Documentation (MkDocs)
β”œβ”€ .env.example             # Environment variable template
β”œβ”€ docker-compose.yml       # Docker Compose configuration
β”œβ”€ Dockerfile               # Backend Docker image
└─ README.md

✨ App Overview (What you can build)

  • Visual Workflow Builder: Drag-and-drop interface powered by XYFlow 12 for creating AI agents and chains.
  • Modern Tech Stack: React 19.1, React Router 7, Vite 6.3, Tailwind 4.1, DaisyUI 5 (Frontend) + FastAPI 0.116, LangChain 0.3, LangGraph 0.6 (Backend).
  • AI/ML Framework: Integrated LangChain, LangGraph, and LangSmith for building and debugging complex agent flows.
  • Vector Database: PostgreSQL with pgvector for embedding storage and semantic search.
  • Node Types: LLMs, Agents, Tools (Web Search, Code Execution), Memory, Embeddings, Vector Stores, Document Loaders, Text Splitters, Triggers.
  • Embeddable Widget: Export your agents as an embeddable widget (@kaiflow/widget on npm).
  • Secure: JWT-based authentication with Keycloak integration support.
  • Scheduling: Built-in cron-based workflow scheduling with APScheduler.

πŸ“Š Repository Stats (⭐ Stars & ⬇️ Downloads)

⭐ Star History

Star History Chart

⬇️ Downloads

Metric Badge
All releases (total) All Downloads
Latest release Latest Release Downloads
Stars (live) GitHub Repo stars
Forks (live) GitHub forks

πŸ™Œ Contributing

We welcome PRs! Please:

  1. Open an issue describing the change or bug.
  2. Fork the repo and create a feature branch.
  3. Add or adjust tests where applicable.
  4. Open a PR with a clear description and screenshots/GIFs.

πŸ‘₯ Contributors

Contributors

⭐ Stargazers & 🍴 Forkers

⭐ Stargazers · 🍴 Forkers

πŸ†˜ Troubleshooting

Port 5432 already in use

  • Stop any existing Postgres: docker ps, then docker stop <container>
  • Or change the host port mapping: -p 5433:5432

Cannot connect to Postgres

  • Verify env values in the root .env file
  • Ensure container is healthy: docker logs kai

Migrations didn’t run / tables missing

  • Re-run from backend directory: python -m migrations.database_setup
  • Ensure CREATE_DATABASE=true in the root .env file

Frontend cannot reach backend

  • Check client/.env β†’ VITE_API_BASE_URL=http://localhost:8000
  • CORS: ensure backend CORS is configured for your dev origin

VS Code doesn’t load env

  • Using our snippet? Make sure your app reads DOTENV_PATH
  • Alternative: VS Code "envFile": "${workspaceFolder}/.env"

🀝 Code of Conduct

Please follow our Contributor Covenant Code of Conduct to keep the community welcoming.

πŸ“ License

Source code is available under the Apache License 2.0 β€” see LICENSE for details.