agentswf 0.1.0-beta.4 → 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 the agents.wf authors
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.
package/README.md CHANGED
@@ -1,14 +1,107 @@
1
1
  # agentswf
2
2
 
3
- agents.wf is an engine that runs workflows made of coding agents. This package gives you the
4
- `awf` command and `agentswf/workflow`, the module a workflow imports.
3
+ **Write workflows for coding agents in TypeScript.** Hand work to the coding agents you already
4
+ use, run them side by side, have one check another, loop until a reviewer is happy, and get typed
5
+ answers back. `awf` runs the workflow and handles the parts that make agent scripts fragile:
6
+ agents that never answer, answer in prose, hang, or quietly run up a bill.
5
7
 
6
- > **Beta.** Interfaces will change between versions.
8
+ ```ts
9
+ const reviewer = await wf.agents.open({ key: "reviewer", runtime: { harness: "codex", model: "gpt-6-luna" } });
10
+ const { outcome } = await reviewer.run({ prompt: "Review `git diff main`.", schema: FINDINGS });
11
+ if (outcome.answered) console.log(outcome.value.findings); // validated against FINDINGS, or a reason why not
12
+ ```
13
+
14
+ > **Shaped by use.** agents.wf is in its evaluation phase, and what people build with it decides
15
+ > where the design goes next. Found a bug, missing a use case, or have an idea?
16
+ > [Open an issue](https://github.com/romanlv/agentswf/issues).
17
+
18
+ ## How it works
19
+
20
+ 1. Your code calls `agent.run({ prompt, schema })`.
21
+ 2. awf hands the prompt to a coding agent, in a [Herdr](https://herdr.dev) pane you can watch or
22
+ headless.
23
+ 3. The agent works in your repo with its own tools and skills, then answers by running
24
+ `wfa result`.
25
+ 4. awf checks the answer against your schema. A wrong shape goes back to the agent to fix; a quiet
26
+ agent gets a nudge.
27
+ 5. `await` returns a typed value, and your code decides what happens next.
28
+
29
+ It drives the agent CLIs you already use, logged in as you already are: claude, codex, pi or
30
+ cursor. Control flow is plain TypeScript: `for`, `if`, `Promise.all`.
31
+
32
+ ## What you get
33
+
34
+ - **Typed answers, checked.** A turn ends `answered`, with JSON that fits its schema, or with a
35
+ reason: `unanswered`, `blocked`, `timed-out`, `failed` or `cancelled`.
36
+ - **Mix harnesses and models.** A codex reviewer checks a claude implementer; a cheap model
37
+ triages before an expensive one works.
38
+ - **Long-lived sessions.** An agent keeps its context from turn to turn; `compact` and `fork` it.
39
+ - **Stages you can continue.** A run that stops part-way goes on from the stage that stopped.
40
+ - **Cost on every run.** Time, tokens and an estimated cost per agent, stage and model.
41
+ - **Sandboxes, messaging, events.** docker or srt limits what agents reach, agents message each
42
+ other on routes you grant, and a run can wait for an event for weeks without a process running.
43
+ - **Free tests.** `agentswf/testing` runs a workflow on scripted agents; no agent starts.
44
+
45
+ ## Install
46
+
47
+ You need [Bun](https://bun.sh) 1.4 or later, git, and at least one agent CLI you're logged in to.
7
48
 
8
49
  ```sh
9
- bun add -g agentswf@beta
10
- awf run ./review.ts
50
+ bun add -g agentswf # puts awf in ~/.bun/bin
51
+ awf --version
11
52
  ```
12
53
 
13
- It runs on Bun only. The README in the repository says what to install first and how to write a
14
- workflow: [github.com/romanlv/agentswf](https://github.com/romanlv/agentswf).
54
+ ## Your first workflow
55
+
56
+ ```sh
57
+ mkdir ~/workflows && cd ~/workflows
58
+ awf init # a hello workflow, its test, and the config files
59
+ awf test # its test, on scripted agents
60
+ awf run hello/workflow.ts # one real agent
61
+ ```
62
+
63
+ ```ts
64
+ // hello/workflow.ts
65
+ import { typed } from "agentswf/typebox";
66
+ import { defineWorkflow } from "agentswf/workflow";
67
+ import Type from "typebox";
68
+
69
+ export const ANSWER = typed(Type.Object({ answer: Type.Integer() }, { additionalProperties: false }));
70
+
71
+ export default defineWorkflow({
72
+ meta: { name: "hello", description: "Ask one agent a question with a known answer." },
73
+ async run(wf) {
74
+ const agent = await wf.agents.open({
75
+ key: "hello",
76
+ runtime: { harness: "codex", model: "gpt-6-luna", placement: "headless" },
77
+ });
78
+ const { outcome } = await agent.run({
79
+ prompt: "What is 17 multiplied by 23? Work it out yourself; do not run any code.",
80
+ schema: ANSWER,
81
+ timeout: "3m",
82
+ });
83
+ return outcome.answered ? outcome.value : { unanswered: outcome.reason };
84
+ },
85
+ });
86
+ ```
87
+
88
+ `awf run` prints a line on time, tokens and estimated cost, then the run's record as JSON, its
89
+ `value` `{ "answer": 391 }`; a workflow's `present` prints something shorter instead. The record
90
+ stays in `.awf/runs/hello/{id}`; `awf runs` and `awf logs` show what it did.
91
+
92
+ ## What this package gives you
93
+
94
+ | Entry | For |
95
+ | --- | --- |
96
+ | `awf` | the command: run, test, follow and continue workflows |
97
+ | `agentswf/workflow` | what a workflow imports: `defineWorkflow`, the `wf` context |
98
+ | `agentswf/typebox` | `typed`, to turn a TypeBox schema into an answer schema |
99
+ | `agentswf/testing` | run a workflow on scripted agents in its tests |
100
+ | `agentswf/client` | drive runs from your own program |
101
+
102
+ ## Learn more
103
+
104
+ - [Guide](https://agents.wf/guide/) and [quick start](https://agents.wf/guide/quick-start)
105
+ - [Workflow API](https://agents.wf/reference/workflow-api), every call on one page
106
+ - [Patterns](https://agents.wf/patterns/review-loop): review loops, plan and implement
107
+ - [Examples and design](https://github.com/romanlv/agentswf), in the repository
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentswf",
3
- "version": "0.1.0-beta.4",
4
- "description": "agents.wf: an engine that runs workflows made of coding agents. Gives you awf, agentswf/workflow and agentswf/testing",
3
+ "version": "0.1.0",
4
+ "description": "agents.wf: an engine that runs workflows made of coding agents. Gives you awf, agentswf/workflow, agentswf/typebox, agentswf/testing and agentswf/client",
5
5
  "license": "MIT",
6
6
  "homepage": "https://agents.wf",
7
7
  "repository": {
@@ -18,15 +18,23 @@
18
18
  },
19
19
  "exports": {
20
20
  "./workflow": "./src/workflow.ts",
21
- "./testing": "./src/testing.ts"
21
+ "./testing": "./src/testing.ts",
22
+ "./typebox": "./src/typebox.ts",
23
+ "./client": "./src/client.ts"
22
24
  },
23
25
  "files": [
24
26
  "src",
25
- "README.md"
27
+ "!src/**/*.test.ts",
28
+ "!src/**/*.eval.ts",
29
+ "!src/**/*.typecheck.ts",
30
+ "!src/**/*.fixture.ts",
31
+ "!src/**/fixtures",
32
+ "README.md",
33
+ "LICENSE"
26
34
  ],
27
35
  "dependencies": {
28
- "@agentswf/contract": "0.1.0-beta.4",
29
- "@agentswf/engine": "0.1.0-beta.4"
36
+ "@agentswf/contract": "0.1.0",
37
+ "@agentswf/engine": "0.1.0"
30
38
  },
31
39
  "publishConfig": {
32
40
  "access": "public"
package/src/awf.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env -S bun --no-env-file
2
- import { main } from "@agentswf/engine/cli";
2
+ import { dirname } from "node:path";
3
+ import { handOver } from "@agentswf/engine/hand-over";
4
+ import manifest from "../package.json" with { type: "json" };
3
5
 
6
+ // Before the engine loads: a project at another version runs on its own (ADR 0015).
7
+ await handOver({ dir: dirname(import.meta.dir), version: manifest.version });
8
+ const { main } = await import("@agentswf/engine/cli");
4
9
  await main();
package/src/client.ts ADDED
@@ -0,0 +1,2 @@
1
+ // A program's way to a workflow's runs: the types live in the contract, `client` in the engine.
2
+ export * from "@agentswf/engine/client";
package/src/testing.ts CHANGED
@@ -1 +1,2 @@
1
+ // The curated list is the engine's workflow-testing/index.ts, which `awf test` serves too.
1
2
  export * from "@agentswf/engine/workflow-testing";
package/src/typebox.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@agentswf/engine/typebox";
package/src/workflow.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "@agentswf/contract/workflow";
1
+ // The list lives in the contract, which the engine also serves it from to the workflows it loads.
2
+ export * from "@agentswf/contract/author";