Program stability × Agent initiative

Let code drive the flow. Agents handle judgment.

Dynamic Workflow puts orchestration in TypeScript. Order, concurrency, and stopping rules become explicit; a complete Agent Loop runs only where the task needs understanding and judgment.

See how it works
01 / CODE HOLDS THE PLAN 02 / AGENTS HANDLE JUDGMENT 03 / HUMANS RETAIN RESPONSIBILITY
01

WHY DYNAMIC WORKFLOW

Not every step
needs a model.

Skills carry knowledge and strategy. When mechanical steps also live in natural language, the Agent often has to interpret the plan again as it advances. Dynamic Workflow moves that control flow into code.

01

Code holds the plan

Phases, branches, Barriers, retry limits, and stopping rules live in code, where they can be reviewed and tested.

02

Agents handle judgment

agent() starts a complete ReAct Loop with tools and its own Context—not a one-shot Prompt completion.

03

Schema gives code a stable shape

When code consumes an Agent result, JSON Schema validates its shape before the next step runs.

02

CREATE & RUN

Create one.
Run deep-research.

Generate a Workflow from one sentence, or run the bundled Deep Research example from the repository root.

Open the example
TERMINAL / CREATE GENERATE
PROMPT → CODEX AGENT WORKFLOW.TS → STDOUT
TERMINAL / DEEP RESEARCH RUN
JSONL EVENTS → STDERR RESULT → STDOUT
03

THE WORKFLOW IS CODE

Ordinary TypeScript.
Only agent() starts an Agent Loop.

Use arrays, branches, loops, and concurrency for the mechanical work. Call agent() when a step needs understanding, exploration, or judgment.

Read the Workflow API contract
workflow.ts
01 import { agent, parallel, phase } from
02   "@deerwork-ai/deer-workflow";
03
04 export const meta = {
05   name: "research-synthesis",
06   description: "Researches and synthesizes a topic.",
07   phases: [
08     { title: "Map the territory" },
09     { title: "Synthesize" },
10   ],
11 };
12
13 export default async function run(args) {
14   phase("Map the territory");
15   const signals = await parallel([
16     () => agent(`Research ${args.topic}`),
17     () => agent("Challenge assumptions"),
18   ]);
19
20   phase("Synthesize");
21   return agent(
22     `Synthesize:\n${JSON.stringify(signals)}`,
23   );
24 }
FLOW READY EXPLICIT IMPORTS / ASYNC RUNTIME