Story 3: Migrate 6 built-in flows + library search #13

Open
opened 2026-04-21 14:18:08 +00:00 by timur · 0 comments
Owner

Goal

Delete the 6 DAG-flavored built-in flows and re-seed as Python. Wire up the flow library so Service Agent v3 consults it before generating fresh code.

Parent epic: #10
Depends on: Story 1 (#11) for the Python executor; can run in parallel with Story 2

Scope

Migrate the 6 built-ins to Python

Each becomes a .py file bundled in the hero_logic crate (as include_str!("../templates/<name>.py")) and seeded at startup the same way today's JSON templates are.

  • Service Agent v3 — ~60 lines, was 7-node DAG (run_agent, fetch_catalog, select_services, etc)
  • Optimize Flow — ~150 lines, was 6-node DAG
  • Benchmark Flow — ~80 lines, was 4-node DAG (uses asyncio.gather for parallel N-runs)
  • Visual QA — ~30 lines, was 2-node DAG
  • E2E UX Test — ~50 lines, was 4-node DAG
  • Whiteboard Smoke Test — ~60 lines, was 4-node DAG

All use @flow(...) + with flow.step(...) + the generated clients (no hand-rolled JSON-RPC).

Delete the old .json files + seed.rs's JSON-reading path.

  • Add LogicService.flow_library_search(query: str, limit: u32) -> [str] — returns sids
  • v1: keyword search (title + description substring, case-insensitive, ranked by match count)
  • v2 (follow-up issue): vector similarity using aibroker's embedding endpoint if/when it exists

Agent integration

  • Service Agent v3's first step (in its new Python form) is flow_library_search(task_description)
  • If top result confidence > threshold AND its declared inputs map to the task extractable via a short AI call, use it and run it via play_run_async
  • Else fall through to code generation (existing behavior)
  • If generated code works, prompt the user to save it as a new flow entry

Delete

  • templates/*.json (all 6 files)
  • The include_str! lines in seed.rs for JSON templates
  • Any workflow_from_template / template_list methods (already deprecated but confirm removal)

Done when

  • All 6 built-in flows are Python, pass their respective rubrics/smoke tests
  • flow_library_search("screenshot a page") returns Visual QA as top hit
  • Service Agent v3 demo: "take a screenshot of example.com and verify it says Example Domain" — agent finds Visual QA, runs it, returns the vision verdict, zero fresh code generated
  • The 3 saved examples on E2E UX Test from prior work are ported to the Python version's example storage

Estimate: ~1 week

Can run in parallel with Story 2.

## Goal Delete the 6 DAG-flavored built-in flows and re-seed as Python. Wire up the flow library so Service Agent v3 consults it before generating fresh code. **Parent epic:** #10 **Depends on:** Story 1 (#11) for the Python executor; can run in parallel with Story 2 ## Scope ### Migrate the 6 built-ins to Python Each becomes a `.py` file bundled in the hero_logic crate (as `include_str!("../templates/<name>.py")`) and seeded at startup the same way today's JSON templates are. - `Service Agent v3` — ~60 lines, was 7-node DAG (run_agent, fetch_catalog, select_services, etc) - `Optimize Flow` — ~150 lines, was 6-node DAG - `Benchmark Flow` — ~80 lines, was 4-node DAG (uses `asyncio.gather` for parallel N-runs) - `Visual QA` — ~30 lines, was 2-node DAG - `E2E UX Test` — ~50 lines, was 4-node DAG - `Whiteboard Smoke Test` — ~60 lines, was 4-node DAG All use `@flow(...)` + `with flow.step(...)` + the generated clients (no hand-rolled JSON-RPC). Delete the old `.json` files + `seed.rs`'s JSON-reading path. ### Flow library search - Add `LogicService.flow_library_search(query: str, limit: u32) -> [str]` — returns sids - v1: keyword search (title + description substring, case-insensitive, ranked by match count) - v2 (follow-up issue): vector similarity using aibroker's embedding endpoint if/when it exists ### Agent integration - Service Agent v3's first step (in its new Python form) is `flow_library_search(task_description)` - If top result confidence > threshold AND its declared inputs map to the task extractable via a short AI call, use it and run it via `play_run_async` - Else fall through to code generation (existing behavior) - If generated code works, prompt the user to save it as a new flow entry ### Delete - `templates/*.json` (all 6 files) - The `include_str!` lines in `seed.rs` for JSON templates - Any `workflow_from_template` / `template_list` methods (already deprecated but confirm removal) ## Done when - All 6 built-in flows are Python, pass their respective rubrics/smoke tests - `flow_library_search("screenshot a page")` returns Visual QA as top hit - Service Agent v3 demo: "take a screenshot of example.com and verify it says Example Domain" — agent finds Visual QA, runs it, returns the vision verdict, zero fresh code generated - The 3 saved examples on E2E UX Test from prior work are ported to the Python version's example storage ## Estimate: ~1 week Can run in parallel with Story 2.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_logic#13
No description provided.