Skip to content

Commit 6c2559c

Browse files
committed
Remove featurePrepareDispatcher with limitedParallelism from AIAgentPipeline
1 parent 03e722f commit 6c2559c

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/feature/pipeline/AIAgentFunctionalPipeline.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import kotlinx.datetime.Clock
1111
* workflows or data processing tasks that do not require graph-based
1212
* data structures.
1313
*
14-
* @param clock The clock used for time-based operations within the pipeline
14+
* @property clock The clock used for time-based operations within the pipeline
1515
*/
1616
public class AIAgentFunctionalPipeline(clock: Clock = Clock.System) : AIAgentPipeline(clock) {
1717

agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/feature/pipeline/AIAgentPipeline.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ import ai.koog.prompt.llm.LLModel
5858
import ai.koog.prompt.message.Message
5959
import ai.koog.prompt.streaming.StreamFrame
6060
import io.github.oshai.kotlinlogging.KotlinLogging
61-
import kotlinx.coroutines.Dispatchers
62-
import kotlinx.coroutines.launch
63-
import kotlinx.coroutines.withContext
6461
import kotlinx.datetime.Clock
6562
import kotlin.reflect.KClass
6663
import kotlin.reflect.KType
@@ -81,7 +78,7 @@ import kotlin.reflect.safeCast
8178
* through a flexible interception system. Features can be installed with custom configurations
8279
* and can hook into different stages of the agent's execution lifecycle.
8380
*
84-
* @param clock Clock instance for time-related operations
81+
* @property clock Clock instance for time-related operations
8582
*/
8683
public abstract class AIAgentPipeline(public val clock: Clock) {
8784

@@ -106,8 +103,6 @@ public abstract class AIAgentPipeline(public val clock: Clock) {
106103
public val featureConfig: FeatureConfig
107104
)
108105

109-
private val featurePrepareDispatcher = Dispatchers.Default.limitedParallelism(5)
110-
111106
/**
112107
* Map of registered features and their configurations.
113108
* Keys are feature storage keys, values are feature configurations.
@@ -145,15 +140,11 @@ public abstract class AIAgentPipeline(public val clock: Clock) {
145140
protected val llmStreamingEventHandlers: MutableMap<AIAgentStorageKey<*>, LLMStreamingEventHandler> = mutableMapOf()
146141

147142
internal suspend fun prepareFeatures() {
148-
withContext(featurePrepareDispatcher) {
149-
registeredFeatures.values.map { it.featureConfig }.forEach { featureConfig ->
150-
featureConfig.messageProcessors.map { processor ->
151-
launch {
152-
logger.debug { "Start preparing processor: ${processor::class.simpleName}" }
153-
processor.initialize()
154-
logger.debug { "Finished preparing processor: ${processor::class.simpleName}" }
155-
}
156-
}
143+
registeredFeatures.values.map { it.featureConfig }.forEach { featureConfig ->
144+
featureConfig.messageProcessors.map { processor ->
145+
logger.debug { "Start preparing processor: ${processor::class.simpleName}" }
146+
processor.initialize()
147+
logger.debug { "Finished preparing processor: ${processor::class.simpleName}" }
157148
}
158149
}
159150
}

0 commit comments

Comments
 (0)