DEV Community

Peace Thabiwa
Peace Thabiwa

Posted on

FlowML — Time-Labeled Programming for Machine Learning

⬇️ Download the multi-repo starter pack

Download binflow-starters.zip

Inside you’ll find five ready-to-clone frameworks:

  1. flowml-pytorch-template Minimal FlowML primitives (phases, timelabels) + a tiny demo training loop.
  • flowml/flowml.py → TimeLabel, Phase enum
  • examples/train_demo.py → prints live phases (Focus/Loop/Stress/…)
  • pyproject.toml with deps
  1. binflow-fastapi-agent-template FastAPI service for /events (post/list) to log BINFLOW events (great for local prototyping).
  • app/main.py with POST /events, GET /events, GET /health
  • docker-compose.ymluvicorn-gunicorn-fastapi container
  1. binflow-react-dashboard (Vite + React) Dead-simple UI scaffold to visualize recent phase events.
  • src/main.jsx shows a list; wire it to your FastAPI when ready
  • npm run dev and go
  1. agentic-postgres-stack (Timescale + pgvector) A Postgres stack with extensions enabled and a PoL events schema preloaded.
  • docker-compose.yml + init/01_extensions.sql + 02_schema.sql
  • Adminer on http://localhost:8080 for quick DB poking
  1. automation-cli-template (Typer CLI + Rich + Matplotlib) CLI to annotate events with naive phases and render a timeline chart.
  • binflow_cli/app.pyannotate, timeline commands
  • pyproject.toml with all deps

How to use (copy–paste quickstart)

A) Spin up the database (with Timescale + pgvector)

cd agentic-postgres-stack
docker compose up -d
# DB: localhost:5432  user: postgres  pass: postgres  db: binflow
# Adminer: http://localhost:8080
Enter fullscreen mode Exit fullscreen mode

B) Run the FastAPI agent

cd ../binflow-fastapi-agent-template
docker compose up
# API at http://localhost:8000
# Try: curl -X POST http://localhost:8000/events -H "content-type: application/json" \
#  -d '{"phase":"Focus","payload":{"note":"hello"}}'
Enter fullscreen mode Exit fullscreen mode

C) Start the React dashboard

cd ../binflow-react-dashboard
npm install
npm run dev
# Open http://localhost:5173 (by default)
# Wire the fetch() to http://localhost:8000/events
Enter fullscreen mode Exit fullscreen mode

D) Try the FlowML toy demo

cd ../flowml-pytorch-template
python -m venv .venv && . .venv/bin/activate
pip install -e .
python examples/train_demo.py
# Watch temporal phases print every step
Enter fullscreen mode Exit fullscreen mode

E) Use the CLI to annotate and plot

cd ../automation-cli-template
python -m venv .venv && . .venv/bin/activate
pip install -e .
# Suppose you have events.jsonl (one JSON per line)
python -m binflow_cli.app annotate events.jsonl phases.jsonl
python -m binflow_cli.app timeline pol_events.csv timeline.png
Enter fullscreen mode Exit fullscreen mode

Suggested “next moves” (so you look dangerous in public)

  • Wire the FastAPI → Postgres: add a psycopg insert to write /events into pol_events.
  • Point the React dashboard to the API: fetch every 3–5s and draw simple ribbons (phase by time).
  • Drop FlowML into a real PyTorch project: adapt your training loop with TimeLabel + phase-aware LR/augments.
  • Log PoL from the loop to the DB: unlock leaderboards of “most leveraged” datasets/models/code.
  • Open-source it as “binflow-starters” — ask contributors to add adapters (Keras/JAX) and more signals (drift, entropy).

Top comments (0)