openAgent: Open Source Enterprise AI Platform With RAG and Agent Workflows

9月26日 Published inLLM Applications

openAgent is an open-source enterprise AI platform. It integrates intelligent Q&A, natural language data queries, knowledge base management, workflow builders, and agent orchestration. This self-contained system can be deployed on your own infrastructure to avoid vendor lock-in. The platform supports major AI services including DeepSeek, Zhipu AI, and Doubao. It features three conversation modes—direct chat, RAG-augmented responses, and multi-agent collaboration—while maintaining persistent session history and context.

For data analysis, openAgent uses a dual query engine that processes uploaded Excel files and connects directly to PostgreSQL databases. It translates natural language questions into Pandas code or optimized SQL, supporting multi-table joins and cross-file queries. The system also displays the model’s reasoning steps, providing transparency into how it arrives at an answer.

The knowledge base supports PDF, Word, Markdown, and plain text. Vector embeddings are stored in PostgreSQL using the pgvector extension. Documents are semantically partitioned, and retrieval employs a two-pass approach that combines vector similarity with BM25 keyword scoring for more accurate results.

Workflows are managed via a drag-and-drop visual editor. For agent orchestration, openAgent utilizes LangGraph state machines and conditional routing. You can define agent roles to plan, call tools, and decompose complex tasks. Data is isolated per user to ensure privacy. Released under the MIT license, the platform allows for unrestricted commercial use and custom forks.

Backend Stack

  • Web framework: FastAPI + SQLAlchemy + Alembic
  • Database: PostgreSQL 16+
  • Vector store: PostgreSQL + pgvector
  • Agent orchestration: LangGraph with conditional edges
  • Tool calling: Function Calling
  • Model context protocol: MCP
  • RAG retrieval: LangChain Vector Store
  • Conversation memory: ConversationBufferMemory
  • Document processing: PyPDF2 + python-docx + markdown
  • Data analysis: Pandas + NumPy

Frontend Stack

  • Framework: Vue 3 + TypeScript + Vite
  • UI library: Element Plus
  • HTTP client: Axios
  • Workflow editor: Custom visual builder
  • Workflow engine: DAG-based execution
  • Rendering: Canvas API + SVG
  • Drag and drop: Vue Draggable
  • Node connections: Custom link routing

Local Deployment

Requirements

  • Python 3.10+
  • Node.js 18+
  • PostgreSQL 16+

1. Database Setup (PostgreSQL + pgvector)

Option 1: Docker (Recommended)

Create a docker-compose.yml file:

version: '3.8'
services:
  db:
    image: pgvector/pgvector:pg16
    container_name: pgvector-db
    environment:
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: your_password
      POSTGRES_DB: mydb
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: unless-stopped
volumes:
  pgdata:

Start the container:

docker-compose up -d

Verify the pgvector extension is active:

docker exec -it pgvector-db psql -U myuser -d mydb
CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE items (
  id SERIAL PRIMARY KEY,
  embedding vector(3)
);

INSERT INTO items (embedding) VALUES ('[1,1,1]'), ('[2,2,2]'), ('[1,0,0]');

SELECT id, embedding FROM items ORDER BY embedding <-> '[1,1,1]' LIMIT 3;

2. Backend Setup

git clone https://github.com/lkpAgent/chat-agent.git
cd chat-agent/backend

conda create -n chat-agent python=3.10
conda activate chat-agent

pip install -r requirements.txt

cp .env.example .env
# Edit .env: configure the database URL and AI provider keys

cd backend/tests
python init_db.py   # Creates a test user: [email protected] / 123456

python -m uvicorn open_agent.main:app --reload --host 0.0.0.0 --port 8000

3. Frontend Setup

cd ../frontend
npm install
cp .env.example .env
# Set VITE_API_BASE_URL = http://localhost:8000

npm run dev   # Runs at http://localhost:3000

4. Access the Application

  • Frontend: http://localhost:3000
  • Backend API: http://localhost:8000
  • API Documentation: http://localhost:8000/docs

Default Credentials: [email protected] / 123456

5. Backend Configuration (.env)

Key environment variables:

DATABASE_URL=postgresql://myuser:[email protected]:5432/mydb

VECTOR_DB_TYPE=pgvector
PGVECTOR_HOST=127.0.0.1
PGVECTOR_PORT=5432
PGVECTOR_DATABASE=mydb
PGVECTOR_USER=myuser
PGVECTOR_PASSWORD=your_password

LLM_PROVIDER=doubao   # Options: openai, deepseek, doubao, zhipu, moonshot
EMBEDDING_PROVIDER=zhipu

# API keys and model settings
ZHIPU_API_KEY=your-zhipu-key
ZHIPU_MODEL=glm-4
DOUBAO_API_KEY=your-doubao-key
DOUBAO_MODEL=doubao-1-5-pro-32k-250115

TAVILY_API_KEY=your-tavily-key
WEATHER_API_KEY=your_weather_key

API Endpoints

Authentication

  • POST /auth/login
  • POST /auth/register
  • POST /auth/refresh

Conversations

  • GET /chat/conversations
  • POST /chat/conversations
  • POST /chat/conversations/{id}/chat

Knowledge Base

  • POST /knowledge/upload
  • GET /knowledge/documents
  • DELETE /knowledge/documents/{id}

Smart Queries

  • POST /smart-query/query
  • POST /smart-query/upload
  • GET /smart-query/files

Intelligent Q&A

  • Multi-provider support: Compatible with DeepSeek, Zhipu AI, Doubao, and others.
  • Multiple modes: Choose between direct chat, RAG with the knowledge base, or agent-driven collaboration.
  • Memory: Supports multi-turn conversations with full context retention.

Example Agent Workflow User asks: "Is Changsha or Beijing better for travel right now?"

  1. The agent initiates a web search for current travel trends.
  2. It calls a weather tool to get real-time data for both cities.
  3. It compares temperatures and climate conditions.
  4. It identifies local points of interest based on the current season.
  5. It compiles a final recommendation backed by weather and activity data.

Smart Data Queries

  • File analysis: Upload Excel files to perform natural language data analysis.
  • Database connectivity: Connect to PostgreSQL to query data using plain English.
  • Automated code generation: Generates Python (Pandas) or SQL automatically.
  • Relational support: Handles multi-table and cross-file joins.
  • Logic transparency: A visual chain-of-thought display shows the model's underlying logic.

Knowledge Base Management

  • Format support: Processes PDF, Word, Markdown, and TXT files.
  • Vector storage: Uses PostgreSQL with pgvector for efficient similarity searches.
  • Hybrid retrieval: Combines vector similarity with BM25 keyword matching for precision.
  • Organization: Features for uploading, deleting, and tagging documents for RAG workflows.