wfpy 1.1.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 (93) hide show
  1. wfpy-1.1.0/LICENSE +201 -0
  2. wfpy-1.1.0/PKG-INFO +400 -0
  3. wfpy-1.1.0/README.md +362 -0
  4. wfpy-1.1.0/pyproject.toml +91 -0
  5. wfpy-1.1.0/setup.cfg +4 -0
  6. wfpy-1.1.0/src/wfpy/__init__.py +89 -0
  7. wfpy-1.1.0/src/wfpy/_action_runtime.py +293 -0
  8. wfpy-1.1.0/src/wfpy/_agent_cli_runtime.py +1374 -0
  9. wfpy-1.1.0/src/wfpy/_agent_decorator.py +228 -0
  10. wfpy-1.1.0/src/wfpy/_agent_io_runtime.py +1156 -0
  11. wfpy-1.1.0/src/wfpy/_agent_prompt_runtime.py +713 -0
  12. wfpy-1.1.0/src/wfpy/_agent_request_runtime.py +320 -0
  13. wfpy-1.1.0/src/wfpy/_agent_staging_runtime.py +409 -0
  14. wfpy-1.1.0/src/wfpy/_agent_tools_runtime.py +844 -0
  15. wfpy-1.1.0/src/wfpy/_agent_validation_runtime.py +665 -0
  16. wfpy-1.1.0/src/wfpy/_ask_user_mcp.py +180 -0
  17. wfpy-1.1.0/src/wfpy/_checkpoint_runtime.py +507 -0
  18. wfpy-1.1.0/src/wfpy/_context_runtime.py +410 -0
  19. wfpy-1.1.0/src/wfpy/_elicitation_runtime.py +346 -0
  20. wfpy-1.1.0/src/wfpy/_graph_context.py +12 -0
  21. wfpy-1.1.0/src/wfpy/_graph_export.py +900 -0
  22. wfpy-1.1.0/src/wfpy/_hierarchy_export.py +125 -0
  23. wfpy-1.1.0/src/wfpy/_invoke_runtime.py +867 -0
  24. wfpy-1.1.0/src/wfpy/_journal_runtime.py +298 -0
  25. wfpy-1.1.0/src/wfpy/_lsp_client.py +378 -0
  26. wfpy-1.1.0/src/wfpy/_mcp_client.py +219 -0
  27. wfpy-1.1.0/src/wfpy/_mock_agent_runtime.py +110 -0
  28. wfpy-1.1.0/src/wfpy/_plan_outputs_runtime.py +226 -0
  29. wfpy-1.1.0/src/wfpy/_rewrite_transformers.py +123 -0
  30. wfpy-1.1.0/src/wfpy/_run_artifacts.py +668 -0
  31. wfpy-1.1.0/src/wfpy/_run_event_stream.py +211 -0
  32. wfpy-1.1.0/src/wfpy/_run_finalization.py +363 -0
  33. wfpy-1.1.0/src/wfpy/_step_external_runtime.py +379 -0
  34. wfpy-1.1.0/src/wfpy/_step_streamblocks_runtime.py +253 -0
  35. wfpy-1.1.0/src/wfpy/_validation_runtime.py +710 -0
  36. wfpy-1.1.0/src/wfpy/_workflow_instance.py +197 -0
  37. wfpy-1.1.0/src/wfpy/acp_client.py +729 -0
  38. wfpy-1.1.0/src/wfpy/cli.py +768 -0
  39. wfpy-1.1.0/src/wfpy/connectors.py +178 -0
  40. wfpy-1.1.0/src/wfpy/core.py +1752 -0
  41. wfpy-1.1.0/src/wfpy/graph.py +544 -0
  42. wfpy-1.1.0/src/wfpy/package_exports.py +160 -0
  43. wfpy-1.1.0/src/wfpy/partial.py +602 -0
  44. wfpy-1.1.0/src/wfpy/py.typed +1 -0
  45. wfpy-1.1.0/src/wfpy/rewrite.py +2452 -0
  46. wfpy-1.1.0/src/wfpy/runner.py +3202 -0
  47. wfpy-1.1.0/src/wfpy/sidecar.py +652 -0
  48. wfpy-1.1.0/src/wfpy/sidecar_cli.py +49 -0
  49. wfpy-1.1.0/src/wfpy/types.py +344 -0
  50. wfpy-1.1.0/src/wfpy/workflow_identity.py +85 -0
  51. wfpy-1.1.0/src/wfpy.egg-info/PKG-INFO +400 -0
  52. wfpy-1.1.0/src/wfpy.egg-info/SOURCES.txt +91 -0
  53. wfpy-1.1.0/src/wfpy.egg-info/dependency_links.txt +1 -0
  54. wfpy-1.1.0/src/wfpy.egg-info/entry_points.txt +4 -0
  55. wfpy-1.1.0/src/wfpy.egg-info/requires.txt +15 -0
  56. wfpy-1.1.0/src/wfpy.egg-info/top_level.txt +1 -0
  57. wfpy-1.1.0/tests/test_acp_connectors_runtime.py +213 -0
  58. wfpy-1.1.0/tests/test_acp_permissions.py +130 -0
  59. wfpy-1.1.0/tests/test_acp_session_load.py +111 -0
  60. wfpy-1.1.0/tests/test_acp_simple.py +204 -0
  61. wfpy-1.1.0/tests/test_acp_tool_call_events.py +47 -0
  62. wfpy-1.1.0/tests/test_agent_session_record.py +92 -0
  63. wfpy-1.1.0/tests/test_ask_user_mcp.py +82 -0
  64. wfpy-1.1.0/tests/test_atomic_firings.py +251 -0
  65. wfpy-1.1.0/tests/test_boundary_ports.py +69 -0
  66. wfpy-1.1.0/tests/test_cli.py +180 -0
  67. wfpy-1.1.0/tests/test_connectors.py +105 -0
  68. wfpy-1.1.0/tests/test_core.py +717 -0
  69. wfpy-1.1.0/tests/test_elicit_socket.py +84 -0
  70. wfpy-1.1.0/tests/test_elicitation.py +449 -0
  71. wfpy-1.1.0/tests/test_error_path.py +104 -0
  72. wfpy-1.1.0/tests/test_examples.py +144 -0
  73. wfpy-1.1.0/tests/test_graph.py +502 -0
  74. wfpy-1.1.0/tests/test_hierarchy_export.py +138 -0
  75. wfpy-1.1.0/tests/test_instance_names.py +21 -0
  76. wfpy-1.1.0/tests/test_mcp_client.py +139 -0
  77. wfpy-1.1.0/tests/test_mock_transport.py +153 -0
  78. wfpy-1.1.0/tests/test_nested_workflows.py +324 -0
  79. wfpy-1.1.0/tests/test_package_exports.py +109 -0
  80. wfpy-1.1.0/tests/test_queue_trace.py +132 -0
  81. wfpy-1.1.0/tests/test_resume.py +554 -0
  82. wfpy-1.1.0/tests/test_resume_at_step.py +409 -0
  83. wfpy-1.1.0/tests/test_rewrite.py +779 -0
  84. wfpy-1.1.0/tests/test_rewrite_ensure_imports.py +108 -0
  85. wfpy-1.1.0/tests/test_run_artifacts.py +100 -0
  86. wfpy-1.1.0/tests/test_runner.py +6143 -0
  87. wfpy-1.1.0/tests/test_sidecar.py +622 -0
  88. wfpy-1.1.0/tests/test_sidecar_package_exports.py +114 -0
  89. wfpy-1.1.0/tests/test_source.py +280 -0
  90. wfpy-1.1.0/tests/test_streamblocks.py +667 -0
  91. wfpy-1.1.0/tests/test_tool_errors.py +65 -0
  92. wfpy-1.1.0/tests/test_types.py +192 -0
  93. wfpy-1.1.0/tests/test_workflow_instance.py +288 -0
wfpy-1.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 wf-lang contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
wfpy-1.1.0/PKG-INFO ADDED
@@ -0,0 +1,400 @@
1
+ Metadata-Version: 2.4
2
+ Name: wfpy
3
+ Version: 1.1.0
4
+ Summary: A Pythonic framework for agentic workflows, built on actor-dataflow semantics
5
+ Author: wf-lang contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/huawei-csl/wfpy
8
+ Project-URL: Documentation, https://github.com/huawei-csl/wfpy/tree/main/docs
9
+ Project-URL: Source, https://github.com/huawei-csl/wfpy
10
+ Project-URL: Issues, https://github.com/huawei-csl/wfpy/issues
11
+ Project-URL: Changelog, https://github.com/huawei-csl/wfpy/releases
12
+ Keywords: workflow,dataflow,actors,agents,llm,agentic,mcp,acp
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: libcst>=1.4
27
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
28
+ Provides-Extra: agent
29
+ Requires-Dist: httpx>=0.27; extra == "agent"
30
+ Requires-Dist: mcp>=1.9; extra == "agent"
31
+ Requires-Dist: agent-client-protocol>=0.10; extra == "agent"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=8.0; extra == "dev"
34
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
35
+ Requires-Dist: mypy>=1.10; extra == "dev"
36
+ Requires-Dist: ruff>=0.15; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # wfpy — Pythonic agentic workflows on actor-dataflow semantics
40
+
41
+ [![CI](https://github.com/huawei-csl/wfpy/actions/workflows/ci.yml/badge.svg)](https://github.com/huawei-csl/wfpy/actions/workflows/ci.yml)
42
+
43
+ A Pythonic framework for agentic workflows, built on actor-dataflow semantics:
44
+ agents and tasks are actors in a dataflow graph, connected by FIFO queues and
45
+ fired when their inputs are ready. Independent work runs concurrently by
46
+ default, feedback loops are ordinary edges, and the graph is exportable as data.
47
+
48
+ **New to dataflow?** Read [Dataflow concepts](https://github.com/huawei-csl/wfpy/blob/main/docs/dataflow-concepts.md) for the
49
+ model — actors, ports, tokens, firings, guards, schedules, priorities — and work
50
+ through the tutorial in [`examples/`](https://github.com/huawei-csl/wfpy/tree/main/examples), which builds it up one runnable
51
+ step at a time.
52
+
53
+ wfpy is fully typed and ships `py.typed` for IDE support.
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install wfpy # the core: workflows, tasks, the CLI
59
+ pip install "wfpy[agent]" # + the @agent transports: HTTP API, MCP tools, ACP
60
+ ```
61
+
62
+ Each [release](https://github.com/huawei-csl/wfpy/releases) is published to
63
+ [PyPI](https://pypi.org/project/wfpy/) and also attaches the built wheel. Use
64
+ these to install a version that is not on PyPI, or without PyPI access:
65
+
66
+ ```bash
67
+ # a release wheel straight from GitHub
68
+ pip install "wfpy @ https://github.com/huawei-csl/wfpy/releases/download/v1.1.0/wfpy-1.1.0-py3-none-any.whl"
69
+
70
+ # or a tagged source
71
+ pip install "git+https://github.com/huawei-csl/wfpy@v1.1.0"
72
+ ```
73
+
74
+ For local development, clone and install editable: `pip install -e ".[dev]"`.
75
+
76
+ ```bash
77
+ wfpy run my_workflow.py # run a workflow
78
+ ```
79
+
80
+ ## Agent connectors (ACP)
81
+
82
+ An `@agent` on the `acp` transport, and the chat in the wfpy IDE, talk to a
83
+ coding agent over the [Agent Client Protocol](https://agentclientprotocol.com).
84
+ Each such agent is a **connector**: a command wfpy spawns. wfpy knows four, and
85
+ a connector is available when its command is on the `PATH`:
86
+
87
+ | Connector | Command wfpy spawns | Install | Sign in |
88
+ |---|---|---|---|
89
+ | `opencode` (default) | `opencode acp` | `npm install -g opencode-ai` (or `curl -fsSL https://opencode.ai/install \| bash`) | `opencode auth login` |
90
+ | `claude` | `claude-agent-acp` | `npm install -g @anthropic-ai/claude-code @agentclientprotocol/claude-agent-acp` | run `claude` once and `/login`, or set `ANTHROPIC_API_KEY` |
91
+ | `codex` | `codex-acp` | `npm install -g @zed-industries/codex-acp` | `codex login`, or set `OPENAI_API_KEY` |
92
+ | `gemini` | `gemini --experimental-acp` | `npm install -g @google/gemini-cli` | run `gemini` once and sign in, or set `GEMINI_API_KEY` |
93
+
94
+ `claude-agent-acp` is the ACP adapter for Claude Code: it drives Claude Code,
95
+ so it uses Claude Code's login and settings. Install the connectors you want.
96
+ Only `opencode` is needed for the defaults. The npm packages need Node.js 18 or
97
+ newer.
98
+
99
+ ### Set up a machine
100
+
101
+ ```bash
102
+ # 1. wfpy with the agent transports (HTTP API, MCP tools, ACP)
103
+ pip install -e ".[agent]" # or "wfpy[agent] @ <wheel-url>"
104
+
105
+ # 2. the connectors (pick the ones you use)
106
+ npm install -g opencode-ai
107
+ npm install -g @anthropic-ai/claude-code @agentclientprotocol/claude-agent-acp
108
+
109
+ # 3. sign in once per agent
110
+ opencode auth login
111
+ claude # then /login inside it
112
+
113
+ # 4. check what wfpy sees
114
+ wfpy connectors
115
+ ```
116
+
117
+ `wfpy connectors` lists every connector, whether it is available and where it
118
+ came from:
119
+
120
+ ```text
121
+ name available source model mode command
122
+ claude yes discovered - - claude-agent-acp
123
+ codex no discovered - - codex-acp
124
+ gemini no discovered - - gemini --experimental-acp
125
+ opencode yes discovered - - opencode acp
126
+ user file: ~/.config/wfpy/connectors.toml workspace file: <project>/.wfpy/connectors.toml
127
+ ```
128
+
129
+ A connector reported `no` while it is installed is not on the `PATH` of the
130
+ process that ran wfpy. This happens with nvm, which puts global npm binaries
131
+ under `~/.nvm/versions/node/<version>/bin`. When VS Code is started from a
132
+ desktop launcher instead of a shell, it may not see that directory. Either
133
+ start VS Code from a shell, or give the full path in a connectors file (below).
134
+
135
+ ### Choose a connector
136
+
137
+ - **One agent:** `@agent(transport="acp", connector="claude")`.
138
+ - **A run's default:** `wfpy run flow.py --acp-connector claude`. Agents that
139
+ name no connector use it. Without the flag the default is `opencode`.
140
+ - **An explicit command line:** `--agent-cli-acp-command "claude-agent-acp"`
141
+ wins over both.
142
+ - **The wfpy IDE:** the `wfpy.acp.connector` setting chooses the connector for
143
+ the chat and for runs started from the editor (default `opencode`).
144
+
145
+ ### Open an agent's session in its own CLI
146
+
147
+ The `claude` and `opencode` adapters use the agent's own session id as the ACP
148
+ session id. So a session can be continued in the agent's CLI, for example
149
+ `claude --resume <id>` (started from the session's directory) or
150
+ `opencode -s <id>`. Each firing records the session it used, as
151
+ `{"id", "connector", "cwd"}`:
152
+
153
+ - in the `session` field of its `agent.message.end` run event;
154
+ - as `agentSession` on the agent's reply in its chat history.
155
+
156
+ The session's directory is where `wfpy` ran. In the wfpy IDE, the chat header
157
+ and each finished turn of a run's agent have a button that opens the session in
158
+ a terminal, and another that copies its id. A connector can give its own
159
+ command as `resume = "... {sessionId}"` in a connectors file. `resume = ""`
160
+ removes it, and then the id is only copied.
161
+
162
+ ### Configure connectors
163
+
164
+ Two optional TOML files add connectors or override the discovered ones. Both
165
+ are read by `wfpy` and by the wfpy IDE:
166
+
167
+ - `~/.config/wfpy/connectors.toml` (or `$XDG_CONFIG_HOME/wfpy/connectors.toml`)
168
+ holds this machine's settings, such as paths and your model choices.
169
+ - `.wfpy/connectors.toml`, at the project root (the directory with
170
+ `pyproject.toml` or `.git`), is checked in with the project and overrides
171
+ the user file.
172
+
173
+ ```toml
174
+ [connectors.claude]
175
+ command = "claude-agent-acp" # argv, split as a shell would
176
+ model = "sonnet" # a model the agent offers
177
+ mode = "acceptEdits" # a session mode the agent offers
178
+
179
+ [connectors.opencode]
180
+ command = "/opt/opencode/bin/opencode acp"
181
+ http_api = true # OpenCode's HTTP API beside ACP
182
+
183
+ [connectors.claude-work] # a second Claude connector, with its own env
184
+ command = "claude-agent-acp"
185
+ env = { ANTHROPIC_API_KEY = "..." }
186
+ ```
187
+
188
+ ### Replicate on another machine
189
+
190
+ 1. Install wfpy with `[agent]` and the same connectors (step 1 and step 2
191
+ above). Check versions on the working machine with
192
+ `npm ls -g --depth=0` and pin them with `npm install -g <pkg>@<version>`.
193
+ 2. Copy `~/.config/wfpy/connectors.toml`, if you have one. Fix the paths in it
194
+ for the new machine. Do not copy API keys into a file that is checked in.
195
+ 3. Sign in to each agent on the new machine (step 3). Logins are not copied
196
+ with the files.
197
+ 4. Run `wfpy connectors` from inside the project. Every connector you use
198
+ should show `available yes`.
199
+
200
+ The project's `.wfpy/connectors.toml` comes with the repository, so nothing
201
+ else is needed for it.
202
+
203
+ ## Minimal example
204
+
205
+ ```python
206
+ from wfpy import task, workflow, connect, Port
207
+
208
+ @task
209
+ class Doubler:
210
+ factor: int # parameter
211
+
212
+ class Ports:
213
+ In = Port[int]()
214
+ Out = Port[int]()
215
+
216
+ def action(self, x: int) -> int:
217
+ return x * self.factor
218
+
219
+ @workflow
220
+ def double_pipeline():
221
+ d1 = Doubler(factor=2)
222
+ d2 = Doubler(factor=3)
223
+
224
+ connect("Input", d1.In)
225
+ connect(d1.Out, d2.In)
226
+ connect(d2.Out, "Output")
227
+ ```
228
+
229
+ ## Features
230
+
231
+ | Feature | Status |
232
+ |---|---|
233
+ | `@task` with typed ports | ✅ |
234
+ | Multi-action tasks with `@action` / `@guard` | ✅ |
235
+ | `@workflow` with `connect()` wiring | ✅ |
236
+ | FIFO round-robin scheduler | ✅ |
237
+ | `@tool(cmd=...)` external process tasks | ✅ |
238
+ | `@agent(prompt=...)` LLM tasks | ✅ |
239
+ | `@agent(transport="mock")` offline agents (no model, no credentials) | ✅ |
240
+ | `@context(read=[...], write=[...])` task context policy | ✅ |
241
+ | `@viewer(action_name=..., inputs=[...], viewType=...)` sink/view tasks | ✅ |
242
+ | `@source(viewType=...)` one resource — file, folder or URL — emitted once | ✅ |
243
+ | Nested workflows | ✅ |
244
+ | CLI (`wfpy run`) | ✅ |
245
+ | JSON plan IR export | ✅ |
246
+
247
+ ## Running agents offline
248
+
249
+ `transport="mock"` fires an `@agent` actor without a model, a network call or
250
+ any credentials. The actor still obeys the normal firing rules and still emits a
251
+ value on every declared output port, so the *shape* of a graph — fan-out and
252
+ join, repair feedback loops, guard routing, firing order — can be tested in CI
253
+ without spending tokens or depending on how a model happens to word things.
254
+
255
+ ```python
256
+ @agent(prompt="Summarize the input.", transport="mock",
257
+ mock_outputs={"Summary": "a concise summary"})
258
+ class Summarizer:
259
+ class Ports:
260
+ In = Port[str](direction="in")
261
+ Summary = Port[str](direction="out")
262
+ Score = Port[int](direction="out") # unlisted → synthesized as 0
263
+ ```
264
+
265
+ Ports absent from `mock_outputs` are filled in from their declared type, so an
266
+ `int` port receives an `int` and a `File` port is materialized as a real file.
267
+ Swapping back to a real transport changes nothing else about the graph.
268
+
269
+ ## Shared context decorator
270
+
271
+ Use `@context(...)` to attach shared-context read/write policy metadata to task
272
+ classes. It can be applied directly to a class or stacked with `@task` in
273
+ either order.
274
+
275
+ `@guard(...)` predicates are supported on both explicit `@action(...)` methods
276
+ and implicit default `action(...)` methods.
277
+
278
+ ## Architecture
279
+
280
+ ```
281
+ wfpy/
282
+ ├── types.py # Port, Resource, File, Map type descriptors
283
+ ├── core.py # @task, @action, @guard, @workflow, @agent, @tool decorators
284
+ ├── graph.py # connect(), WorkflowGraph builder
285
+ ├── runner.py # FIFO round-robin scheduler
286
+ ├── cli.py # CLI entry-point (wfpy run ...)
287
+ └── __init__.py # public API re-exports
288
+ ```
289
+
290
+ Documentation lives under [docs/](https://github.com/huawei-csl/wfpy/tree/main/docs): the [dataflow model](https://github.com/huawei-csl/wfpy/blob/main/docs/dataflow-concepts.md)
291
+ and the [sidecar](https://github.com/huawei-csl/wfpy/blob/main/docs/sidecar.md).
292
+
293
+ ## Resource draft
294
+
295
+ wfpy includes a draft `Resource` value type for non-file locators (for example
296
+ URLs, folders, and endpoint-like references):
297
+
298
+ ```python
299
+ from wfpy import Port, Resource
300
+
301
+ class Ports:
302
+ In = Port[Resource](direction="in")
303
+ Out = Port[Resource](direction="out", ext=".json")
304
+ ```
305
+
306
+ `File` remains supported and is treated as a file-focused specialization of
307
+ `Resource` for backward compatibility.
308
+
309
+ ### Kind helpers
310
+
311
+ wfpy also exposes basic helpers for classifying resource locators:
312
+
313
+ ```python
314
+ from wfpy import (
315
+ infer_resource_kind,
316
+ is_url_resource,
317
+ is_http_resource,
318
+ is_folder_resource,
319
+ is_file_resource,
320
+ )
321
+
322
+ infer_resource_kind("https://example.com/data") # "http"
323
+ is_url_resource("s3://bucket/key") # True
324
+ is_folder_resource("/tmp/my-dir/") # True
325
+ ```
326
+
327
+ ## Agent skills (`SKILL.md`) draft
328
+
329
+ wfpy supports name-based skill lookup for agents:
330
+
331
+ ```python
332
+ from wfpy import agent, Port
333
+
334
+ @agent(
335
+ skill="writer",
336
+ use_skill=True,
337
+ use_prompt=True,
338
+ use_skill_hooks=True,
339
+ prompt="Focus on concise release notes."
340
+ )
341
+ class Writer:
342
+ class Ports:
343
+ In = Port[dict](direction="in")
344
+ Out = Port[dict](direction="out")
345
+ ```
346
+
347
+ Skill names resolve by convention under your runtime root:
348
+
349
+ - `.wf/skills/<skill-name>/SKILL.md`
350
+ - `.wf/skills/<skill-name>/scripts/<hook>.py|.sh`
351
+
352
+ wfpy also searches Claude-compatible skill roots in order:
353
+
354
+ - `<runtime-root>/.claude/skills/<skill-name>/SKILL.md`
355
+ - `<cwd>/.wf/skills/<skill-name>/SKILL.md`
356
+ - `<cwd>/.claude/skills/<skill-name>/SKILL.md`
357
+ - `~/.claude/skills/<skill-name>/SKILL.md`
358
+
359
+ Prompt composition order:
360
+
361
+ 1. `SKILL.md` body (if `use_skill=True`)
362
+ 2. `prompt` (if `use_prompt=True`)
363
+ 3. wfpy runtime instruction (always appended by runtime)
364
+
365
+ Missing enabled skill files are runtime errors.
366
+
367
+ ## Claude agent format compatibility (draft)
368
+
369
+ wfpy agents can also reference Claude-style markdown agent profiles by name:
370
+
371
+ ```python
372
+ from wfpy import agent, Port
373
+
374
+ @agent(
375
+ claudeAgent="code-reviewer",
376
+ useClaudeAgent=True,
377
+ usePrompt=True,
378
+ prompt="Adapt output to this workflow's output ports."
379
+ )
380
+ class Reviewer:
381
+ class Ports:
382
+ In = Port[dict](direction="in")
383
+ Out = Port[dict](direction="out")
384
+ ```
385
+
386
+ Discovery roots (ordered):
387
+
388
+ - `<runtime-root>/.claude/agents`
389
+ - `<cwd>/.claude/agents`
390
+ - `~/.claude/agents`
391
+
392
+ Supported profile fields in compatibility mode:
393
+
394
+ - `name`, `description`, markdown body prompt, `skills`
395
+
396
+ Ignored with non-fatal warnings:
397
+
398
+ - `model` (wfpy keeps the current model/provider selection)
399
+ - `tools`, `disallowedTools`, `permissionMode`, `maxTurns`, `mcpServers`,
400
+ `hooks`, `memory`, `background`, `effort`, `isolation`