Zod schema of the fn's input.
Zod schema of the fn's return.
Step parameters
Optionaldescription?: stringDescription of the step
A handler function containing the step code
OptionalinputSchema?: InputSchemaZod schema for the fn input
Human-readable step name (must start with a letter or underscore, followed by letters, numbers, or underscores)
Optionaloptions?: StepOptionsOptional step options.
OptionaloutputSchema?: OutputSchemaZod schema for the fn output
The same handler function set at fn
step( {
name: 'process',
description: 'A generic process',
inputSchema: z.object( {
value: z.number()
} ),
outputSchema: z.string(),
fn: async input => {
const result = await ai.call( input.value );
return result as string;
}
} )
step( {
name: 'process',
description: 'A generic process',
inputSchema: z.object( {
value: z.number()
} ),
fn: async input => {
await ai.call( input.value );
}
} )
step( {
name: 'process',
description: 'A generic process',
outputSchema: z.string(),
fn: async () => {
const result = await ai.call();
return result as string;
}
} )
step( {
name: 'process',
description: 'A generic process',
fn: async () => {
await ai.call();
}
} )
Creates a step.
A step is a logical unit of work that can perform I/O. It is translated to a Temporal Activity.
The step logic is defined in the
fnhandler function.The schema of the input that the function receives as the first argument is defined by the
inputSchemaoption.The output of the
fnhandler must match the schema defined byoutputSchema; otherwise, a validation error is raised.