xqo-flows 3.2.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.
- xqo_flows-3.2.0/LICENSE +21 -0
- xqo_flows-3.2.0/PKG-INFO +187 -0
- xqo_flows-3.2.0/README.md +168 -0
- xqo_flows-3.2.0/pyproject.toml +31 -0
- xqo_flows-3.2.0/setup.cfg +4 -0
- xqo_flows-3.2.0/src/xqo_flows/__init__.py +322 -0
- xqo_flows-3.2.0/src/xqo_flows/engine.py +272 -0
- xqo_flows-3.2.0/src/xqo_flows/examples/draft-review-approve.json +37 -0
- xqo_flows-3.2.0/src/xqo_flows/examples/hello.json +17 -0
- xqo_flows-3.2.0/src/xqo_flows/model.py +336 -0
- xqo_flows-3.2.0/src/xqo_flows/service.py +622 -0
- xqo_flows-3.2.0/src/xqo_flows/static/editor.css +1 -0
- xqo_flows-3.2.0/src/xqo_flows/static/editor.html +14 -0
- xqo_flows-3.2.0/src/xqo_flows/static/editor.js +297 -0
- xqo_flows-3.2.0/src/xqo_flows/static/ui.js +12 -0
- xqo_flows-3.2.0/src/xqo_flows/steps.py +54 -0
- xqo_flows-3.2.0/src/xqo_flows/triggers.py +164 -0
- xqo_flows-3.2.0/src/xqo_flows/workers.py +411 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/PKG-INFO +187 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/SOURCES.txt +25 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/dependency_links.txt +1 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/entry_points.txt +2 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/requires.txt +9 -0
- xqo_flows-3.2.0/src/xqo_flows.egg-info/top_level.txt +1 -0
- xqo_flows-3.2.0/tests/test_model.py +53 -0
- xqo_flows-3.2.0/tests/test_runs.py +210 -0
- xqo_flows-3.2.0/tests/test_triggers.py +223 -0
xqo_flows-3.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dudikkocak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
xqo_flows-3.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xqo-flows
|
|
3
|
+
Version: 3.2.0
|
|
4
|
+
Summary: Visual workflows for xqo: a FlowGram.AI editor, a flow runner and remote workers
|
|
5
|
+
Author: dudikkocak
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dudikkocak/xqo
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: xqo<4,>=3.0
|
|
12
|
+
Provides-Extra: schedules
|
|
13
|
+
Requires-Dist: xqo-schedules==3.2.0; extra == "schedules"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-timeout>=2.3; extra == "dev"
|
|
17
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# xqo-flows
|
|
21
|
+
|
|
22
|
+
Visual workflows for [xqo](https://github.com/dudikkocak/xqo). You draw a flow of agent steps, conditions,
|
|
23
|
+
approvals and remote steps in a [FlowGram.AI](https://github.com/bytedance/flowgram.ai) editor (MIT). xqo runs
|
|
24
|
+
each step as an ordinary task, so it shows up in the dashboard, the task list and the 2D/3D office like any other.
|
|
25
|
+
Remote steps go to headless workers on other machines ([`xqo-flows-runner`](../xqo-flows-runner)).
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install xqo-flows # or: pip install "xqo[flows]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
"flows": {}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Add that key to `agents.json` and restart `xqo serve`. Without the key the plugin stays inactive. The dashboard
|
|
36
|
+
header gets a **flows** link to the editor at `/plugins/flows/editor.html`. On first start two example flows are
|
|
37
|
+
written: `hello` and `draft-review-approve`.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Drawing a flow
|
|
42
|
+
|
|
43
|
+
- **+ New** gives you a start node, one agent step and an end node. The palette adds more steps. To connect two
|
|
44
|
+
steps, drag from a node's right edge to the next node's left edge. Click a step to edit it in the side panel.
|
|
45
|
+
**Save** stores the flow as `artifacts/flows/<name>.json`, and backups include it.
|
|
46
|
+
- Step types:
|
|
47
|
+
|
|
48
|
+
| Step | What it does | Settings |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| **Start** | Where a run begins. Lists the flow's inputs. | `inputs: [{name, default}]` |
|
|
51
|
+
| **Agent** | Runs an xqo task for one of this HQ's agents (empty agent = the first agent). | `agent`, `prompt`, `unattended`, `continue_on_error` |
|
|
52
|
+
| **Remote** | Runs a task on a headless worker whose labels include all of the step's labels. | `labels`, `worker`, `agent`, `prompt`, `timeout`, `continue_on_error` |
|
|
53
|
+
| **Condition** | Takes the branch of the first rule that holds, otherwise `else`. | `conditions: [{key, left, op, right}]` with op `contains`, `not_contains`, `equals`, `not_equals`, `matches` (regex), `empty`, `not_empty`, `gt`, `lt` |
|
|
54
|
+
| **Approval** | Waits until you approve or reject. After the timeout it takes the default answer. | `question`, `timeout`, `default` |
|
|
55
|
+
| **End** | The run's result. | `output` (empty = the last step's result) |
|
|
56
|
+
|
|
57
|
+
- **Templates** in prompts, rules, questions and outputs: `{{inputs.topic}}`, `{{step_id}}` or `{{step_id.result}}`,
|
|
58
|
+
`{{step_id.status}}`, `{{step_id.task_id}}`. A remote step also has `{{step_id.worker}}`.
|
|
59
|
+
- **Order:** when several lines leave one step, their targets run in parallel. A step with several incoming lines
|
|
60
|
+
waits for every branch that is still alive. Branches a condition or approval did not take are skipped, so a join
|
|
61
|
+
after a condition does not wait for them. Flows cannot loop.
|
|
62
|
+
- **Failures:** a failed step fails the run and cancels the steps still running. Steps with `continue_on_error`
|
|
63
|
+
are the exception: the run carries on.
|
|
64
|
+
|
|
65
|
+
## Running a flow
|
|
66
|
+
|
|
67
|
+
| From | How |
|
|
68
|
+
|---|---|
|
|
69
|
+
| Editor | **▶ Run** asks for the inputs, then shows each step live: running, waiting, done, skipped or error. **Approve** and **Reject** buttons appear in the Runs tab. |
|
|
70
|
+
| CLI | `xqo flows run NAME -i topic="…"` follows the run, `--no-wait` returns at once. Also: `xqo flows list / show / import FILE / rm / runs / cancel RUN / resume RUN / approve RUN STEP [--reject] / triggers / workers / token` |
|
|
71
|
+
| Triggers | Schedules and webhooks (below) |
|
|
72
|
+
| API | `POST /api/flows/NAME/run` with `{"inputs": {...}}` returns the run. Read it with `GET /api/flows/runs/RUN_ID`, answer approvals with `POST /api/flows/runs/RUN_ID/approve` and `{"node": "...", "approve": true}`. |
|
|
73
|
+
| Agents | Agents listed in `agents_may_run` get a `run_flow` tool, which waits for the result. A step of a flow cannot start another flow. |
|
|
74
|
+
|
|
75
|
+
Each run is saved in `artifacts/flows/runs/<run_id>.json`. While a run waits for an approval, the dashboard shows
|
|
76
|
+
a toast that links to it.
|
|
77
|
+
|
|
78
|
+
**Resume.** If the server stops during a run, the run is marked `interrupted` at the next start. Press **↻ Resume**
|
|
79
|
+
on the run in the editor (or `xqo flows resume RUN`, or `POST /api/flows/runs/RUN_ID/resume`) to continue it:
|
|
80
|
+
steps that finished keep their results and the rest run again. Failed and cancelled runs can be resumed the same
|
|
81
|
+
way. A resume runs the flow as it was when the run started, even if you edited it since. A run that went to a
|
|
82
|
+
worker as a whole goes back to a worker with the same labels.
|
|
83
|
+
|
|
84
|
+
## Triggers
|
|
85
|
+
|
|
86
|
+
Triggers start runs without anyone pressing ▶ Run. Add them in the editor (click the canvas, then **+ schedule**
|
|
87
|
+
or **+ webhook** in the Flow panel), or in the flow's `triggers` list:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
"triggers": [
|
|
91
|
+
{"id": "nightly", "type": "schedule", "cron": "0 2 * * 1-5", "tz": "Europe/Berlin", "inputs": {"topic": "the backlog"}},
|
|
92
|
+
{"id": "hourly", "type": "schedule", "every": "1h"},
|
|
93
|
+
{"id": "launch", "type": "schedule", "at": "2026-12-01T09:00"},
|
|
94
|
+
{"id": "issue", "type": "webhook", "secret_env": "FLOW_ISSUE_SECRET", "inputs": {"topic": "{{body.issue.title}}"}}
|
|
95
|
+
]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| Key | Meaning |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `cron` / `every` / `at` | Schedules: exactly one. `every` takes `30m`, `6h`, `1d`. Needs `pip install "xqo-flows[schedules]"`. |
|
|
101
|
+
| `tz` | The schedule's time zone (default: the HQ's) |
|
|
102
|
+
| `overlap` | `skip` (default): no new run while the trigger's last run is still going. `parallel`: start anyway. |
|
|
103
|
+
| `secret_env` | Webhooks: the environment variable that holds the secret. A plaintext `secret` is refused. |
|
|
104
|
+
| `trust` | Webhooks: `untrusted` (default) or `trusted`, see below |
|
|
105
|
+
| `max_per_minute` | Webhooks: calls allowed per minute (default 30), then `429` |
|
|
106
|
+
| `inputs` | The run's inputs. Webhook inputs can use `{{body}}`, `{{body.a.b}}` (JSON, lists by index) and `{{headers.x-github-event}}`. |
|
|
107
|
+
| `enabled` | `false` keeps the trigger but turns it off |
|
|
108
|
+
|
|
109
|
+
- **Schedules** keep their next and last run in `artifacts/flows/queue/triggers.json`. A run missed while the
|
|
110
|
+
server was down by less than an hour runs once at start; older misses are skipped. `xqo flows triggers` lists
|
|
111
|
+
every trigger with its next run, last run and the result.
|
|
112
|
+
- **Webhooks** are `POST /flows/v1/hooks/<flow>/<trigger id>` on the public listener (`listen`, the same one
|
|
113
|
+
workers use), or `/api/flows/hooks/<flow>/<trigger id>` on the dashboard's own address. The caller sends
|
|
114
|
+
`Authorization: Bearer <secret>`, or signs the body: `X-Hub-Signature-256: sha256=<HMAC-SHA256>` (what GitHub
|
|
115
|
+
sends; `X-XQO-Signature` works the same). The answer is `202 {"run_id": ...}`; a wrong secret gets `401`.
|
|
116
|
+
- Values from a webhook request reach the prompts inside `<untrusted_webhook_data>` markers, so agents treat them
|
|
117
|
+
as data, not instructions. Set `"trust": "trusted"` only for callers you control.
|
|
118
|
+
|
|
119
|
+
## Remote workers
|
|
120
|
+
|
|
121
|
+
A worker is a headless xqo on another machine: no dashboard and no office. It has its own `agents.json`, API keys,
|
|
122
|
+
sandbox and budgets. The worker connects out to the HQ and nothing listens on the worker, so it works behind NAT.
|
|
123
|
+
The HQ serves a small worker API on its own listener and lists each worker with its own token and its labels.
|
|
124
|
+
Because the HQ assigns the labels, a worker cannot take jobs meant for other workers.
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
"flows": {
|
|
128
|
+
"listen": "0.0.0.0:8200",
|
|
129
|
+
"workers": {
|
|
130
|
+
"lease_seconds": 60,
|
|
131
|
+
"max_attempts": 2,
|
|
132
|
+
"allow": {"gpu-box": {"token_env": "XQO_WORKER_GPU_BOX_TOKEN", "labels": ["gpu", "linux"]}}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- A **Remote** step sends one task to a worker. The rest of the flow stays on the HQ.
|
|
138
|
+
- **Run the whole flow on a worker:** in the editor choose *Where: the whole flow on a worker*, or run
|
|
139
|
+
`xqo flows run NAME --labels gpu` (also `--worker NAME` or `--remote`). The worker runs the flow with its own
|
|
140
|
+
agents and sends each step's state back with its heartbeats, so the editor still shows the run live.
|
|
141
|
+
**Approval steps** are still asked on the HQ: the question shows up in the editor, the dashboard toast and
|
|
142
|
+
`xqo flows approve`, and the answer goes back to the worker with its next heartbeat (every second while an
|
|
143
|
+
approval waits). Its timeout runs on the worker. A flow with Remote steps cannot run on a worker as a whole.
|
|
144
|
+
- **Cancel:** cancelling a run on the HQ cancels the worker's task at its next heartbeat. If a worker stops sending
|
|
145
|
+
heartbeats for `lease_seconds`, its job goes back to the queue (at most `max_attempts` times, then it fails).
|
|
146
|
+
Jobs still open when the HQ restarts are cancelled.
|
|
147
|
+
- `xqo flows workers` lists each worker with its online state and the job queue.
|
|
148
|
+
|
|
149
|
+
Worker setup: see [`xqo-flows-runner`](../xqo-flows-runner). There is a complete sample in
|
|
150
|
+
[`examples/setup/`](examples/setup): HQ and worker configs, a remote flow, Docker Compose files and an `.env`
|
|
151
|
+
template.
|
|
152
|
+
|
|
153
|
+
## Settings
|
|
154
|
+
|
|
155
|
+
| Key | Default | Meaning |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| `max_running` | 20 | Runs that can be going at once on this HQ |
|
|
158
|
+
| `approval_timeout` | 86400 | Seconds before an approval takes its default answer (0 = wait forever). A step's own `timeout` wins. |
|
|
159
|
+
| `agents_may_run` | `[]` | Agents that get `run_flow` (`"*"` = all agents) |
|
|
160
|
+
| `tool_timeout` | 3600 | How long `run_flow` waits for the run |
|
|
161
|
+
| `examples` | true | Write the example flows on the first start |
|
|
162
|
+
| `listen` | none | The public listener for the worker API and webhooks, `host:port`. `XQO_FLOWS_LISTEN` overrides it; `workers.listen` still works. |
|
|
163
|
+
| `workers` | none | Remote workers (above) |
|
|
164
|
+
|
|
165
|
+
## Security
|
|
166
|
+
|
|
167
|
+
- The dashboard and `/api/flows` have no login, the same as the rest of xqo, so keep them on `127.0.0.1`. Only the
|
|
168
|
+
public listener (`listen`: the worker API and webhooks) is meant to be reachable from other machines. Workers
|
|
169
|
+
need a per-worker bearer token and webhooks their own secret, both from environment variables; plaintext
|
|
170
|
+
tokens and secrets in the config are refused. Put the listener behind TLS (a reverse proxy) when it crosses an
|
|
171
|
+
untrusted network.
|
|
172
|
+
- Webhook values are marked as untrusted data in prompts unless the trigger says `"trust": "trusted"`, and each
|
|
173
|
+
webhook is rate limited.
|
|
174
|
+
- Agent steps run with the agent's normal tools, grants and budgets. Steps are `unattended` by default, which
|
|
175
|
+
means questions to you take their default answer, as in scheduled runs. Untick it to make a step wait for
|
|
176
|
+
you.
|
|
177
|
+
|
|
178
|
+
## The editor
|
|
179
|
+
|
|
180
|
+
The editor source is in [`editor/`](editor), written in React and FlowGram.AI `@flowgram.ai/free-layout-editor`
|
|
181
|
+
1.0.16, which is pinned. It is built into `src/xqo_flows/static/editor.js`, so installing the package needs no
|
|
182
|
+
Node. To change the editor:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cd packages/xqo-flows/editor
|
|
186
|
+
npm ci && npm run build # CI rebuilds it and fails if the committed bundle is out of date
|
|
187
|
+
```
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# xqo-flows
|
|
2
|
+
|
|
3
|
+
Visual workflows for [xqo](https://github.com/dudikkocak/xqo). You draw a flow of agent steps, conditions,
|
|
4
|
+
approvals and remote steps in a [FlowGram.AI](https://github.com/bytedance/flowgram.ai) editor (MIT). xqo runs
|
|
5
|
+
each step as an ordinary task, so it shows up in the dashboard, the task list and the 2D/3D office like any other.
|
|
6
|
+
Remote steps go to headless workers on other machines ([`xqo-flows-runner`](../xqo-flows-runner)).
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install xqo-flows # or: pip install "xqo[flows]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
"flows": {}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Add that key to `agents.json` and restart `xqo serve`. Without the key the plugin stays inactive. The dashboard
|
|
17
|
+
header gets a **flows** link to the editor at `/plugins/flows/editor.html`. On first start two example flows are
|
|
18
|
+
written: `hello` and `draft-review-approve`.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
## Drawing a flow
|
|
23
|
+
|
|
24
|
+
- **+ New** gives you a start node, one agent step and an end node. The palette adds more steps. To connect two
|
|
25
|
+
steps, drag from a node's right edge to the next node's left edge. Click a step to edit it in the side panel.
|
|
26
|
+
**Save** stores the flow as `artifacts/flows/<name>.json`, and backups include it.
|
|
27
|
+
- Step types:
|
|
28
|
+
|
|
29
|
+
| Step | What it does | Settings |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| **Start** | Where a run begins. Lists the flow's inputs. | `inputs: [{name, default}]` |
|
|
32
|
+
| **Agent** | Runs an xqo task for one of this HQ's agents (empty agent = the first agent). | `agent`, `prompt`, `unattended`, `continue_on_error` |
|
|
33
|
+
| **Remote** | Runs a task on a headless worker whose labels include all of the step's labels. | `labels`, `worker`, `agent`, `prompt`, `timeout`, `continue_on_error` |
|
|
34
|
+
| **Condition** | Takes the branch of the first rule that holds, otherwise `else`. | `conditions: [{key, left, op, right}]` with op `contains`, `not_contains`, `equals`, `not_equals`, `matches` (regex), `empty`, `not_empty`, `gt`, `lt` |
|
|
35
|
+
| **Approval** | Waits until you approve or reject. After the timeout it takes the default answer. | `question`, `timeout`, `default` |
|
|
36
|
+
| **End** | The run's result. | `output` (empty = the last step's result) |
|
|
37
|
+
|
|
38
|
+
- **Templates** in prompts, rules, questions and outputs: `{{inputs.topic}}`, `{{step_id}}` or `{{step_id.result}}`,
|
|
39
|
+
`{{step_id.status}}`, `{{step_id.task_id}}`. A remote step also has `{{step_id.worker}}`.
|
|
40
|
+
- **Order:** when several lines leave one step, their targets run in parallel. A step with several incoming lines
|
|
41
|
+
waits for every branch that is still alive. Branches a condition or approval did not take are skipped, so a join
|
|
42
|
+
after a condition does not wait for them. Flows cannot loop.
|
|
43
|
+
- **Failures:** a failed step fails the run and cancels the steps still running. Steps with `continue_on_error`
|
|
44
|
+
are the exception: the run carries on.
|
|
45
|
+
|
|
46
|
+
## Running a flow
|
|
47
|
+
|
|
48
|
+
| From | How |
|
|
49
|
+
|---|---|
|
|
50
|
+
| Editor | **▶ Run** asks for the inputs, then shows each step live: running, waiting, done, skipped or error. **Approve** and **Reject** buttons appear in the Runs tab. |
|
|
51
|
+
| CLI | `xqo flows run NAME -i topic="…"` follows the run, `--no-wait` returns at once. Also: `xqo flows list / show / import FILE / rm / runs / cancel RUN / resume RUN / approve RUN STEP [--reject] / triggers / workers / token` |
|
|
52
|
+
| Triggers | Schedules and webhooks (below) |
|
|
53
|
+
| API | `POST /api/flows/NAME/run` with `{"inputs": {...}}` returns the run. Read it with `GET /api/flows/runs/RUN_ID`, answer approvals with `POST /api/flows/runs/RUN_ID/approve` and `{"node": "...", "approve": true}`. |
|
|
54
|
+
| Agents | Agents listed in `agents_may_run` get a `run_flow` tool, which waits for the result. A step of a flow cannot start another flow. |
|
|
55
|
+
|
|
56
|
+
Each run is saved in `artifacts/flows/runs/<run_id>.json`. While a run waits for an approval, the dashboard shows
|
|
57
|
+
a toast that links to it.
|
|
58
|
+
|
|
59
|
+
**Resume.** If the server stops during a run, the run is marked `interrupted` at the next start. Press **↻ Resume**
|
|
60
|
+
on the run in the editor (or `xqo flows resume RUN`, or `POST /api/flows/runs/RUN_ID/resume`) to continue it:
|
|
61
|
+
steps that finished keep their results and the rest run again. Failed and cancelled runs can be resumed the same
|
|
62
|
+
way. A resume runs the flow as it was when the run started, even if you edited it since. A run that went to a
|
|
63
|
+
worker as a whole goes back to a worker with the same labels.
|
|
64
|
+
|
|
65
|
+
## Triggers
|
|
66
|
+
|
|
67
|
+
Triggers start runs without anyone pressing ▶ Run. Add them in the editor (click the canvas, then **+ schedule**
|
|
68
|
+
or **+ webhook** in the Flow panel), or in the flow's `triggers` list:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
"triggers": [
|
|
72
|
+
{"id": "nightly", "type": "schedule", "cron": "0 2 * * 1-5", "tz": "Europe/Berlin", "inputs": {"topic": "the backlog"}},
|
|
73
|
+
{"id": "hourly", "type": "schedule", "every": "1h"},
|
|
74
|
+
{"id": "launch", "type": "schedule", "at": "2026-12-01T09:00"},
|
|
75
|
+
{"id": "issue", "type": "webhook", "secret_env": "FLOW_ISSUE_SECRET", "inputs": {"topic": "{{body.issue.title}}"}}
|
|
76
|
+
]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
| Key | Meaning |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `cron` / `every` / `at` | Schedules: exactly one. `every` takes `30m`, `6h`, `1d`. Needs `pip install "xqo-flows[schedules]"`. |
|
|
82
|
+
| `tz` | The schedule's time zone (default: the HQ's) |
|
|
83
|
+
| `overlap` | `skip` (default): no new run while the trigger's last run is still going. `parallel`: start anyway. |
|
|
84
|
+
| `secret_env` | Webhooks: the environment variable that holds the secret. A plaintext `secret` is refused. |
|
|
85
|
+
| `trust` | Webhooks: `untrusted` (default) or `trusted`, see below |
|
|
86
|
+
| `max_per_minute` | Webhooks: calls allowed per minute (default 30), then `429` |
|
|
87
|
+
| `inputs` | The run's inputs. Webhook inputs can use `{{body}}`, `{{body.a.b}}` (JSON, lists by index) and `{{headers.x-github-event}}`. |
|
|
88
|
+
| `enabled` | `false` keeps the trigger but turns it off |
|
|
89
|
+
|
|
90
|
+
- **Schedules** keep their next and last run in `artifacts/flows/queue/triggers.json`. A run missed while the
|
|
91
|
+
server was down by less than an hour runs once at start; older misses are skipped. `xqo flows triggers` lists
|
|
92
|
+
every trigger with its next run, last run and the result.
|
|
93
|
+
- **Webhooks** are `POST /flows/v1/hooks/<flow>/<trigger id>` on the public listener (`listen`, the same one
|
|
94
|
+
workers use), or `/api/flows/hooks/<flow>/<trigger id>` on the dashboard's own address. The caller sends
|
|
95
|
+
`Authorization: Bearer <secret>`, or signs the body: `X-Hub-Signature-256: sha256=<HMAC-SHA256>` (what GitHub
|
|
96
|
+
sends; `X-XQO-Signature` works the same). The answer is `202 {"run_id": ...}`; a wrong secret gets `401`.
|
|
97
|
+
- Values from a webhook request reach the prompts inside `<untrusted_webhook_data>` markers, so agents treat them
|
|
98
|
+
as data, not instructions. Set `"trust": "trusted"` only for callers you control.
|
|
99
|
+
|
|
100
|
+
## Remote workers
|
|
101
|
+
|
|
102
|
+
A worker is a headless xqo on another machine: no dashboard and no office. It has its own `agents.json`, API keys,
|
|
103
|
+
sandbox and budgets. The worker connects out to the HQ and nothing listens on the worker, so it works behind NAT.
|
|
104
|
+
The HQ serves a small worker API on its own listener and lists each worker with its own token and its labels.
|
|
105
|
+
Because the HQ assigns the labels, a worker cannot take jobs meant for other workers.
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
"flows": {
|
|
109
|
+
"listen": "0.0.0.0:8200",
|
|
110
|
+
"workers": {
|
|
111
|
+
"lease_seconds": 60,
|
|
112
|
+
"max_attempts": 2,
|
|
113
|
+
"allow": {"gpu-box": {"token_env": "XQO_WORKER_GPU_BOX_TOKEN", "labels": ["gpu", "linux"]}}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- A **Remote** step sends one task to a worker. The rest of the flow stays on the HQ.
|
|
119
|
+
- **Run the whole flow on a worker:** in the editor choose *Where: the whole flow on a worker*, or run
|
|
120
|
+
`xqo flows run NAME --labels gpu` (also `--worker NAME` or `--remote`). The worker runs the flow with its own
|
|
121
|
+
agents and sends each step's state back with its heartbeats, so the editor still shows the run live.
|
|
122
|
+
**Approval steps** are still asked on the HQ: the question shows up in the editor, the dashboard toast and
|
|
123
|
+
`xqo flows approve`, and the answer goes back to the worker with its next heartbeat (every second while an
|
|
124
|
+
approval waits). Its timeout runs on the worker. A flow with Remote steps cannot run on a worker as a whole.
|
|
125
|
+
- **Cancel:** cancelling a run on the HQ cancels the worker's task at its next heartbeat. If a worker stops sending
|
|
126
|
+
heartbeats for `lease_seconds`, its job goes back to the queue (at most `max_attempts` times, then it fails).
|
|
127
|
+
Jobs still open when the HQ restarts are cancelled.
|
|
128
|
+
- `xqo flows workers` lists each worker with its online state and the job queue.
|
|
129
|
+
|
|
130
|
+
Worker setup: see [`xqo-flows-runner`](../xqo-flows-runner). There is a complete sample in
|
|
131
|
+
[`examples/setup/`](examples/setup): HQ and worker configs, a remote flow, Docker Compose files and an `.env`
|
|
132
|
+
template.
|
|
133
|
+
|
|
134
|
+
## Settings
|
|
135
|
+
|
|
136
|
+
| Key | Default | Meaning |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| `max_running` | 20 | Runs that can be going at once on this HQ |
|
|
139
|
+
| `approval_timeout` | 86400 | Seconds before an approval takes its default answer (0 = wait forever). A step's own `timeout` wins. |
|
|
140
|
+
| `agents_may_run` | `[]` | Agents that get `run_flow` (`"*"` = all agents) |
|
|
141
|
+
| `tool_timeout` | 3600 | How long `run_flow` waits for the run |
|
|
142
|
+
| `examples` | true | Write the example flows on the first start |
|
|
143
|
+
| `listen` | none | The public listener for the worker API and webhooks, `host:port`. `XQO_FLOWS_LISTEN` overrides it; `workers.listen` still works. |
|
|
144
|
+
| `workers` | none | Remote workers (above) |
|
|
145
|
+
|
|
146
|
+
## Security
|
|
147
|
+
|
|
148
|
+
- The dashboard and `/api/flows` have no login, the same as the rest of xqo, so keep them on `127.0.0.1`. Only the
|
|
149
|
+
public listener (`listen`: the worker API and webhooks) is meant to be reachable from other machines. Workers
|
|
150
|
+
need a per-worker bearer token and webhooks their own secret, both from environment variables; plaintext
|
|
151
|
+
tokens and secrets in the config are refused. Put the listener behind TLS (a reverse proxy) when it crosses an
|
|
152
|
+
untrusted network.
|
|
153
|
+
- Webhook values are marked as untrusted data in prompts unless the trigger says `"trust": "trusted"`, and each
|
|
154
|
+
webhook is rate limited.
|
|
155
|
+
- Agent steps run with the agent's normal tools, grants and budgets. Steps are `unattended` by default, which
|
|
156
|
+
means questions to you take their default answer, as in scheduled runs. Untick it to make a step wait for
|
|
157
|
+
you.
|
|
158
|
+
|
|
159
|
+
## The editor
|
|
160
|
+
|
|
161
|
+
The editor source is in [`editor/`](editor), written in React and FlowGram.AI `@flowgram.ai/free-layout-editor`
|
|
162
|
+
1.0.16, which is pinned. It is built into `src/xqo_flows/static/editor.js`, so installing the package needs no
|
|
163
|
+
Node. To change the editor:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cd packages/xqo-flows/editor
|
|
167
|
+
npm ci && npm run build # CI rebuilds it and fails if the committed bundle is out of date
|
|
168
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xqo-flows"
|
|
7
|
+
version = "3.2.0"
|
|
8
|
+
description = "Visual workflows for xqo: a FlowGram.AI editor, a flow runner and remote workers"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{name = "dudikkocak"}]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"xqo>=3.0,<4",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
schedules = ["xqo-schedules==3.2.0"] # schedule triggers (cron / every / at)
|
|
19
|
+
dev = ["pytest>=8", "pytest-timeout>=2.3", "httpx>=0.27"]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/dudikkocak/xqo"
|
|
23
|
+
|
|
24
|
+
[project.entry-points."xqo.plugins"]
|
|
25
|
+
flows = "xqo_flows:FlowsPlugin"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
xqo_flows = ["static/*", "static/**/*", "examples/*.json"]
|