Problem
Current AgentFlow deployment requires:
pip install -e . — Python environment setup
agentflow init --db ./data/agentflow.db — Manual DB initialization
agentflow serve --db ./data/agentflow.db --port 8787 — A persistent Python process
- The OpenClaw plugin shells out to CLI (
execFile("python3", ["-m", "agentflow.cli", ...])) for every operation
This is heavy for users who just want "agent task tracking + visualization". The Python service is a separate lifecycle to manage (start/stop/crash/restart), and the CLI bridge adds latency and fragility.
Proposal: Pure TypeScript OpenClaw Plugin
Rewrite the core as a pure TypeScript OpenClaw plugin that embeds better-sqlite3 (or better-sqlite3 bundled) instead of shelling out to Python.
Architecture
plugins/agentflow/
├── openclaw.plugin.json # Plugin manifest
├── package.json # Dependencies: better-sqlite3
├── index.ts # Plugin entry (register tools/commands/routes)
├── store.ts # SQLite wrapper (same schema, pure TS)
├── broker.ts # In-process event broker + SSE
├── api.ts # REST API handlers (embedded in gateway)
└── console/
└── index.html # Static dashboard (served from plugin)
What Changes
| Current |
Proposed |
| Python service (separate process) |
Embedded in OpenClaw gateway (same process) |
pip install -e . |
npm install (or bundled with plugin) |
agentflow init |
Auto-init on first use |
agentflow serve --port 8787 |
Served on gateway port (e.g., /agentflow/) |
CLI bridge (execFile python3) |
Direct function calls (zero IPC) |
| Separate port 8787 |
Gateway port (already running) |
| Python tests |
TypeScript tests |
What Stays
- Same SQLite schema — projects, tasks, runs, triggers, gate_profiles, etc.
- Same REST API —
/api/tasks, /api/task/<id>/move, /api/flow, etc.
- Same Web Console — Same HTML/CSS/JS, served as static file
- Same OpenClaw plugin surface — tools, commands, HTTP routes
Concrete Benefits
- Zero-config install:
openclaw plugin install agentflow → done
- No separate process: DB operations happen in-process, no IPC overhead
- Auto-init: First tool call creates the DB automatically
- Gateway-embedded UI: Dashboard at
http://gateway:3000/agentflow/ — same auth, same port
- Better reliability: No process management, no Python path issues, no
PYTHONPATH hacks
- Type safety: Plugin, store, and API all in TypeScript
Migration Path
- Phase 1: Reimplement
store.ts with better-sqlite3 (same schema)
- Phase 2: Reimplement API handlers as OpenClaw HTTP routes
- Phase 3: Bundle the HTML console as a static asset
- Phase 4: Deprecate the Python CLI (keep for standalone use)
Why Not Fork
The Python CLI is still useful for:
- Standalone use without OpenClaw
- Scripting and automation
- Non-OpenClaw environments
But the OpenClaw plugin path should not depend on it.
Open Questions
- Should the Python CLI remain as a separate package, or live alongside the TS plugin?
- Should the DB path be configurable via plugin config, or default to
~/.openclaw/agentflow.db?
- Should we use better-sqlite3 (native, fast) or sql.js (WASM, no native deps)?
Related Issues
Problem
Current AgentFlow deployment requires:
pip install -e .— Python environment setupagentflow init --db ./data/agentflow.db— Manual DB initializationagentflow serve --db ./data/agentflow.db --port 8787— A persistent Python processexecFile("python3", ["-m", "agentflow.cli", ...])) for every operationThis is heavy for users who just want "agent task tracking + visualization". The Python service is a separate lifecycle to manage (start/stop/crash/restart), and the CLI bridge adds latency and fragility.
Proposal: Pure TypeScript OpenClaw Plugin
Rewrite the core as a pure TypeScript OpenClaw plugin that embeds better-sqlite3 (or better-sqlite3 bundled) instead of shelling out to Python.
Architecture
What Changes
pip install -e .npm install(or bundled with plugin)agentflow initagentflow serve --port 8787/agentflow/)execFile python3)What Stays
/api/tasks,/api/task/<id>/move,/api/flow, etc.Concrete Benefits
openclaw plugin install agentflow→ donehttp://gateway:3000/agentflow/— same auth, same portPYTHONPATHhacksMigration Path
store.tswith better-sqlite3 (same schema)Why Not Fork
The Python CLI is still useful for:
But the OpenClaw plugin path should not depend on it.
Open Questions
~/.openclaw/agentflow.db?Related Issues