abstractflow 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. abstractflow-0.3.0/CHANGELOG.md +174 -0
  2. {abstractflow-0.1.0 → abstractflow-0.3.0}/LICENSE +2 -0
  3. {abstractflow-0.1.0 → abstractflow-0.3.0}/MANIFEST.in +2 -0
  4. abstractflow-0.3.0/PKG-INFO +413 -0
  5. abstractflow-0.3.0/README.md +360 -0
  6. abstractflow-0.3.0/abstractflow/__init__.py +91 -0
  7. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow/__main__.py +2 -0
  8. abstractflow-0.3.0/abstractflow/adapters/__init__.py +11 -0
  9. abstractflow-0.3.0/abstractflow/adapters/agent_adapter.py +124 -0
  10. abstractflow-0.3.0/abstractflow/adapters/control_adapter.py +615 -0
  11. abstractflow-0.3.0/abstractflow/adapters/effect_adapter.py +645 -0
  12. abstractflow-0.3.0/abstractflow/adapters/event_adapter.py +307 -0
  13. abstractflow-0.3.0/abstractflow/adapters/function_adapter.py +97 -0
  14. abstractflow-0.3.0/abstractflow/adapters/subflow_adapter.py +74 -0
  15. abstractflow-0.3.0/abstractflow/adapters/variable_adapter.py +317 -0
  16. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow/cli.py +2 -0
  17. abstractflow-0.3.0/abstractflow/compiler.py +2027 -0
  18. abstractflow-0.3.0/abstractflow/core/__init__.py +5 -0
  19. abstractflow-0.3.0/abstractflow/core/flow.py +247 -0
  20. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow/py.typed +2 -0
  21. abstractflow-0.3.0/abstractflow/runner.py +348 -0
  22. abstractflow-0.3.0/abstractflow/visual/__init__.py +43 -0
  23. abstractflow-0.3.0/abstractflow/visual/agent_ids.py +29 -0
  24. abstractflow-0.3.0/abstractflow/visual/builtins.py +789 -0
  25. abstractflow-0.3.0/abstractflow/visual/code_executor.py +214 -0
  26. abstractflow-0.3.0/abstractflow/visual/event_ids.py +33 -0
  27. abstractflow-0.3.0/abstractflow/visual/executor.py +2789 -0
  28. abstractflow-0.3.0/abstractflow/visual/interfaces.py +347 -0
  29. abstractflow-0.3.0/abstractflow/visual/models.py +252 -0
  30. abstractflow-0.3.0/abstractflow/visual/session_runner.py +168 -0
  31. abstractflow-0.3.0/abstractflow/visual/workspace_scoped_tools.py +261 -0
  32. abstractflow-0.3.0/abstractflow.egg-info/PKG-INFO +413 -0
  33. abstractflow-0.3.0/abstractflow.egg-info/SOURCES.txt +97 -0
  34. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow.egg-info/requires.txt +6 -2
  35. {abstractflow-0.1.0 → abstractflow-0.3.0}/pyproject.toml +16 -8
  36. {abstractflow-0.1.0 → abstractflow-0.3.0}/setup.py +2 -0
  37. abstractflow-0.3.0/tests/test_compiler.py +100 -0
  38. abstractflow-0.3.0/tests/test_flow.py +252 -0
  39. abstractflow-0.3.0/tests/test_python_code_node_params.py +131 -0
  40. abstractflow-0.3.0/tests/test_role_workflows_are_valid_and_sota.py +159 -0
  41. abstractflow-0.3.0/tests/test_runner.py +191 -0
  42. abstractflow-0.3.0/tests/test_sequence_parallel_nodes.py +202 -0
  43. abstractflow-0.3.0/tests/test_switch_node.py +156 -0
  44. abstractflow-0.3.0/tests/test_system_datetime_node.py +94 -0
  45. abstractflow-0.3.0/tests/test_visual_agent_reentry_re_resolves_inputs.py +89 -0
  46. abstractflow-0.3.0/tests/test_visual_agent_scratchpad_output.py +169 -0
  47. abstractflow-0.3.0/tests/test_visual_agent_structured_output_pin.py +91 -0
  48. abstractflow-0.3.0/tests/test_visual_agent_system_prompt_and_tools_override.py +184 -0
  49. abstractflow-0.3.0/tests/test_visual_agent_tool_serialization.py +90 -0
  50. abstractflow-0.3.0/tests/test_visual_agent_trace_report_node.py +107 -0
  51. abstractflow-0.3.0/tests/test_visual_bool_var_node.py +61 -0
  52. abstractflow-0.3.0/tests/test_visual_custom_events.py +190 -0
  53. abstractflow-0.3.0/tests/test_visual_file_nodes.py +49 -0
  54. abstractflow-0.3.0/tests/test_visual_for_node.py +97 -0
  55. abstractflow-0.3.0/tests/test_visual_if_branching.py +76 -0
  56. abstractflow-0.3.0/tests/test_visual_ignores_unreachable_nodes.py +107 -0
  57. abstractflow-0.3.0/tests/test_visual_interfaces.py +82 -0
  58. abstractflow-0.3.0/tests/test_visual_llm_call_integration.py +282 -0
  59. abstractflow-0.3.0/tests/test_visual_llm_call_structured_output_pin.py +136 -0
  60. abstractflow-0.3.0/tests/test_visual_llm_call_tools_and_result_output.py +140 -0
  61. abstractflow-0.3.0/tests/test_visual_loop_node.py +98 -0
  62. abstractflow-0.3.0/tests/test_visual_loop_pure_node_invalidation.py +119 -0
  63. abstractflow-0.3.0/tests/test_visual_parse_json_node.py +94 -0
  64. abstractflow-0.3.0/tests/test_visual_pin_defaults.py +97 -0
  65. abstractflow-0.3.0/tests/test_visual_pure_nodes.py +703 -0
  66. abstractflow-0.3.0/tests/test_visual_resume_rehydrates_node_outputs.py +93 -0
  67. abstractflow-0.3.0/tests/test_visual_set_var_typed_defaults.py +75 -0
  68. abstractflow-0.3.0/tests/test_visual_split_node.py +97 -0
  69. abstractflow-0.3.0/tests/test_visual_stringify_json_node.py +135 -0
  70. abstractflow-0.3.0/tests/test_visual_subflow_recursion.py +231 -0
  71. abstractflow-0.3.0/tests/test_visual_subflow_registry_reachability.py +66 -0
  72. abstractflow-0.3.0/tests/test_visual_tool_calls_node.py +134 -0
  73. abstractflow-0.3.0/tests/test_visual_tools_allowlist_node.py +51 -0
  74. abstractflow-0.3.0/tests/test_visual_var_decl_node.py +114 -0
  75. abstractflow-0.3.0/tests/test_visual_variables_nodes.py +389 -0
  76. abstractflow-0.3.0/tests/test_visual_while_node.py +96 -0
  77. abstractflow-0.3.0/tests/test_visual_while_pure_node_invalidation.py +116 -0
  78. abstractflow-0.3.0/tests/test_visual_workflow_io.py +272 -0
  79. abstractflow-0.3.0/tests/test_visual_ws_agent_node_lifecycle.py +202 -0
  80. abstractflow-0.3.0/tests/test_visual_ws_answer_user.py +117 -0
  81. abstractflow-0.3.0/tests/test_visual_ws_custom_events_order.py +109 -0
  82. abstractflow-0.3.0/tests/test_visual_ws_delay_node.py +88 -0
  83. abstractflow-0.3.0/tests/test_visual_ws_memory_effects.py +140 -0
  84. abstractflow-0.3.0/tests/test_visual_ws_memory_rehydrate_effect.py +204 -0
  85. abstractflow-0.3.0/tests/test_visual_ws_nested_subworkflow_descendants.py +214 -0
  86. abstractflow-0.3.0/tests/test_visual_ws_observability.py +207 -0
  87. abstractflow-0.3.0/tests/test_visual_ws_on_schedule_node.py +162 -0
  88. abstractflow-0.3.0/tests/test_visual_ws_run_controls.py +184 -0
  89. abstractflow-0.3.0/tests/test_visual_ws_run_controls_responsive.py +104 -0
  90. abstractflow-0.3.0/tests/test_visual_ws_run_ids_for_child_runs.py +157 -0
  91. abstractflow-0.3.0/tests/test_visual_ws_subflow.py +398 -0
  92. abstractflow-0.3.0/tests/test_visual_ws_trace_update_streaming.py +175 -0
  93. abstractflow-0.3.0/tests/test_visual_ws_waiting.py +144 -0
  94. abstractflow-0.3.0/tests/test_web_backend_dev_import_paths.py +47 -0
  95. abstractflow-0.3.0/tests/test_web_workspace_scoped_tools.py +51 -0
  96. abstractflow-0.1.0/CHANGELOG.md +0 -30
  97. abstractflow-0.1.0/PKG-INFO +0 -238
  98. abstractflow-0.1.0/README.md +0 -186
  99. abstractflow-0.1.0/abstractflow/__init__.py +0 -111
  100. abstractflow-0.1.0/abstractflow.egg-info/PKG-INFO +0 -238
  101. abstractflow-0.1.0/abstractflow.egg-info/SOURCES.txt +0 -16
  102. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow.egg-info/dependency_links.txt +0 -0
  103. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow.egg-info/entry_points.txt +0 -0
  104. {abstractflow-0.1.0 → abstractflow-0.3.0}/abstractflow.egg-info/top_level.txt +0 -0
  105. {abstractflow-0.1.0 → abstractflow-0.3.0}/setup.cfg +0 -0
@@ -0,0 +1,174 @@
1
+ # Changelog
2
+
3
+ All notable changes to AbstractFlow will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - **AbstractCode UI event demo flows** (`abstractflow/web/flows/*.json`):
12
+ - `acagent_message_demo.json`: `abstractcode.message`
13
+ - `acagent_ask_demo.json`: durable ask+wait via `wait_event.prompt`
14
+ - `acagent_tool_events_demo.json`: `abstractcode.tool_execution` + `abstractcode.tool_result`
15
+ - **Tool observability wiring improvements (Visual nodes)**:
16
+ - `LLM Call` exposes `tool_calls` as a first-class output pin (same as `result.tool_calls`) for easier wiring into `Tool Calls` / `Emit Event`.
17
+ - `Agent` exposes best-effort `tool_calls` / `tool_results` extracted from its scratchpad trace (post-run ergonomics).
18
+ - **Pure Utility Nodes (Runtime-backed)**:
19
+ - `Stringify JSON` (`stringify_json`): Render JSON (or JSON-ish strings) into text with a `mode` dropdown (`none` | `beautify` | `minified`). Implementation delegates to `abstractruntime.rendering.stringify_json` for consistent host behavior.
20
+ - `Agent Trace Report` (`agent_trace_report`): Render an agent scratchpad (`node_traces`) into a condensed Markdown timeline of LLM calls and tool actions (full tool args + results, no truncation). Implementation delegates to `abstractruntime.rendering.render_agent_trace_markdown`.
21
+
22
+ ### Fixed
23
+ - **FlowRunner SUBWORKFLOW auto-drive**: `FlowRunner.run()` no longer hangs if the runtime registry contains only subworkflow specs (common in unit tests). It now falls back to the runner’s own root `WorkflowSpec` when resuming/bubbling parents.
24
+
25
+ ## [0.3.0] - 2025-01-06
26
+
27
+ ### Added
28
+ - **VisualFlow Interface System** (`abstractflow/visual/interfaces.py`): Declarative workflow interface markers for portable host validation, enabling workflows to be run as specialized capabilities with known IO contracts
29
+ - `abstractcode.agent.v1` interface: Host-configurable request → response contract for running a workflow as an AbstractCode agent
30
+ - Interface validation with required/recommended pin specifications (provider/model/tools/request/response)
31
+ - Auto-scaffolding support: enabling `abstractcode.agent.v1` auto-creates `On Flow Start` / `On Flow End` nodes with required pins
32
+ - **Structured Output Support**: Visual `LLM Call` and `Agent` nodes accept optional `response_schema` input pin (JSON Schema object) for schema-conformant responses
33
+ - New literal node `JSON Schema` (`json_schema`) to author schema objects
34
+ - New `JsonSchemaNodeEditor` UI component for authoring schemas in the visual editor
35
+ - Pin-driven schema overrides node config and enables durable structured-output enforcement via AbstractRuntime `LLM_CALL`
36
+ - **Tool Calling Infrastructure**:
37
+ - Visual `LLM Call` nodes support optional **tool calling** via `tools` allowlist input (pin or node config)
38
+ - Expose structured `result` output object (normalized LLM response including `tool_calls`, `usage`, `trace_id`)
39
+ - Inline tools dropdown in node UI (when `tools` pin not connected)
40
+ - Visual `Tool Calls` node (`tool_calls`) to execute tool call requests via AbstractRuntime `EffectType.TOOL_CALLS`
41
+ - New pure node `Tools Allowlist` (`tools_allowlist`) with inline multi-select for workflow-scope tool lists
42
+ - Dedicated `tools` pin type (specialized `string[]`) for `On Flow Start` parameters
43
+ - **Control Flow & Loop Enhancements**:
44
+ - New control node `For` (`for`) for numeric loops with `start`/`end`/`step` inputs and `i`/`index` outputs
45
+ - `While` node now exposes `index` output pin (0-based iteration count) and `item:any` output pin for parity with `ForEach`
46
+ - `Loop` (Foreach) now invalidates cached pure-node outputs per-iteration (fixes scratchpad accumulation)
47
+ - **Workflow Variables**:
48
+ - New pure node `Variable` (`var_decl`) to declare workflow-scope persistent variables with explicit types
49
+ - New pure node `Bool Variable` (`bool_var`) for boolean variables with typed outputs
50
+ - New execution node `Set Variables` (`set_vars`) to update multiple variables in a single step
51
+ - New execution node `Set Variable Property` (`set_var_property`) to update nested object properties
52
+ - `Get Variable` (`get_var`) reads from durable `run.vars` by dotted path
53
+ - `Set Variable` (`set_var`) updates `run.vars` with pass-through execution semantics
54
+ - **Custom Events** (Blueprint-style):
55
+ - `On Event` listeners compiled into dedicated durable subworkflows (auto-started, session-scoped)
56
+ - `Emit Event` node dispatches durable events via AbstractRuntime
57
+ - **Run History & Observability**:
58
+ - New web API endpoints: `/api/runs`, `/api/runs/{run_id}/history`, `/api/runs/{run_id}/artifacts/{artifact_id}`
59
+ - UI "Run History" picker (🕘) to open past runs and apply pause/resume/cancel controls
60
+ - Run modal shows clickable **run id** pill (hover → copy to clipboard)
61
+ - Run modal header token badge reflects cumulative LLM usage across entire run tree
62
+ - WebSocket events include JSON-safe ISO timestamp (`ts`)
63
+ - Runtime node trace entries streamed incrementally over WebSocket (`trace_update`)
64
+ - Agent details panel renders live sub-run trace with expandable prompts/responses/errors
65
+ - **Pure Utility Nodes**:
66
+ - `Parse JSON` (`parse_json`) to convert JSON/JSON-ish strings into objects
67
+ - `coalesce` (first non-null selection by pin order)
68
+ - `string_template` (render `{{path.to.value}}` with filters: json, join, trim)
69
+ - `array_length`, `array_append`, `array_dedup`
70
+ - `Compare` (`compare`) now has `op` input pin supporting `==`, `>=`, `>`, `<=`, `<`
71
+ - `get` (Get Property) supports `default` input and safer nested path handling (e.g. `a[0].b`)
72
+ - **Memory Node Enhancements**:
73
+ - `Memorize` (`memory_note`) adds optional `location` input
74
+ - `Memorize` supports **Keep in context** toggle to rehydrate notes into `context.messages`
75
+ - `Recall` (`memory_query`) adds `tags_mode` (all/any), `usernames`, `locations` inputs
76
+ - **Subflow Enhancements**:
77
+ - `Subflow` supports **Inherit context** toggle to seed child run's `context.messages` from parent
78
+ - `multi_agent_state_machine` accepts `workspace_root` parameter to scope agent file/system tools
79
+ - **Visual Execution Defaults**:
80
+ - Default **LLM HTTP timeout** (7200s, overrideable via `ABSTRACTFLOW_LLM_TIMEOUT_S`)
81
+ - Default **max output token cap** (4096, overrideable via `ABSTRACTFLOW_LLM_MAX_OUTPUT_TOKENS`)
82
+ - **UI/UX Improvements**:
83
+ - Run preflight validation panel with itemized "Fix before running" checklist
84
+ - Node tooltips available in palette and on-canvas (hover > 1s)
85
+ - Node palette exposed transforms (`trim`, `substring`, `format`) and math ops (`modulo`, `power`)
86
+ - Enhanced `PropertiesPanel` with structured output configuration
87
+ - Improved `RunFlowModal` with better input validation and error display
88
+ - JSON validation and error handling across executor and frontend (`web/frontend/src/utils/validation.ts`)
89
+
90
+ ### Changed
91
+ - **Workflow-Agent Interface UX**: Enabling `abstractcode.agent.v1` auto-scaffolds `On Flow Start` / `On Flow End` pins (provider/model/tools)
92
+ - **Memory Nodes UX**: `memory_note` labeled **Memorize** (was Remember) to align with AbstractCode `/memorize`
93
+ - **Flow Library Modal**: Flow name/description edited via inline pencil icons (removed Rename/Edit Description buttons)
94
+ - **Run Modal UX**:
95
+ - String inputs default to 3-line textarea
96
+ - Modal actions pinned in footer (body scrolls)
97
+ - No truncation of sub-run/memory previews (full content on demand)
98
+ - JSON panels (`Raw JSON`, `Trace JSON`, `Scratchpad`) syntax-highlighted
99
+ - **Node Palette Organization**:
100
+ - Removed **Effects** category
101
+ - Added **Memory** category (memories + file IO)
102
+ - Added **Math** category (after Variables)
103
+ - Moved **Delay** to **Events**
104
+ - Split into **Literals**, **Variables**, **Data** (renamed from "Data" to **Transforms**)
105
+ - Reordered **Control** nodes (loops → branching → conditions)
106
+ - `System Date/Time` moved to **Events**
107
+ - `Provider Catalog` + `Models Catalog` moved to **Literals**
108
+ - `Tool Calls` moved from **Effects** to **Core** (reordered: Subflow, Agent, LLM Call, Tool Calls, Ask User, Answer User)
109
+ - **Models Catalog**: Removed deprecated `allowed_models` input pin (in-node multi-select synced with right panel)
110
+ - **Node/Pin Tooltips**: Appear after 2s hover, rendered in overlay layer (no clipping)
111
+ - **Python Code Nodes**: Include in-node **Edit Code** button; editor injects "Available variables" comment block
112
+ - **Execution Highlighting**: Stronger, more diffuse bloom for readability during runs; afterglow decays smoothly (3s), highlights only taken edges
113
+ - **Data Edges**: Colored by data type (based on source pin type)
114
+
115
+ ### Fixed
116
+ - **Recursive Subflows**: Visual data-edge cache (`flow._node_outputs`) now isolated per `run_id` to prevent stale outputs leaking across nested runs (fixes self/mutual recursion with pure nodes like `compare`, `subtract`)
117
+ - **Durable Persistence**: `on_flow_start` no longer leaks internal `_temp` into cached node outputs (prevented `RecursionError: maximum recursion depth exceeded`)
118
+ - **WebSocket Run Controls**: Pause/resume/cancel no longer block on per-connection execution lock (responsive during long-running LLM/Agent nodes)
119
+ - **WebSocket Resilience**:
120
+ - Controls resilient to transient disconnects (can send with explicit `run_id`, UI reconnects-and-sends)
121
+ - Execution resilient to UI disconnects (dropped connection doesn't cancel in-flight run)
122
+ - **VisualFlow Execution**: Ignores unreachable/disconnected execution nodes (orphan `llm_call`/`subflow` can't fail initialization)
123
+ - **Loop Nodes**:
124
+ - `Split` avoids spurious empty trailing items (e.g. `"A@@B@@"`) so `Loop` doesn't execute extra empty iteration
125
+ - Scheduler-node outputs in WebSocket `node_complete`: Loop/While/For sync persisted `{index,...}` outputs to `flow._node_outputs` (UI no longer shows stale index)
126
+ - **Pure Node Behavior**:
127
+ - `Concat` infers stable pin order (a..z) when template metadata missing
128
+ - `Set Variable` defaulting for typed primitives: `boolean/number/string` pins default to `false/0/""` instead of `None`
129
+ - **Agent Nodes**: Reset per-node state when re-entered (e.g. inside `Loop` iterations) so each iteration re-resolves inputs
130
+ - **Run Modal Observability**:
131
+ - WebSocket `node_start`/`node_complete` events include `runId` (distinguish root vs child runs)
132
+ - Visual Agent nodes start ReAct subworkflow in **async+wait** mode for incremental ticking
133
+ - Run history replay synthesizes missing `node_complete` events for steps left open in durable ledger
134
+ - **Canvas Highlighting**: Robust to fast child-run emissions (race with `node_start` before `runId` state update fixed)
135
+ - **WebSocket Subworkflow Waits**: Correctly close waiting node when run resumes past `WAITING(reason=SUBWORKFLOW)`
136
+ - **Web Run History**: Reliably shows persisted runs regardless of server working directory (backend defaults to `abstractflow/web/runtime` unless `ABSTRACTFLOW_RUNTIME_DIR` set)
137
+ - **Cancel Run**: No longer surfaces as `flow_error` from `asyncio.CancelledError` (treated as expected control-plane operation)
138
+ - **Markdown Code Blocks**: "Copy" now copies original raw code (preserves newlines/indentation) after syntax highlighting
139
+
140
+ ### Technical Details
141
+ - **13 commits**, **48 files changed**: 12,142 insertions, 368 deletions
142
+ - New module: `abstractflow/visual/interfaces.py` (347 lines)
143
+ - New UI component: `web/frontend/src/components/JsonSchemaNodeEditor.tsx` (460 lines)
144
+ - New tests: `test_visual_interfaces.py`, `test_visual_agent_structured_output_pin.py`, `test_visual_llm_call_structured_output_pin.py`, `test_visual_subflow_recursion.py`
145
+ - Compiler enhancements: Interface validation, per-run cache isolation, structured output pin support
146
+ - Executor optimizations: Performance improvements for VisualFlow execution
147
+ - 12 new example workflow JSON files in `web/flows/`
148
+
149
+ ### Notes
150
+ - In this monorepo, `abstractflow` contains a working Flow compiler/runner and VisualFlow execution utilities. Packaging/docs alignment is tracked in `docs/backlog/planned/093-framework-packaging-alignment-flow-runtime.md`.
151
+
152
+ ### Planned
153
+ - Visual workflow editor with drag-and-drop interface
154
+ - Real-time workflow execution and monitoring
155
+ - Integration with AbstractCore for multi-provider LLM support
156
+ - Custom node development SDK
157
+ - Cloud deployment capabilities
158
+ - Collaborative workflow development features
159
+
160
+ ## [0.1.0] - 2025-01-15
161
+
162
+ ### Added
163
+ - Initial placeholder package to reserve PyPI name
164
+ - Basic project structure and packaging configuration
165
+ - Comprehensive README with project vision and roadmap
166
+ - MIT license and contribution guidelines
167
+ - CLI placeholder with planned command structure
168
+
169
+ ### Notes
170
+ - This is a placeholder release to secure the `abstractflow` name on PyPI
171
+ - No functional code is included in this version
172
+ - Follow the GitHub repository for development updates and release timeline
173
+
174
+
@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
@@ -24,3 +24,5 @@ exclude .pytest_cache
24
24
  exclude build
25
25
  exclude dist
26
26
  exclude *.egg-info
27
+
28
+
@@ -0,0 +1,413 @@
1
+ Metadata-Version: 2.4
2
+ Name: abstractflow
3
+ Version: 0.3.0
4
+ Summary: Diagram-based AI workflow generation built on AbstractCore
5
+ Author-email: AbstractFlow Team <contact@abstractflow.ai>
6
+ Maintainer-email: AbstractFlow Team <contact@abstractflow.ai>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/lpalbou/AbstractFlow
9
+ Project-URL: Documentation, https://abstractflow.readthedocs.io
10
+ Project-URL: Repository, https://github.com/lpalbou/AbstractFlow
11
+ Project-URL: Bug Tracker, https://github.com/lpalbou/AbstractFlow/issues
12
+ Project-URL: Changelog, https://github.com/lpalbou/AbstractFlow/blob/main/CHANGELOG.md
13
+ Keywords: ai,workflow,diagram,llm,automation,visual-programming,abstractcore,machine-learning
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: System :: Distributed Computing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: AbstractRuntime>=0.4.0
29
+ Requires-Dist: abstractcore[tools]>=2.6.8
30
+ Requires-Dist: pydantic>=2.0.0
31
+ Requires-Dist: typing-extensions>=4.0.0
32
+ Provides-Extra: agent
33
+ Requires-Dist: abstractagent>=0.2.0; extra == "agent"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
37
+ Requires-Dist: black>=23.0.0; extra == "dev"
38
+ Requires-Dist: isort>=5.12.0; extra == "dev"
39
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
40
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
41
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
42
+ Provides-Extra: server
43
+ Requires-Dist: fastapi>=0.100.0; extra == "server"
44
+ Requires-Dist: uvicorn[standard]>=0.23.0; extra == "server"
45
+ Requires-Dist: websockets>=11.0.0; extra == "server"
46
+ Provides-Extra: ui
47
+ Requires-Dist: streamlit>=1.28.0; extra == "ui"
48
+ Requires-Dist: plotly>=5.15.0; extra == "ui"
49
+ Requires-Dist: networkx>=3.1.0; extra == "ui"
50
+ Provides-Extra: all
51
+ Requires-Dist: abstractflow[agent,dev,server,ui]; extra == "all"
52
+ Dynamic: license-file
53
+
54
+ # AbstractFlow
55
+
56
+ **Diagram-Based AI Workflow Generation**
57
+
58
+ > **WIP** - Core workflow engine and visual editor are implemented and ready for use!
59
+
60
+ AbstractFlow is an innovative Python library that enables visual, diagram-based creation and execution of AI workflows. Built on top of [AbstractCore](https://github.com/lpalbou/AbstractCore), it provides an intuitive interface for designing complex AI pipelines through interactive diagrams.
61
+
62
+ ## Monorepo note (Abstract Framework)
63
+
64
+ This repository is the **Abstract Framework monorepo**. The implementation in `abstractflow/abstractflow/*` (Flow/FlowRunner/compiler) and `abstractflow/abstractflow/visual/*` (VisualFlow models + portable executor) is aligned with `docs/architecture.md`.
65
+
66
+ Some parts of this README (and `abstractflow/pyproject.toml` / `abstractflow/CHANGELOG.md`) were originally written for a standalone placeholder package and may be out of sync with the monorepo implementation. See `docs/architecture.md` and planned backlog `docs/backlog/planned/093-framework-packaging-alignment-flow-runtime.md`.
67
+
68
+ ## 🎯 Vision
69
+
70
+ AbstractFlow aims to democratize AI workflow creation by providing:
71
+
72
+ - **Visual Workflow Design**: Create AI workflows using intuitive drag-and-drop diagrams
73
+ - **Multi-Provider Support**: Leverage any LLM provider through AbstractCore's unified interface
74
+ - **Real-time Execution**: Watch your workflows execute in real-time with live feedback
75
+ - **Collaborative Development**: Share and collaborate on workflow designs
76
+ - **Production Ready**: Deploy workflows to production with built-in monitoring and scaling
77
+
78
+ ## 🚀 Planned Features
79
+
80
+ ### Core Capabilities
81
+ - **Diagram Editor**: Web-based visual editor for workflow creation
82
+ - **Node Library**: Pre-built nodes for common AI operations (text generation, analysis, transformation)
83
+ - **Custom Nodes**: Create custom nodes with your own logic and AI models
84
+ - **Flow Control**: Conditional branching, loops, and parallel execution
85
+ - **Data Transformation**: Built-in data processing and transformation capabilities
86
+
87
+ ### AI Integration
88
+ - **Universal LLM Support**: Works with OpenAI, Anthropic, Ollama, and all AbstractCore providers
89
+ - **Tool Calling**: Seamless integration with external APIs and services
90
+ - **Structured Output**: Type-safe data flow between workflow nodes
91
+ - **Streaming Support**: Real-time processing for interactive applications
92
+
93
+ ### Deployment & Monitoring
94
+ - **Cloud Deployment**: One-click deployment to major cloud platforms
95
+ - **Monitoring Dashboard**: Real-time workflow execution monitoring
96
+ - **Version Control**: Git-based workflow versioning and collaboration
97
+ - **API Generation**: Automatic REST API generation from workflows
98
+
99
+ ## 🏗️ Architecture
100
+
101
+ AbstractFlow is built on a robust foundation:
102
+
103
+ ```
104
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
105
+ │ Diagram UI │ │ Workflow Engine │ │ AbstractCore │
106
+ │ │────│ │────│ │
107
+ │ Visual Editor │ │ Execution Logic │ │ LLM Providers │
108
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
109
+ ```
110
+
111
+ - **Frontend**: React-based diagram editor with real-time collaboration
112
+ - **Backend**: Python workflow execution engine with FastAPI
113
+ - **AI Layer**: AbstractCore for unified LLM provider access
114
+ - **Storage**: Workflow definitions, execution history, and metadata
115
+
116
+ ## 🎨 Use Cases
117
+
118
+ ### Business Process Automation
119
+ - Customer support ticket routing and response generation
120
+ - Document analysis and summarization pipelines
121
+ - Content creation and review workflows
122
+
123
+ ### Data Processing
124
+ - Multi-step data analysis with AI insights
125
+ - Automated report generation from raw data
126
+ - Real-time data enrichment and validation
127
+
128
+ ### Creative Workflows
129
+ - Multi-stage content creation (research → draft → review → publish)
130
+ - Interactive storytelling and narrative generation
131
+ - Collaborative writing and editing processes
132
+
133
+ ### Research & Development
134
+ - Hypothesis generation and testing workflows
135
+ - Literature review and synthesis automation
136
+ - Experimental design and analysis pipelines
137
+
138
+ ## 🛠️ Technology Stack
139
+
140
+ - **Core**: Python 3.10+ (aligns with AbstractRuntime)
141
+ - **AI Integration**: [AbstractCore](https://github.com/lpalbou/AbstractCore) for LLM provider abstraction
142
+ - **Web Framework**: FastAPI for high-performance API server
143
+ - **Frontend**: React with TypeScript for the diagram editor
144
+ - **Database**: PostgreSQL for workflow storage, Redis for caching
145
+ - **Deployment**: Docker containers with Kubernetes support
146
+
147
+ ## 📦 Installation
148
+
149
+ ```bash
150
+ # Clone the repository
151
+ git clone https://github.com/lpalbou/AbstractFlow.git
152
+ cd AbstractFlow
153
+
154
+ # Install core dependencies
155
+ pip install -e .
156
+
157
+ # Or install with web editor dependencies
158
+ pip install -e .[server]
159
+
160
+ # Development installation (includes tests)
161
+ pip install -e .[dev]
162
+ ```
163
+
164
+ ### Dependencies
165
+
166
+ AbstractFlow requires:
167
+ - Python 3.10+ (aligns with AbstractRuntime)
168
+ - [AbstractRuntime](https://github.com/lpalbou/AbstractRuntime) - Workflow execution engine
169
+ - [AbstractCore](https://github.com/lpalbou/AbstractCore) - LLM provider abstraction
170
+
171
+ For the visual editor:
172
+ - Node.js 18+ (for frontend)
173
+ - FastAPI, uvicorn, websockets (for backend)
174
+
175
+ ## 🚀 Quick Start
176
+
177
+ ### Programmatic API
178
+
179
+ ```python
180
+ from abstractflow import Flow, FlowRunner
181
+
182
+ # Create a flow
183
+ flow = Flow("my-workflow")
184
+
185
+ # Add function nodes
186
+ def double(x):
187
+ return x * 2
188
+
189
+ def add_ten(x):
190
+ return x + 10
191
+
192
+ flow.add_node("double", double, input_key="value", output_key="doubled")
193
+ flow.add_node("add_ten", add_ten, input_key="doubled", output_key="result")
194
+
195
+ # Connect nodes
196
+ flow.add_edge("double", "add_ten")
197
+ flow.set_entry("double")
198
+
199
+ # Execute the flow
200
+ runner = FlowRunner(flow)
201
+ result = runner.run({"value": 5})
202
+ print(result) # {"value": 5, "doubled": 10, "result": 20}
203
+ ```
204
+
205
+ ### With Agents
206
+
207
+ ```python
208
+ from abstractflow import Flow, FlowRunner
209
+ from abstractagent import create_react_agent
210
+
211
+ # Create an agent
212
+ planner = create_react_agent(provider="ollama", model="qwen3:4b-instruct-2507-q4_K_M")
213
+
214
+ # Create flow with agent node
215
+ flow = Flow("agent-workflow")
216
+ flow.add_node("plan", planner, input_key="task", output_key="plan")
217
+ flow.set_entry("plan")
218
+
219
+ # Run
220
+ runner = FlowRunner(flow)
221
+ result = runner.run({"task": "Plan a weekend trip to Paris"})
222
+ print(result["plan"])
223
+ ```
224
+
225
+ ### Nested Flows (Subflows)
226
+
227
+ ```python
228
+ # Create a subflow
229
+ inner_flow = Flow("processing")
230
+ inner_flow.add_node("step1", lambda x: x.upper())
231
+ inner_flow.add_node("step2", lambda x: f"[{x}]")
232
+ inner_flow.add_edge("step1", "step2")
233
+ inner_flow.set_entry("step1")
234
+
235
+ # Use subflow in parent flow
236
+ outer_flow = Flow("main")
237
+ outer_flow.add_node("preprocess", lambda x: x.strip())
238
+ outer_flow.add_node("process", inner_flow) # Subflow as node
239
+ outer_flow.add_node("postprocess", lambda x: x + "!")
240
+ outer_flow.add_edge("preprocess", "process")
241
+ outer_flow.add_edge("process", "postprocess")
242
+ outer_flow.set_entry("preprocess")
243
+
244
+ runner = FlowRunner(outer_flow)
245
+ result = runner.run({"input": " hello "})
246
+ ```
247
+
248
+ ## 🖥️ Visual Workflow Editor
249
+
250
+ AbstractFlow includes a state-of-the-art web-based visual editor inspired by Unreal Engine Blueprints:
251
+
252
+ ### Features
253
+ - **Blueprint-Style Nodes**: Drag-and-drop nodes with typed, colored pins
254
+ - **Real-time Execution**: Watch workflows execute with live node highlighting via WebSocket
255
+ - **Monaco Code Editor**: Write custom Python code directly in nodes
256
+ - **Type-Safe Connections**: Pin type validation prevents incompatible connections
257
+ - **Export/Import**: Save and load workflows as JSON
258
+
259
+ ### Blueprint-Style Pin Types
260
+
261
+ | Type | Color | Shape | Description |
262
+ |------|-------|-------|-------------|
263
+ | **Execution** | White `#FFFFFF` | ▷ Triangle | Flow control |
264
+ | **String** | Magenta `#FF00FF` | ○ Circle | Text data |
265
+ | **Number** | Green `#00FF00` | ○ Circle | Integer/Float |
266
+ | **Boolean** | Red `#FF0000` | ◇ Diamond | True/False |
267
+ | **Object** | Cyan `#00FFFF` | ○ Circle | JSON objects |
268
+ | **Array** | Orange `#FF8800` | □ Square | Collections |
269
+ | **Agent** | Blue `#4488FF` | ⬡ Hexagon | Agent reference |
270
+ | **Any** | Gray `#888888` | ○ Circle | Accepts any type |
271
+
272
+ ### Built-in Node Categories
273
+
274
+ - **Core**: Agent, Subflow, Python Code
275
+ - **Math**: Add, Subtract, Multiply, Divide, Modulo, Power, Abs, Round, Min, Max
276
+ - **String**: Concat, Split, Join, Format, Uppercase, Lowercase, Trim, Substring, Length, Replace
277
+ - **Control**: If/Else, Compare, NOT, AND, OR
278
+ - **Data**: Get Property, Set Property, Merge Objects
279
+
280
+ ### Running the Visual Editor
281
+
282
+ ```bash
283
+ # 1. Create virtual environment and install dependencies
284
+ cd abstractflow
285
+ python3 -m venv .venv
286
+ source .venv/bin/activate
287
+
288
+ # Prefer editable installs over PYTHONPATH hacks so dependency wiring matches real installs.
289
+ pip install -e "../abstractcore[tools]"
290
+ pip install -e "../abstractruntime[abstractcore]"
291
+ pip install -e "../abstractagent"
292
+ pip install -e ".[server,agent]"
293
+
294
+ # 2. Start backend server (run from web/ so `backend.*` is importable)
295
+ cd web
296
+ uvicorn backend.main:app --port 8080 --reload
297
+
298
+ # 3. In a new terminal, start frontend dev server
299
+ cd abstractflow/web/frontend
300
+ npm install
301
+ npm run dev
302
+ ```
303
+
304
+ Then open http://localhost:3000 in your browser.
305
+
306
+ **Production mode** (serve frontend from backend):
307
+ ```bash
308
+ # Build frontend
309
+ cd web/frontend && npm run build && cd ../..
310
+
311
+ # Run backend only (serves frontend from dist/)
312
+ cd web
313
+ uvicorn backend.main:app --port 8080
314
+
315
+ # Open http://localhost:8080
316
+ ```
317
+
318
+ ### Project Structure
319
+
320
+ ```
321
+ web/
322
+ ├── backend/ # FastAPI backend
323
+ │ ├── main.py # App entry with CORS, static files
324
+ │ ├── models.py # Pydantic models (VisualNode, VisualEdge, VisualFlow)
325
+ │ ├── routes/
326
+ │ │ ├── flows.py # Flow CRUD endpoints
327
+ │ │ └── ws.py # WebSocket for real-time execution
328
+ │ └── services/
329
+ │ ├── executor.py # VisualFlow → AbstractFlow conversion
330
+ │ ├── builtins.py # 26 built-in function handlers
331
+ │ └── code_executor.py # Sandboxed Python execution
332
+ ├── frontend/ # React + TypeScript frontend
333
+ │ ├── src/
334
+ │ │ ├── components/
335
+ │ │ │ ├── Canvas.tsx # React Flow canvas
336
+ │ │ │ ├── NodePalette.tsx # Categorized node picker
337
+ │ │ │ ├── PropertiesPanel.tsx
338
+ │ │ │ ├── Toolbar.tsx # Run/Save/Export/Import
339
+ │ │ │ └── nodes/
340
+ │ │ │ ├── BaseNode.tsx # Blueprint-style node
341
+ │ │ │ └── CodeNode.tsx # Monaco editor node
342
+ │ │ ├── hooks/
343
+ │ │ │ ├── useFlow.ts # Zustand state management
344
+ │ │ │ └── useWebSocket.ts # Real-time updates
345
+ │ │ ├── types/
346
+ │ │ │ ├── flow.ts # TypeScript types, PIN_COLORS
347
+ │ │ │ └── nodes.ts # Node templates
348
+ │ │ └── styles/ # Dark theme CSS
349
+ │ └── package.json
350
+ └── requirements.txt # Backend Python dependencies
351
+ ```
352
+
353
+ ## 🎯 Roadmap
354
+
355
+ ### Phase 1: Foundation ✅ Complete
356
+ - [x] Core workflow engine (Flow, FlowNode, FlowEdge)
357
+ - [x] Basic node types (Agent, Function, Subflow)
358
+ - [x] Flow compilation to WorkflowSpec
359
+ - [x] FlowRunner execution via Runtime
360
+ - [x] State passing between nodes with dot notation
361
+
362
+ ### Phase 2: Visual Editor ✅ Complete
363
+ - [x] Web-based diagram editor with React Flow
364
+ - [x] Blueprint-style pins with colors and shapes
365
+ - [x] 26 built-in function nodes (math, string, control, data)
366
+ - [x] Custom Python code nodes with Monaco editor
367
+ - [x] Export/Import JSON functionality
368
+ - [x] Real-time execution updates via WebSocket
369
+
370
+ ### Phase 3: Advanced Features (Planned)
371
+ - [ ] Custom node development SDK
372
+ - [ ] Advanced flow control (loops, parallel execution)
373
+ - [ ] Monitoring and analytics dashboard
374
+ - [ ] Cloud deployment integration
375
+
376
+ ### Phase 4: Enterprise (Planned)
377
+ - [ ] Enterprise security features
378
+ - [ ] Advanced monitoring and alerting
379
+ - [ ] Multi-tenant support
380
+ - [ ] Professional services and support
381
+
382
+ ## 🤝 Contributing
383
+
384
+ We welcome contributions from the community! Once development begins, you'll be able to:
385
+
386
+ - Report bugs and request features
387
+ - Submit pull requests for improvements
388
+ - Create and share workflow templates
389
+ - Contribute to documentation
390
+
391
+ ## 📄 License
392
+
393
+ AbstractFlow will be released under the MIT License, ensuring it remains free and open-source for all users.
394
+
395
+ ## 🔗 Related Projects
396
+
397
+ - **[AbstractCore](https://github.com/lpalbou/AbstractCore)**: The unified LLM interface powering AbstractFlow
398
+ - **[AbstractCore Documentation](http://www.abstractcore.ai/)**: Comprehensive guides and API reference
399
+
400
+ ## 📞 Contact
401
+
402
+ For early access, partnerships, or questions about AbstractFlow:
403
+
404
+ - **GitHub**: [Issues and Discussions](https://github.com/lpalbou/AbstractFlow) (coming soon)
405
+ - **Email**: Contact through AbstractCore channels
406
+ - **Website**: [www.abstractflow.ai](http://www.abstractflow.ai) (coming soon)
407
+
408
+ ---
409
+
410
+ **AbstractFlow** - Visualize, Create, Execute. The future of AI workflow development is here.
411
+
412
+ > Built on top of [AbstractCore](https://github.com/lpalbou/AbstractCore)
413
+