submitToMainDispatcher

suspend fun <T> AIAgentConfig.submitToMainDispatcher(block: () -> T): T(source)

Submits a block of code to the main dispatcher for execution.

This method ensures that the given block is executed asynchronously using either AIAgentConfig.strategyExecutorService if configured or Dispatchers.Default otherwise.

Return

The result of the executed block.

Parameters

T

The return type of the block to be executed.

block

A lambda function that contains the code to be executed asynchronously.