ParallelToolRunner
class ParallelToolRunner(tracer: Tracer = NullTracer, caller: String? = null, maxConcurrency: Int = 4) : ToolRunner
Parallel tool runner — fans out tool calls onto child coroutines and waits for all of them. Opt-in alternative to SerialToolRunner.
Per-call wall-clock duration still lands on each ToolOutcome; the runner additionally emits a single com.mojentic.tracer.ToolBatchEvent via tracer summarising the batch (size, success / failure counts, aggregate latency) so observers can quantify parallelism gains.
At most maxConcurrency calls execute at once; outcomes keep request order. A call naming an unknown tool yields an error outcome in its slot.
Cancellation propagates cooperatively: cancelling the calling coroutine cancels every in-flight child via coroutineScope.
Throws
if maxConcurrency is not positive.