workflow
Function: workflow()
Call Signature
workflow<
A,B>(s1):Workflow<A,B>
Defined in: src/core-flow/Workflow.ts:301
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
Parameters
s1
Runner<A, B>
Returns
Workflow<A, B>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C>(s1,s2):Workflow<A,C>
Defined in: src/core-flow/Workflow.ts:302
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
Returns
Workflow<A, C>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D>(s1,s2,s3):Workflow<A,D>
Defined in: src/core-flow/Workflow.ts:306
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
Returns
Workflow<A, D>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D,E>(s1,s2,s3,s4):Workflow<A,E>
Defined in: src/core-flow/Workflow.ts:311
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
E
E
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
s4
Runner<NextStepInput<D>, E>
Returns
Workflow<A, E>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D,E,F>(s1,s2,s3,s4,s5):Workflow<A,F>
Defined in: src/core-flow/Workflow.ts:317
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
E
E
F
F
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
s4
Runner<NextStepInput<D>, E>
s5
Runner<NextStepInput<E>, F>
Returns
Workflow<A, F>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D,E,F,G>(s1,s2,s3,s4,s5,s6):Workflow<A,G>
Defined in: src/core-flow/Workflow.ts:324
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
E
E
F
F
G
G
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
s4
Runner<NextStepInput<D>, E>
s5
Runner<NextStepInput<E>, F>
s6
Runner<NextStepInput<F>, G>
Returns
Workflow<A, G>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D,E,F,G,H>(s1,s2,s3,s4,s5,s6,s7):Workflow<A,H>
Defined in: src/core-flow/Workflow.ts:332
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
E
E
F
F
G
G
H
H
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
s4
Runner<NextStepInput<D>, E>
s5
Runner<NextStepInput<E>, F>
s6
Runner<NextStepInput<F>, G>
s7
Runner<NextStepInput<G>, H>
Returns
Workflow<A, H>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });Call Signature
workflow<
A,B,C,D,E,F,G,H,I>(s1,s2,s3,s4,s5,s6,s7,s8):Workflow<A,I>
Defined in: src/core-flow/Workflow.ts:341
Chain 1–8 runners into one, with every hand-off checked by the compiler.
Step N's output type must be what step N+1 accepts — a string output
feeds the next step's { message } (the house convention), anything
else is handed over as-is. A chain that does not line up is a COMPILE
error, not a silent empty value at run time.
Type Parameters
A
A extends object
B
B
C
C
D
D
E
E
F
F
G
G
H
H
I
I
Parameters
s1
Runner<A, B>
s2
Runner<NextStepInput<B>, C>
s3
Runner<NextStepInput<C>, D>
s4
Runner<NextStepInput<D>, E>
s5
Runner<NextStepInput<E>, F>
s6
Runner<NextStepInput<F>, G>
s7
Runner<NextStepInput<G>, H>
s8
Runner<NextStepInput<H>, I>
Returns
Workflow<A, I>
Examples
LLM steps chain as they always have
const draft = LLMCall.create({ provider, model }).system('Draft it.').build();
const edit = LLMCall.create({ provider, model }).system('Tighten it.').build();
const pipeline = workflow(draft, edit);
const text = await pipeline.run({ message: 'a note about refunds' });structured hand-offs survive
const classify: Runner<{ message: string }, { topic: string }> = …;
const answer: Runner<{ topic: string }, string> = …;
await workflow(classify, answer).run({ message: 'my card was declined' });