RFC: Built-in orchestration primitives (parallel, pipeline) and tool approval hooks #201
Replies: 2 comments
-
|
Possibly related contribution from @iakuf — opened #202 which appears to be addressing this. Their summary: Adds two new modules to Implementation: iakuf/flue@feat/orchestration-primitives (diff) This comment was posted automatically when #202 was redirected. The implementation is preserved on the branch above so it can inform the work here. |
Beta Was this translation helpful? Give feedback.
-
|
Update: I've refactored the implementation based on a deeper look at Flue's concurrency model. Key fix — respecting the exclusive-operation lock: the original Two primitives:
On the approval half: I think it belongs on top of the Tests now use a lock-faithful mock session (reproduces the exclusive lock), so they actually verify no two operations ever run on one session, plus session isolation and cleanup. Branch: Happy to align naming/shape with whatever the operation + tool-hook contracts settle on. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I'd like to propose two complementary features for Flue's runtime:
parallel()andpipeline()functions that coordinate multiplesession.task()calls with concurrency control, error handling, and observability.withApproval()wrapper andcreateApprovalGate()factory that pause tool execution until an external system (UI, webhook, Slack) approves or rejects the action.Both are inspired by Claude Code Dynamic Workflows' design philosophy: deterministic orchestration in code, autonomous reasoning in the model.
Motivation
Orchestration (parallel/pipeline)
Currently, running multiple tasks concurrently requires manual
Promise.all+ error handling + concurrency limiting boilerplate:This gets verbose when you need concurrency limits, labeled progress tracking, or mixed fail modes. Claude Code Workflows solved this with
parallel()andpipeline()primitives — Flue would benefit from the same.Tool Approval (human-in-the-loop)
Customer support agents, financial workflows, and any safety-critical agent need a way to pause before executing sensitive tools (refunds, deletions, deployments) and wait for human approval. Currently there's no standard pattern for this in Flue.
Proposed API
Orchestration
Key design decisions:
parallel()uses barrier semantics (waits for ALL tasks), failed tasks returnnullin lenient modepipeline()is barrier-free — fast items don't wait for slow onesAbortSignalfor cancellationphase()andlog()emit observable markers for tracing/UITool Approval
Key design decisions:
withApproval()returns a standardToolDefinition— drop-in replacementonRequest, the gate handles the async waitingonDecisioncallback for audit loggingReal-world Use Case
I'm building a customer support agent (Vue frontend + Flue backend + Cube.js data layer) for a Mini PC e-commerce site. The flow:
Implementation
I have a working implementation with 30 passing tests (vitest). The code is ~200 lines for orchestration and ~150 lines for approval. Happy to submit a PR if the direction looks good.
Reference implementation: https://github.com/iakuf/flue
Questions for Maintainers
@flue/runtime(e.g.@flue/runtime/orchestrate) or as a separate package?phase()emit aFlueEventthatobserve()subscribers can capture? Or is console logging sufficient for now?tool_approval_required), or stay as a userland pattern?Looking forward to feedback! 🙏
Beta Was this translation helpful? Give feedback.
All reactions