Skip to content

Documentation / @agentick/kernel / 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 ​

typescript
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World');  // ExecutionHandle
const result = await handle;    // "Hello, World!"
typescript
const run = createProcedure(
  { name: 'agentick:run', handleFactory: false },
  (element, input) => app.run(input)  // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts);  // SessionExecutionHandle directly

Call 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 ​

typescript
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World');  // ExecutionHandle
const result = await handle;    // "Hello, World!"
typescript
const run = createProcedure(
  { name: 'agentick:run', handleFactory: false },
  (element, input) => app.run(input)  // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts);  // SessionExecutionHandle directly

Call 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 ​

ProcedureOptions

handler ​

THandler

Returns ​

Procedure<THandler>

Examples ​

typescript
const greet = createProcedure(async (name: string) => `Hello, ${name}!`);
const handle = greet('World');  // ExecutionHandle
const result = await handle;    // "Hello, World!"
typescript
const run = createProcedure(
  { name: 'agentick:run', handleFactory: false },
  (element, input) => app.run(input)  // Returns SessionExecutionHandle
);
const handle = run(<jsx />, opts);  // SessionExecutionHandle directly

Released under the ISC License.