You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Deterministic TypeScript fan-out |`workflow({ meta, input?, body })` + `export default`; use `call`, `pipeline`, `parallel`, `until` inside `body`|
63
63
| One-off prompt inside a workflow |`call.text(prompt)` for a string, `call.json(prompt, schema)` for structured output |
64
64
| Reusable workflow step | Define an `agent({ input, output })` and `call(worker, input, { label, phase })`|
65
+
| Phase or log from an agent program | Import `phase` / `log` from `rig` and call them at top level; the launcher runs every program inside a workflow |
Copy file name to clipboardExpand all lines: skills/rig/references/dynamic-workflows.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,28 @@ export default linter;
77
77
- Omit `input` for a no-input program (inline mode) or add `input: s.object({ ... })` for file-mode programs that read stdin JSON.
78
78
- Use `agent()` with `agents:` when an LLM should improvise the coordination order. Use `workflow()` when TypeScript owns the orchestration (fan-out, branching, convergence).
79
79
80
+
## Top-level constructs in agent programs
81
+
82
+
The launcher runs every program inside a workflow run, including programs whose
83
+
root export is an `agent`, a string, or a prompt builder. Module evaluation
84
+
happens inside that run, so `phase()` and `log()` imported from `rig` work at the
85
+
program's top level without declaring a `workflow()`:
86
+
87
+
```ts
88
+
import { agent, log, phase } from"rig";
89
+
90
+
phase("Review");
91
+
log("reviewing the staged diff");
92
+
93
+
exportdefaultagent({ instructions: "Review the staged diff." });
94
+
```
95
+
96
+
`currentWorkflow()` returns the active run context (`call`, `budget`, `signal`,
97
+
`phase`, `log`) or `undefined` outside a run; `phase()` and `log()` are no-ops
98
+
outside a run. A `workflow()` default export is nested into the same run, so it
99
+
shares the launcher's limiter, budget, and event stream instead of starting a
Copy file name to clipboardExpand all lines: skills/rig/references/runtime.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,12 @@ Stdin coercion follows the root schema:
39
39
40
40
The launcher writes string results, or the string `text` field of an object result, directly to stdout. It JSON-serializes other results.
41
41
42
+
Both modes evaluate the program and run its root inside a workflow run, so
43
+
top-level `phase()` and `log()` work in any program and `currentWorkflow()` is
44
+
defined from module scope. A `workflow` default export nests into that run
45
+
instead of starting a second one. Run events are emitted under the
46
+
`workflow:event` debug category.
47
+
42
48
Add `--server` in either mode to start the Copilot server over stdio and force the Copilot engine. Without it, `copilotEngine()` connects over HTTP using `COPILOT_SDK_URI`, then `localhost:7777`.
43
49
44
50
Use `--help`, `-h`, `help`, `/help`, or `/?` to print launcher usage.
0 commit comments