Documentation / @agentick/core / createProcedure
Function: createProcedure() ​
Call Signature ​
createProcedure<
THandler>(handler):Procedure<THandler>
Defined in: kernel/src/procedure.ts:1610
Create a Procedure from a function.
By default, calling the procedure returns an ExecutionHandle. Use handleFactory: false for pass-through mode where the handler's return value is returned directly (useful for delegating to other procedures).
Type Parameters ​
THandler ​
THandler extends (...args) => any
Parameters ​
handler ​
THandler
Returns ​
Procedure<THandler>
Examples ​
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World'); // ExecutionHandle
const result = await handle; // "Hello, World!"const run = createProcedure(
{ name: 'agentick:run', handleFactory: false },
(element, input) => app.run(input) // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts); // SessionExecutionHandle directlyCall Signature ​
createProcedure<
THandler>(options,handler):Procedure<THandler,true>
Defined in: kernel/src/procedure.ts:1614
Create a Procedure from a function.
By default, calling the procedure returns an ExecutionHandle. Use handleFactory: false for pass-through mode where the handler's return value is returned directly (useful for delegating to other procedures).
Type Parameters ​
THandler ​
THandler extends (...args) => any
Parameters ​
options ​
ProcedureOptions & object
handler ​
THandler
Returns ​
Procedure<THandler, true>
Examples ​
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World'); // ExecutionHandle
const result = await handle; // "Hello, World!"const run = createProcedure(
{ name: 'agentick:run', handleFactory: false },
(element, input) => app.run(input) // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts); // SessionExecutionHandle directlyCall Signature ​
createProcedure<
THandler>(options,handler):Procedure<THandler>
Defined in: kernel/src/procedure.ts:1619
Create a Procedure from a function.
By default, calling the procedure returns an ExecutionHandle. Use handleFactory: false for pass-through mode where the handler's return value is returned directly (useful for delegating to other procedures).
Type Parameters ​
THandler ​
THandler extends (...args) => any
Parameters ​
options ​
handler ​
THandler
Returns ​
Procedure<THandler>
Examples ​
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World'); // ExecutionHandle
const result = await handle; // "Hello, World!"const run = createProcedure(
{ name: 'agentick:run', handleFactory: false },
(element, input) => app.run(input) // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts); // SessionExecutionHandle directly