runOnStrategyDispatcher

fun <T> AIAgentConfig.runOnStrategyDispatcher(executorService: ExecutorService? = null, block: suspend () -> T): T(source)

Executes a given suspending block of code within a coroutine context on a strategy dispatcher that is determined by the provided executorService . If no executorService is supplied, it defaults to the AIAgentConfig.strategyExecutorService or falls back to Dispatchers.Default if none is configured.

Return

The result returned by the suspending block after execution.

Parameters

executorService

The optional ExecutorService that determines the coroutine context. If null, the strategyExecutorService or Dispatchers.Default will be used as the fallback.

block

The suspending lambda to be executed in the resolved context.

Type Parameters

T

The return type of the suspending block.