Skip to content

WorkflowDefinition

WorkflowDefinition<TInput, TOutput, TRawInput> = object

Defined in: packages/core/src/workflow/types.ts:96

TInput is the parsed schema output (defaults applied). TRawInput is what Workflow.run / Workflow.stream accept before parse.

Pin types with Zod (inputSchema / outputSchema) or with explicit generics and no runtime schema:

type In = { topic: string };
type Out = { papers: string[] };
adl.createWorkflow<In, Out>({
id: "search",
run: async (input, ctx) => ({ papers: [] }),
});

TInput

TOutput

TRawInput = TInput

id: string

Defined in: packages/core/src/workflow/types.ts:97


optional inputSchema?: z.ZodType<TInput, TRawInput>

Defined in: packages/core/src/workflow/types.ts:99

Optional Zod schema. Omit when TInput is pinned by generics or run annotations.


optional outputSchema?: z.ZodType<TOutput>

Defined in: packages/core/src/workflow/types.ts:101

Optional Zod schema. Omit when TOutput is pinned by generics or run’s return type.


run: (input, ctx) => Promise<TOutput>

Defined in: packages/core/src/workflow/types.ts:103

Author implementation — receives parsed input and ctx from the runtime.

TInput

WorkflowContext

Promise<TOutput>