Skip to content

Repository files navigation

🏒 KantorKu

Kantor digital yang sesungguhnya β€” AI worker orchestration framework

Quick Start β€’ Architecture β€’ Workers β€’ API Keys β€’ CLI β€’ Credits

Version Python Next.js License TypeScript


Apa itu KantorKu?

KantorKu adalah framework orchestrasi multi-agent LLM yang memodelkan kantor digital sesungguhnya. Daripada satu AI monolitik, KantorKu menggunakan 14 specialized workers yang berkoordinasi melalui Conductor (CEO) β€” masing-masing dengan model LLM, spesialisasi, dan peran yang berbeda.

Konsep utama: Bayangkan kantor developer sungguhan β€” ada CEO yang mengatur, programmer frontend/backend, QA, auditor, researcher, dan documentation writer. Mereka rapat, diskusi, dan kerja sesuai tugas masing-masing.

Fitur Utama

  • 🧠 14 Specialized Workers β€” masing-masing dengan model & spesialisasi berbeda
  • πŸ“‹ Contract-Based Workflow β€” kontrak formal sebelum eksekusi, dengan approval gates
  • πŸ’¬ Interactive Questions β€” AI Manager bisa bertanya dengan pilihan A/B/C/Other (seperti Claude)
  • 🏒 BriefingRoom β€” tim diskusi sebelum eksekusi dimulai
  • πŸ’Ύ 3-Ring Memory β€” DuckDB (hot) β†’ SQLite (warm) β†’ Vector DB (cold)
  • πŸ”„ DAG Execution β€” parallel task execution dengan dependency resolution
  • πŸ›‘οΈ Circuit Breakers β€” auto-recovery saat provider down
  • πŸ’° Cost Guard β€” budget enforcement & real-time cost tracking
  • πŸ“Š Full Observability β€” distributed tracing, spans, metrics
  • πŸ”Œ 7 LLM Providers β€” Anthropic, Google, MiniMax, DeepSeek, OpenAI, xAI, Ollama
  • πŸ–₯️ 3-Zone UI β€” Lobby (Chat), Ruang Kerja (Workers), Dashboard (Monitoring)
  • πŸ”„ Undo/Redo β€” contract action history with undo/redo support
  • πŸ—οΈ Cache Panel β€” LLM response cache visualization
  • πŸ”‘ Per-Worker API Keys β€” configure provider/model/key per worker
  • πŸ€– CLI Tool β€” interactive setup, chat, worker management

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      KantorKu                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   web-ui/      β”‚   framework/                           β”‚
β”‚   (Next.js)    β”‚   (Python)                             β”‚
β”‚                β”‚                                        β”‚
β”‚  πŸ–₯️ Web UI     β”‚  🐍 Backend engine                     β”‚
β”‚  Dashboard     β”‚  Workers + Memory + Providers          β”‚
β”‚  Chat panel    β”‚  Event bus + DAG + Hooks               β”‚
β”‚  Monitoring    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  Settings      β”‚  β”‚ tui/     β”‚  β”‚ interface/       β”‚   β”‚
β”‚                β”‚  β”‚ CLI+TUI  β”‚  β”‚ Server+MW+Health β”‚   β”‚
β”‚                β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Framework Layers (20+)

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Conductor     β”‚  ← CEO β€” understands, drafts, orchestrates
                    β”‚   (CEO/Manager) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                    β”‚                     β”‚
  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Intake     β”‚   β”‚ BriefingRoom     β”‚   β”‚ GroupChannel  β”‚
  β”‚ (Parse)    β”‚   β”‚ (Team Discuss)   β”‚   β”‚ (Discussion)  β”‚
  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                    β”‚                     β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚ TodoReview      β”‚  ← Team reviews TODOs
                    β”‚ Phase           β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                    β”‚                      β”‚
  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
  β”‚ DAG        β”‚   β”‚ Context Pool     β”‚   β”‚ Worker Hub     β”‚
  β”‚ Resolver   β”‚   β”‚ (DeepSeek V3.2)  β”‚   β”‚ (P2P DM)       β”‚
  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                    β”‚                      β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚ 14 Workers      β”‚  ← Execute tasks
                    β”‚ (Coding/Verify/ β”‚
                    β”‚  Support/Trans) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                    β”‚                      β”‚
  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Debrief    β”‚   β”‚ 3-Ring Memory    β”‚   β”‚ EventBus       β”‚
  β”‚ (Lessons)  β”‚   β”‚ (Duck/SQLite/Vec)β”‚   β”‚ (Real-time)    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Workers

Coding Squad 🟦

Worker Emoji Model Role
coder_frontend 🎨 Claude Sonnet 4.6 React/CSS/UI specialist
coder_backend βš™οΈ MiniMax M2.7 Python/Rust/Systems
coder_wiring πŸ”Œ Gemini 3.1 Pro API/WS/MCP/Glue

Verification Squad 🟩

Worker Emoji Model Role
verifier_designer πŸ‘οΈ Gemini 3.1 Pro Visual/UX judge
verifier_engineer βœ… MiniMax M2.5 Logic/test/security

Support Squad 🟧

Worker Emoji Model Role
debugger πŸ› DeepSeek V3.2 Root cause analysis
scout πŸ” Gemini 2.5 Pro Research & documentation
auditor πŸ”’ Claude Sonnet 4.6 Architecture review
scribe πŸ“ DeepSeek V4 Flash Documentation writing
summarizer πŸ“Š DeepSeek V4 Flash Context compression
sentinel πŸ›‘οΈ Ollama Llama3 Error monitoring

Translation Squad πŸŸͺ

Worker Emoji Model Role
intake πŸ“‹ Ollama Llama3 Message parsing
narrator πŸ“– Ollama Llama3 Output formatting

Special

Component Model Role
Conductor Claude Opus 4.6 CEO β€” orchestration
Context Pool (x3) DeepSeek V3.2 Proactive prefetch

Quick Start

Prerequisites

  • Python 3.11+ (untuk framework)
  • Node.js 18+ (untuk web-ui & CLI)
  • Bun (recommended, untuk web-ui)

1. Clone Repository

git clone https://github.com/Wolfvin/KantorKu.git
cd KantorKu

2. Setup API Keys

Via CLI (Recommended):

cd framework
pip install -e ".[all]"
kantorku setup

Via Environment Variables:

export ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="AIza..."
export MINIMAX_API_KEY="..."
export DEEPSEEK_API_KEY="sk-..."
export OPENAI_API_KEY="sk-..."
export XAI_API_KEY="xai-..."

3a. Run Interface (Standalone Mode)

cd web-ui
npm install
npm run dev
# Open http://localhost:3000

3b. Run Full Stack (Python + Next.js)

# Terminal 1: Python backend
cd framework
pip install -e ".[all]"
kantorku serve --config kantorku.toml

# Terminal 2: Next.js web-ui
cd web-ui
npm install
npm run dev

3c. Run TUI/CLI

cd framework
pip install -e ".[all]"
kantorku tui         # Terminal UI mode
kantorku chat        # Chat mode
kantorku --help      # All commands

API Keys

KantorKu mendukung 8 LLM providers. Anda tidak perlu semua β€” cukup yang Anda gunakan.

Provider Env Variable Workers Required?
Anthropic ANTHROPIC_API_KEY Conductor, coder_frontend, auditor βœ… Recommended
Google GOOGLE_API_KEY coder_wiring, verifier_designer, scout βœ… Recommended
MiniMax MINIMAX_API_KEY coder_backend, verifier_engineer Optional
DeepSeek DEEPSEEK_API_KEY debugger, scribe, summarizer, Pool βœ… Recommended
OpenAI OPENAI_API_KEY coder_wiring (Codex) Optional
xAI XAI_API_KEY debugger (Grok) Optional
Ollama (local) intake, narrator, sentinel Optional (free, local)
Z-AI SDK (built-in) Standalone mode βœ… For web-ui

Minimal Setup (Cheapest)

Untuk menjalankan KantorKu dengan biaya minimal:

  1. Z-AI SDK β€” gratis untuk standalone mode
  2. Ollama β€” gratis, jalankan lokal (intake, narrator, sentinel)
  3. DeepSeek β€” murah ($0.28/M) untuk support workers

CLI / TUI

kantorku              # Show banner & quick start
kantorku init         # Scaffold new project
kantorku setup        # Interactive API key wizard
kantorku tui          # Terminal UI (Textual)
kantorku chat         # Chat with Conductor
kantorku serve        # Start Python backend
kantorku dev          # Start Next.js web-ui
kantorku worker list  # List all workers
kantorku worker show  # Show worker details
kantorku status       # System health check
kantorku version      # Show version

Contract Lifecycle

IDLE β†’ MANAGER_THINKING β†’ TEAM_CONSULT β†’ CLARIFYING β†’
CONTRACT_PRESENTED β†’ TEAM_REVIEW β†’ TODO_REVIEW β†’
CLIENT_FEEDBACK β†’ WORKING β†’ DONE

Setiap permintaan client melalui alur formal ini β€” memastikan transparansi, persetujuan, dan kualitas.


3-Zone Interface

Zone Panel Fungsi
πŸ›οΈ Lobby Panel 1 Client ↔ Manager chat, Interactive Questions
πŸ—οΈ Ruang Kerja Panel 2 Worker grid, Contract, BriefingRoom, DAG
πŸ“Š Dashboard Panel 3 Cost, Health, Metrics, Memory, Traces

Project Structure

KantorKu/
β”œβ”€β”€ framework/              # Python backend
β”‚   β”œβ”€β”€ kantorku/           # Main package
β”‚   β”‚   β”œβ”€β”€ office.py       # Office class (entry point)
β”‚   β”‚   β”œβ”€β”€ interface/      # Server-side infrastructure
β”‚   β”‚   β”‚   β”œβ”€β”€ server.py   # FastAPI + WebSocket + SSE
β”‚   β”‚   β”‚   β”œβ”€β”€ middleware.py # Auth, logging, rate-limit, cost guard
β”‚   β”‚   β”‚   β”œβ”€β”€ health.py   # Health monitoring
β”‚   β”‚   β”‚   β”œβ”€β”€ protocol.py # WS/SSE message protocol
β”‚   β”‚   β”‚   β”œβ”€β”€ persistence.py # Checkpoint & crash recovery
β”‚   β”‚   β”‚   └── task_queue.py # Persistent queue + DLQ
β”‚   β”‚   β”œβ”€β”€ tui/            # Terminal UI + CLI (merged)
β”‚   β”‚   β”‚   β”œβ”€β”€ app.py      # TUI app (Textual)
β”‚   β”‚   β”‚   β”œβ”€β”€ cli.py      # CLI entry point
β”‚   β”‚   β”‚   β”œβ”€β”€ connection.py # WS/HTTP/SSE client
β”‚   β”‚   β”‚   β”œβ”€β”€ commands.py # Slash commands
β”‚   β”‚   β”‚   β”œβ”€β”€ themes.py   # Color schemes
β”‚   β”‚   β”‚   └── markdown_renderer.py # Rich markdown
β”‚   β”‚   β”œβ”€β”€ layers/         # Conductor, BriefingRoom, GroupChannel...
β”‚   β”‚   β”œβ”€β”€ workers/        # 14 built-in workers
β”‚   β”‚   β”œβ”€β”€ providers/      # 7 LLM providers + router
β”‚   β”‚   β”œβ”€β”€ memory/         # 3-Ring memory system
β”‚   β”‚   β”œβ”€β”€ pool/           # Context pool
β”‚   β”‚   β”œβ”€β”€ events/         # EventBus + EventEmitter
β”‚   β”‚   β”œβ”€β”€ redteam/        # Adversarial testing tools
β”‚   β”‚   β”œβ”€β”€ worker/         # Base classes + registry
β”‚   β”‚   β”œβ”€β”€ config/         # Settings (TOML loader)
β”‚   β”‚   └── ...             # DAG, hooks, cost, cache, etc.
β”‚   β”œβ”€β”€ workers/            # Worker plugins (SKILL.md + plugin.json)
β”‚   β”œβ”€β”€ examples/           # Usage examples
β”‚   β”œβ”€β”€ tests/              # Test suite
β”‚   β”œβ”€β”€ kantorku.toml       # Configuration
β”‚   └── pyproject.toml      # Python package
β”‚
β”œβ”€β”€ web-ui/                 # Next.js frontend (Web UI)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/            # Next.js App Router + API routes
β”‚   β”‚   β”œβ”€β”€ components/     # UI components (kantorku/ + shadcn/ui)
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom React hooks
β”‚   β”‚   └── lib/kantorku/   # Types, store, workers data, API client
β”‚   β”œβ”€β”€ package.json
β”‚   └── ...
β”‚
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ .github/                # CI/CD, issue templates
β”œβ”€β”€ CREDITS.md              # Credits & acknowledgments
β”œβ”€β”€ CHANGELOG.md            # Version history
β”œβ”€β”€ CONTRIBUTING.md         # Contribution guidelines
β”œβ”€β”€ CODE_OF_CONDUCT.md      # Code of conduct
β”œβ”€β”€ SECURITY.md             # Security policy
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ LICENSE                 # MIT
└── .gitignore

Tech Stack

Frontend (Web UI)

Technology Purpose
Next.js 16 React framework with App Router
React 19 UI component library
TypeScript (strict) Type-safe code with noImplicitAny
Zustand State management with persistence
shadcn/ui UI primitives (Radix-based)
Tailwind CSS 4 Utility-first styling
Recharts Data visualization
react-markdown Safe markdown rendering (XSS-safe)
Framer Motion Animations
Lucide Icon library

Backend (Framework)

Technology Purpose
FastAPI Async web framework
Uvicorn ASGI server
Pydantic Data validation
DuckDB Ring 1 memory
aiosqlite Ring 2 memory
httpx Async HTTP client

Cost Optimization

Strategy Implementation
Model routing Cheap workers (Ollama) for simple tasks, expensive (Claude) for reasoning
Circuit breaker Auto-switch provider when one is down
Cost guard Middleware blocks requests when budget exceeded
LLM cache Avoid redundant API calls
Context pool Prefetch once, reuse many times

Estimated costs per task (with full team):

  • Simple task: ~$0.01-0.05
  • Moderate task: ~$0.05-0.20
  • Complex task: ~$0.20-1.00

License

MIT License β€” see LICENSE for details.


Credits

See CREDITS.md for full acknowledgments and source repositories.


"Kantor yang sesungguhnya bukan soal gedung β€” tapi soal orang-orang yang bekerja bersama."

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages