fork

declare function fork<T = any>(runFn: (clientId: string, agentName: AgentName) => Promise<T | void>, options: IScopeOptions): Promise<T>;

Executes a provided function within a managed scope, handling session creation, validation, and cleanup.

Parameter Description
runFn Function to execute within the managed scope, receiving clientId and agentName as arguments.
options Configuration options for the scope operation including clientId, swarmName, and optional callbacks.