Welcome to the KAI-Flow User Guide! This comprehensive documentation will help you setup, navigate, and master the KAI-Flow platform.
- Introduction
- Before Installation
- Hardware Requirements
- Network Requirements
- Docker Installation
- Extracting Packages
- Loading Docker Images
- Deployment
- Local Installation (Development)
- Widget Integration
- Monitoring
- Interface Overview
- Core Concepts
- Node Reference
- Tutorial: Building a Research Agent
- Troubleshooting
- License
KAI-Flow is a tool that helps you create smart assistants. These assistants can answer questions, search for information on the internet, read documents, and complete tasks automatically. You do not need to know how to write code to use it.
Think of it like building with blocks. You pick the pieces you need, connect them together, and your assistant is ready to work. For example, you can create an assistant that searches the web for news and summarizes it for you. Or one that reads your documents and answers questions about them.
The platform shows everything visually on a canvas. You can see how your assistant works, test it by chatting with it, and make changes easily. When you are happy with your assistant, you can share it with others or add it to your website.
KAI-Flow is designed for everyone. Whether you are a business owner who wants to automate customer support, a researcher who needs help processing documents, or simply curious about what AI can do, this tool makes it possible without any technical background.
Before installing KAI-Flow, make sure you have the following ready:
- Docker: KAI-Flow runs inside containers. You need Docker installed on your computer.
- Git: Required to download the project files.
- Environment Files: You will need to set up configuration files (
.env) for the backend and frontend. - Database: PostgreSQL is required. You can run it inside Docker or use an existing database.
To ensure smooth operation, particularly when orchestrating multiple concurrent AI agents, we recommend the following hardware specifications:
- CPU: 2 vCPUs
- RAM: 4 GB
- Storage: 10 GB free disk space (SSD recommended)
- CPU: 4+ vCPUs
- RAM: 8 GB+ (16 GB for heavy vector store usage)
- Storage: 20 GB+ NVMe SSD
KAI-Flow runs on a microservices architecture. Ensure the following network configurations are set:
The services communicate internally via the kai_network bridge network:
- Backend: Internal communication on port
8000. - Frontend: Internal communication on port
3000. - Database: PostgreSQL default port
5432.
These ports must be exposed or allowed through your firewall:
- Backend API: Mapped to host port
${BACKEND_PORT:-23056}(default: 23056). - Frontend UI: Mapped to host port 23058.
- Widget: Mapped to host port 23059.
The backend requires outbound internet access to reach external AI providers and tool services:
api.openai.com(OpenAI API)api.tavily.com(Search Tool)api.smith.langchain.com(LangSmith Tracing)
Docker is the primary deployment method for KAI-Flow.
- Windows & macOS: Download and install Docker Desktop from docs.docker.com.
- Linux (Ubuntu/Debian):
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
After installation, open your terminal and run these commands one by one to make sure Docker is working:
docker info
docker compose versionIf you are deploying from source code:
-
Clone the Repository: Open your terminal and run these commands one by one:
git clone https://github.com/kafein-product-space/KAI-Flow.git cd KAI-Flow
If you have received a release archive (.zip or .tar.gz):
-
Unzip the Archive:
- Windows: Right-click -> "Extract All".
- Linux/macOS:
unzip kai-Flow-release.zip # or tar -xvzf kai-Flow-release.tar.gz
-
Navigate to Directory: Open your terminal and go into the project folder:
cd kai-Flow
You can deploy KAI-Flow by building images locally or pulling them from a registry (if configured).
This builds the kaiFlow-be, kaiFlow-fe, and kai-widget images from source. Open your terminal in the project folder and run:
docker compose buildIf you are using a registry, open your terminal and run this command:
docker compose pullFollow these steps to launch the KAI-Flow stack.
You must configure the environment variables before starting.
Create: backend/migrations/.env
ASYNC_DATABASE_URL=postgresql+asyncpg://kai:kai@localhost:5432/kai
DATABASE_URL=postgresql://kai:kai@localhost:5432/kai
CREATE_DATABASE=trueCreate: backend/.env
ASYNC_DATABASE_URL=postgresql+asyncpg://kai:kai@localhost:5432/kai
DATABASE_URL=postgresql://kai:kai@localhost:5432/kai
CREATE_DATABASE=false
POSTGRES_DB=kai
POSTGRES_PASSWORD=kai
# LangSmith / LangChain tracing (optional but recommended for debugging)
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=your_langchain_api_key
LANGCHAIN_PROJECT=kai-Flow-workflows
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
ENABLE_WORKFLOW_TRACING=true
TRACE_MEMORY_OPERATIONS=true
TRACE_AGENT_REASONING=trueCreate: client/.env
VITE_API_BASE_URL=http://localhost:8000
VITE_API_VERSION=/api/v1 (Derived from VITE_API_START and VITE_API_VERSION_ONLY)
VITE_API_START=api
VITE_API_VERSION_ONLY=v1
VITE_NODE_ENV=development
VITE_ENABLE_LOGGING=trueOnce your configuration files are ready, open your terminal in the project folder and run this command to start all services:
docker compose up -dAfter starting the services, run this command to check if everything is running:
docker compose ps- Frontend Dashboard: http://localhost:23058
- Backend API Docs: http://localhost:23056/docs
- Chat Widget: http://localhost:23059
For development purposes or if you prefer running without Docker Compose, you can run the services individually.
-
Run Database: You need a registered PostgreSQL instance.
docker run --name kai -e POSTGRES_DB=kai -e POSTGRES_USER=kai -e POSTGRES_PASSWORD=kai -p 5432:5432 -d postgres:15
-
Setup Python Environment:
cd backend python -m venv .venv # Windows: .venv\Scripts\Activate.ps1 | Linux/Mac: source .venv/bin/activate pip install -r requirements.txt
-
Initialize DB & Run: Run these commands one by one to set up the database and start the backend:
python migrations/database_setup.py python main.py
-
Install & Run: Open a new terminal, go to the client folder, and run these commands one by one:
cd client npm install npm run devWhen finished, open your browser and go to
http://localhost:5173.
Embed KAI-Flow agents into any website using the standalone widget.
The widget source is located in widget/. Open your terminal and run these commands one by one:
cd widget
npm install
npm run devInclude the script in your HTML page:
<script src="http://localhost:23059/widget.js"
data-agent-id="YOUR_AGENT_ID"
data-api-url="http://localhost:YOUR_BACKEND_PORT">
</script>To keep track of your agents and system health:
View real-time logs from all containers:
docker compose logs -fFor detailed AI observability, configure LangSmith variables in backend/.env:
LANGCHAIN_TRACING_V2=trueLANGCHAIN_API_KEY=<your-key>LANGCHAIN_PROJECT=kai-Flow-workflows
This allows you to inspect every step of your agent's reasoning, tool calls, and latency usage in the LangSmith dashboard.
The platform is designed with a streamlined user flow:
When you first open the platform, you can create a new account by signing up with your email and password. After that, you can sign in anytime using your credentials.
The central hub for managing your work.
- Active Workflows: Grid view of all your agents.
- Execution History: Logs of past agent runs (status/time).
- System Status: Health checks for database and API.
The main builder interface.
- Node Sidebar: Drag-and-drop nodes (Agents, LLMs, Tools).
- Infinite Canvas: Visual workspace for connecting logic.
- Properties Panel: Configure node details (e.g., set
Temperaturefor LLMs). - Interaction Panel: Integrated Chat and Trace view to test and debug agents in real-time.
- Nodes: Functional blocks (LLMs, Tools, Agents).
- Edges: Connections defining data and control flow.
- Agents: "Brains" that decide which tools to use.
- Workflows: The complete graph of connected nodes.
- React Agent: The reasoning engine. Uses tools to solve complex tasks using ReAct logic.
- OpenAI Chat: Integrates OpenAI's GPT models (GPT-4o, etc.).
- Tavily Search: Optimized web search for AI agents.
- HTTP Client: Generic API connector (GET/POST/PUT).
- Retriever: Fetches relevant documents from Vector Memory.
- Cohere Reranker: improves retrieval accuracy by re-ranking results.
- Buffer Memory: Stores short-term conversation context.
- Vector Store: Interface for PostgreSQL/pgvector operations.
- OpenAI Embeddings: Generates vector embeddings for text.
- Document Loader: Ingests files (PDF, TXT, CSV).
- Web Scraper: Extracts content from websites.
- Chunk Splitter: Breaks documents into tokens for embedding.
- Start / End: Define workflow entry and exit points.
- Timer Trigger: Scheduled executions (Cron jobs).
- Webhook Trigger: External HTTP event triggers.
- Drag Nodes: Add OpenAI Chat, Tavily Search, and React Agent.
- Configure: Set API Keys and Model (GPT-4o).
- Connect:
- OpenAI
llm-> Agentllm - Tavily
tool-> Agenttools
- OpenAI
- Run: Open Chat, ask a question ("Latest AI news?"), and watch the agent research and answer.
ModuleNotFoundError: No module named '...'
- Ensure you activated your virtual environment:
source .venv/bin/activateor.venv\Scripts\activate. - Run
pip install -r backend/requirements.txtagain to ensure all dependencies are installed. - Verify you are running the command from the project root.
Address already in use / Port 8000 is occupied
- Another instance of the backend might be running. Check your terminal tabs.
- Kill the process using port 8000:
lsof -i :8000(Mac/Linux) ornetstat -ano | findstr :8000(Windows).
Failed to initialize node registry
- Check the logs for specific node import errors.
- Ensure all new nodes in
backend/app/nodeshave valid structure and imports.
CREATE_DATABASE environment variable is not set to 'true'
- When running
database_setup.py, ensure yourbackend/migrations/.envfile exists and containsCREATE_DATABASE=true. - Load the variables explicitly if needed:
export $(grep -v '^#' backend/migrations/.env | xargs)(Linux/Mac) before running the script.
Connection refused / Cannot connect to Postgres
- Ensure the Docker container is running:
docker ps. - Check if port 5432 is correctly mapped.
- Verify
DATABASE_URLin.envmatches your Docker configuration (default:postgresql://kai:kai@localhost:5432/kai).
relation "..." does not exist
- The tables haven't been created yet. Run
python backend/migrations/database_setup.py. - Check
database_setup.login thebackenddirectory for detailed error messages during migration.
Syncing Columns / Schema Mismatches
- The setup script attempts to auto-sync columns. If you see warnings about "Type Mismatches", you may need to manually adjust your DB or Model definitions.
- Use
--forcewithdatabase_setup.pyto recreate tables (WARNING: Data loss) if you are in early development.
Proxy error or ETIMEDOUT in frontend console
- The frontend cannot reach the backend at
http://localhost:8000. - Ensure the backend is running and healthy (
http://localhost:8000/healthorhttp://localhost:8000/api/health). - Check the terminal where
npm run devis running—the proxy logs will show if requests are being attempted.
CORS Errors (Access-Control-Allow-Origin)
- Verify
backend/main.pyhas the correctallow_origins. - In development, the proxy in
vite.config.tshandles most requests, but direct calls might trigger CORS if not configured.
Changes not reflecting
- Vite uses HMR (Hot Module Replacement). If the app state gets stuck, try a hard refresh (Ctrl+Shift+R / Cmd+Shift+R).
- For backend changes, ensure
uvicornis running with--reload.
- Backend Logs: The backend uses enhanced logging. Check the terminal output for formatted logs.
- Database Setup Logs: Check
database_setup.login thebackenddirectory. - Frontend Logs: Check the browser console (F12) and the terminal running Vite.
Apache License 2.0. Open usage for commercial and private projects. See LICENSE for details.