⚖️ AI Legal Agent 维语 | 英语 由 Lê Minh Hiếu 创建 — 从交易员变成建设者 为越南企业提供 AI 赋能的法律助理…
⚖️ AI Legal Agent 维语 | 英语 由 Lê Minh Hiếu 创建 — 从交易员变成建设者 为越南企业提供 AI 赋能的法律助理…
Tiếng Việt | English
Created by Lê Minh Hiếu — Trader turned Builder
AI-powered legal assistant for Vietnamese businesses
An AI platform for legal research, contract review, and legal document drafting — all in a VSCode-style interface.
Landing Page — Hero, features, pricing
Dashboard — VSCode-style 3-panel layout
AI Contract Review — Risk analysis, highlights, recommendations
Contract Upload — Drag & drop, AI auto-analysis
The AI is now "Cursor for lawyers" — full autonomous document manipulation capabilities.
Legal AI can autonomously manage your documents and contracts:
"Liệt kê tất cả hợp đồng"
"Đọc hợp đồng thuê mặt bằng số 123"
"Sửa điều khoản phạt trong HĐ này cho đúng luật"
"Soạn NDA giữa công ty A và B, thời hạn 2 năm"
"So sánh bản cũ và bản mới của HĐ lao động"
"Review tất cả 5 hợp đồng trong thư mục Dự án X"
"Tạo thư mục 'Khách hàng ABC' và di chuyển 3 hợp đồng vào đó"
"Xem lịch sử chỉnh sửa của tài liệu này"The AI can chain multiple tools together to complete complex tasks:
User: "Sửa điều khoản phạt trong HĐ ABC cho đúng luật"
AI:
1. read_document → Gets current content
2. search_law → Finds relevant penalty law (8% max per Commercial Law)
3. edit_document → Replaces old penalty clause with compliant version
4. document_history → Shows what changedUser: "Soạn NDA giữa công ty A và B, lưu vào thư mục Khách hàng A"
AI:
1. generate_document → Creates NDA from requirements
2. create_folder → Creates "Khách hàng A" folder (if doesn't exist)
3. write_document → Saves NDA to folderlist_documents — List all documents/contracts with search & filterread_document — Read full content or specific sectionswrite_document — Create new documents with metadata & tagsedit_document — Find & replace text, track changescompare_documents — Diff two documents (summary/detailed/clause-by-clause)create_folder — Create organizational folders for cases/projectsmove_document — Move documents between foldersdelete_document — Soft delete (recoverable for 30 days)generate_document — AI drafts legal documents from requirementsbatch_review — Review multiple documents for risks simultaneouslydocument_history — View full edit history and audit trailUpload contracts for instant AI-powered review:
Review a contract:
POST /v1/contracts/{contract_id}/review-aiGet review results:
GET /v1/contracts/{contract_id}/review-aiResponse structure:
…Self-hosted deployments include a full Platform Super Admin panel for system administration:
Navigate to /platform-admin (requires superadmin role)
The Platform Admin panel provides complete control over your self-hosted Legal AI deployment:
…Legal AI Agent can automatically crawl Vietnamese legal websites to build and update your document database.
.env:CRAWLKIT_API_KEY=your_api_key_hereVia API:
POST /crawler/crawl
{
"url": "https://thuvienphapluat.vn/van-ban/..."
}Via AI Chat:
"Crawl văn bản tại https://thuvienphapluat.vn/van-ban/123"Other endpoints:
GET /crawler/sources — List supported legal sourcesPOST /crawler/discover — Discover legal document links from a pagePOST /crawler/batch — Batch crawl multiple URLsGET /crawler/status — Check CrawlKit configurationGet your free CrawlKit API key →
git clone https://github.com/Paparusi/legal-ai-agent.git
cd legal-ai-agent
pip install -r requirements.txtcp .env.example .env
# Edit .env with your credentials# Run migrations
python scripts/run_migration.py
# Load Vietnamese law data (optional, ~40K documents)
python scripts/load_law_data.py
python scripts/index_chunks.pyuvicorn src.api.main:app --host 0.0.0.0 --port 8080Open http://localhost:8080/static/app.html
# 1. Clone
git clone https://github.com/Paparusi/legal-ai-agent.git
cd legal-ai-agent
# 2. Configure
cp .env.example .env
nano .env # Add your ANTHROPIC_API_KEY
# 3. Start (PostgreSQL + App)
docker compose up -d
# 4. Open
# http://localhost:8080/static/app.htmlThis starts PostgreSQL 15 (with pgvector) and the FastAPI app automatically.
⚠️ Note: The database schema is created automatically on first startup, but law documents are empty by default. To populate the legal database:
# Option 1: Crawl Vietnamese legal websites (recommended)
docker compose exec app python scripts/crawl_thuvien.py
# Option 2: Load from backup (if you have one)
docker compose exec app python scripts/load_law_data.pyWithout legal data, the AI can still review/draft contracts, but legal search won't work.
Works on any Docker-capable device — NAS, Raspberry Pi, VPS, or local server.
# SSH into your NAS/server
git clone https://github.com/Paparusi/legal-ai-agent.git
cd legal-ai-agent
cp .env.example .env
# Edit .env — only ANTHROPIC_API_KEY is required
nano .env
# Start
docker compose up -d
# Access from any device on your network:
# http://NAS_IP:8080/static/app.htmlSystem requirements:
Ports: 8080 (web UI), 5432 (PostgreSQL, optional external access)
Persistent data: PostgreSQL data is stored in a Docker volume (pgdata). Your data survives container restarts and updates.
Update to latest version:
git pull
docker compose build
docker compose up -d…| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/auth/register |
Register |
| POST | /v1/auth/login |
Login |
| POST | /v1/auth/api-key |
Generate API key |
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/legal/ask |
Ask AI agent |
| POST | /v1/legal/ask-stream |
Ask AI (SSE streaming) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/contracts |
List contracts |
| POST | /v1/contracts/upload |
Upload contract |
| POST | /v1/contracts/batch-upload |
Batch upload contracts |
| POST | /v1/contracts/{id}/review |
AI contract review |
| POST | /v1/contracts/{id}/report |
Export Word report |
| POST | /v1/contracts/{id}/diff |
Compare 2 contracts |
| GET | /v1/contracts/{id}/suggestions |
AI suggestions |
| POST | `/v1/contrac |
暂无开放 Issues,或尚未同步最近议题。