Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion skills/rig/claude-workflow-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Then read [Behavior differences](#behavior-differences-to-keep-in-mind) before y
| --- | --- | --- |
| `export const meta = { name, description, phases, whenToUse }` | `workflow({ meta: { name, description, phases, whenToUse } })` | `phases` accepts `"Title"` or `{ title, detail }`; `meta` may reference variables |
| `args` (JSON string or object) | `input` schema + `context.input` | Parsed and validated by the launcher; no defensive `JSON.parse` |
| `await agent(prompt)` | `await call.text(prompt, options?)` | Returns `string \| null` |
| `await agent(prompt)` | `await call.text(prompt, options?)` | Returns `string \| null`. A call with no `model` uses Rig's default `"small"`, which Anthropic rejects: pass a Claude model id on every call or agent (see [Model defaults](#model-defaults-on-claude)) |
| `await agent(prompt, { schema })` | `await call.json(prompt, schema, options?)` | `schema` is any `s.*` value (`s.object`, `s.enum`, `s.array`, …); result is typed and validated. Claude workflows only support object schemas; rig accepts any schema type. |
| Reused prompt + schema pair | `agent({ input, output, instructions })` then `call(worker, input, options?)` | Preferred for anything invoked more than once |
| `parallel(thunks)` | `parallel(thunks)` | Same barrier semantics; failures become `null` holes. **TypeScript note:** `parallel` uses a single generic `Result` type, so all thunks must return the same type. For agents with different output types, cast to preserve limiter semantics: `parallel<TypeA \| TypeB>([...]) as Promise<[TypeA \| null, TypeB \| null]>`. Avoid `Promise.all` in workflow bodies — it bypasses the concurrency limiter and skips the `null`-hole failure model that `parallel` provides. |
Expand Down Expand Up @@ -248,6 +248,20 @@ Use the `model` field on `agent({ model })` for a stable default, or override
per call with `call(agent, input, { model })`. There is no global `effort` knob;
pick a model tier that matches the task's quality requirement.

### Model defaults on Claude

A Claude dynamic workflow's `agent(prompt)` with no `model` runs on the session's
Claude model. Rig has no session model: an `agent()` or `call.text`/`call.json`
without `model` sends `"small"` to the engine, and `anthropicEngine()` forwards it
unchanged, so the Anthropic API rejects the call and `call` returns `null`.
When porting, set `model` on every `agent({ model })` or call, or define the
Claude Sonnet id once and spread it into call options:

```ts
const sonnet = { model: "claude-sonnet-4-5" };
const plan = await call.json("Draft a fix plan.", s.object({ plan: s.string }), { ...sonnet, label: "plan" });
```

## Behavior differences to keep in mind

- **Failure holes.** `call` returns `null` when an agent fails, and `parallel`
Expand All @@ -260,6 +274,8 @@ pick a model tier that matches the task's quality requirement.
first parameter and access the prior result through it in stage 2+. See
[401-multi-stage-pipeline-workflow.md](./samples/401-multi-stage-pipeline-workflow.md)
for a worked example.
- **No default Claude model.** Omitting `model` selects `"small"`, not the
session's Claude model; see [Model defaults](#model-defaults-on-claude).
- **Budget units.** rig counts agent calls, not tokens, so guard loops with
`budget.remaining() > n` where `n` is a call count.
- **Nesting depth.** `call.workflow` has no one-level restriction, but it shares
Expand Down
3 changes: 3 additions & 0 deletions skills/rig/samples/411-anthropic-engine-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ dynamic workflow. Per-call `{ model }` overrides still work the same way.
| Balanced (default for most Claude workflows) | `"sonnet"` | `"claude-sonnet-4-5"` |
| Most capable | `"opus"` | `"claude-opus-4-5"` |

Unlike a dynamic workflow's `agent(prompt)`, a Rig call with no `model` uses
`"small"`, which Anthropic rejects, so every call below names a Claude model.

Set `RIG_ENGINE=anthropic` or call `configureAgent(anthropicEngine())` at the
top of your program. Requires `ANTHROPIC_API_KEY` in the environment.

Expand Down