acpx/examples/flows
Onur Solmaz be510ba918
refactor: add acpx runtime embedding API (#220)
* refactor: add acpx runtime embedding API

* fix: preserve session state on replay failure

* fix: honor startup controls in runtime manager

* Runtime: deduplicate shared session engine

* Runtime: honor oneshot and steer inputs

* Runtime: keep persistent sessions stable

* Runtime: initialize embedded event logs

* Runtime: drop unsupported ensure env

* Refactor: reorganize ACPX source layout

* refactor: finish ACPX source layout cleanup

* docs: note runtime embedding API
2026-04-06 00:52:21 +02:00
..
pr-triage feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
replay-viewer refactor: add acpx runtime embedding API (#220) 2026-04-06 00:52:21 +02:00
branch.flow.ts feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
echo.flow.ts feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
README.md feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
shell.flow.ts feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
two-turn.flow.ts feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00
workdir.flow.ts feat: validate flow definitions and require defineFlow (#219) 2026-04-05 15:34:56 +02:00

Flow Examples

These are source-tree examples for acpx flow run.

They range from small primitives to one larger end-to-end example.

They intentionally use the public authoring surface:

  • import flow helpers from acpx/flows

  • export a flow via defineFlow(...)

  • echo.flow.ts: one ACP step that returns a JSON reply

  • branch.flow.ts: ACP classification followed by a deterministic branch into either continue or checkpoint

  • pr-triage/pr-triage.flow.ts: a larger single-PR workflow example with a colocated written spec in pr-triage/README.md

  • replay-viewer/: a browser app that visualizes saved flow run bundles with React Flow, a recent-runs picker, ACP session inspection, and a dedicated viewer spec in docs/2026-03-27-flow-replay-viewer.md

  • shell.flow.ts: one native runtime-owned shell action that returns structured JSON

  • workdir.flow.ts: native workspace prep followed by an ACP step that runs inside that isolated cwd

  • two-turn.flow.ts: a longer same-session ACP example that inspects the workspace, uses tools, and refines a final answer across multiple steps

Run them from the repo root:

acpx flow run examples/flows/echo.flow.ts \
  --input-json '{"request":"Summarize this repository in one sentence."}'

acpx flow run examples/flows/branch.flow.ts \
  --input-json '{"task":"FIX: add a regression test for the reconnect bug"}'

acpx --approve-all flow run examples/flows/pr-triage/pr-triage.flow.ts \
  --input-json '{"repo":"openclaw/acpx","prNumber":150}'

acpx flow run examples/flows/shell.flow.ts \
  --input-json '{"text":"hello from shell"}'

acpx flow run examples/flows/workdir.flow.ts

acpx flow run examples/flows/two-turn.flow.ts \
  --input-json '{"topic":"How should we validate a new ACP adapter?"}'

Run the replay viewer from the repo root:

pnpm viewer

These examples are examples only. They do not define acpx core product behavior.

The PR-triage example can comment on or close real GitHub PRs if you run it against a live repository.

The PR-triage example declares an explicit approve-all requirement, so it must be run with --approve-all.