@@ -44,7 +44,6 @@ import ai.koog.prompt.message.Message
44
44
import ai.koog.prompt.message.ResponseMetaInfo
45
45
import ai.koog.prompt.params.LLMParams
46
46
import ai.koog.prompt.params.LLMParams.ToolChoice
47
- import kotlinx.coroutines.runBlocking
48
47
import kotlinx.coroutines.test.runTest
49
48
import kotlinx.serialization.Serializable
50
49
import org.junit.jupiter.api.Assumptions.assumeTrue
@@ -315,16 +314,16 @@ class AIAgentIntegrationTest {
315
314
}
316
315
317
316
@BeforeTest
318
- fun setupTest () = runBlocking {
317
+ fun setupTest () = runTest {
319
318
cleanUp()
320
319
}
321
320
322
321
@AfterTest
323
- fun teardownTest () = runBlocking {
322
+ fun teardownTest () = runTest {
324
323
cleanUp()
325
324
}
326
325
327
- private fun runMultipleToolsTest (model : LLModel , runMode : ToolCalls ) = runBlocking {
326
+ private fun runMultipleToolsTest (model : LLModel , runMode : ToolCalls ) = runTest(timeout = 300 .seconds) {
328
327
Models .assumeAvailable(model.provider)
329
328
assumeTrue(model.capabilities.contains(LLMCapability .Tools ), " Model $model does not support tools" )
330
329
@@ -337,8 +336,9 @@ class AIAgentIntegrationTest {
337
336
getSingleRunAgentWithRunMode(model, runMode, eventHandlerConfig = eventHandlerConfig)
338
337
multiToolAgent.run (twoToolsPrompt)
339
338
340
- assertTrue(
341
- parallelToolCalls.size == 2 ,
339
+ assertEquals(
340
+ 2 ,
341
+ parallelToolCalls.size,
342
342
" There should be exactly 2 tool calls in a Multiple tool calls scenario"
343
343
)
344
344
assertTrue(
@@ -359,14 +359,14 @@ class AIAgentIntegrationTest {
359
359
)
360
360
}
361
361
362
- assertTrue(firstCall.tool == CalculatorTool .name, " First tool call should be ${CalculatorTool .name} " )
363
- assertTrue(secondCall.tool == DelayTool .name, " Second tool call should be ${DelayTool .name} " )
362
+ assertEquals( CalculatorTool .name, firstCall.tool , " First tool call should be ${CalculatorTool .name} " )
363
+ assertEquals( DelayTool .name, secondCall.tool , " Second tool call should be ${DelayTool .name} " )
364
364
}
365
365
}
366
366
367
367
@ParameterizedTest
368
368
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
369
- fun integration_AIAgentShouldNotCallToolsByDefault (model : LLModel ) = runBlocking {
369
+ fun integration_AIAgentShouldNotCallToolsByDefault (model : LLModel ) = runTest {
370
370
Models .assumeAvailable(model.provider)
371
371
withRetry {
372
372
val executor = getExecutor(model)
@@ -387,7 +387,7 @@ class AIAgentIntegrationTest {
387
387
388
388
@ParameterizedTest
389
389
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
390
- fun integration_AIAgentShouldCallCustomTool (model : LLModel ) = runBlocking {
390
+ fun integration_AIAgentShouldCallCustomTool (model : LLModel ) = runTest {
391
391
Models .assumeAvailable(model.provider)
392
392
val systemPromptForSmallLLM = systemPrompt + " You MUST use tools."
393
393
assumeTrue(model.capabilities.contains(LLMCapability .Tools ), " Model $model does not support tools" )
@@ -426,7 +426,7 @@ class AIAgentIntegrationTest {
426
426
427
427
@ParameterizedTest
428
428
@MethodSource(" modelsWithVisionCapability" )
429
- fun integration_AIAgentWithImageCapabilityTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
429
+ fun integration_AIAgentWithImageCapabilityTest (model : LLModel ) = runTest(timeout = 300 .seconds) {
430
430
Models .assumeAvailable(model.provider)
431
431
assumeTrue(model.capabilities.contains(LLMCapability .Vision .Image ), " Model must support vision capability" )
432
432
@@ -477,7 +477,7 @@ class AIAgentIntegrationTest {
477
477
478
478
@ParameterizedTest
479
479
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
480
- fun integration_testRequestLLMWithoutToolsTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
480
+ fun integration_testRequestLLMWithoutToolsTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
481
481
Models .assumeAvailable(model.provider)
482
482
assumeTrue(model.capabilities.contains(LLMCapability .Tools ), " Model $model does not support tools" )
483
483
@@ -632,8 +632,9 @@ class AIAgentIntegrationTest {
632
632
}
633
633
}
634
634
635
- assertTrue(
636
- reasoningCallsCount == expectedReasoningCalls,
635
+ assertEquals(
636
+ expectedReasoningCalls,
637
+ reasoningCallsCount,
637
638
" With reasoningInterval=$interval and ${toolExecutionCounter.size} tool calls, " +
638
639
" expected $expectedReasoningCalls reasoning calls but got $reasoningCallsCount "
639
640
)
@@ -642,7 +643,7 @@ class AIAgentIntegrationTest {
642
643
643
644
@ParameterizedTest
644
645
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
645
- fun integration_AgentCreateAndRestoreTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
646
+ fun integration_AgentCreateAndRestoreTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
646
647
val checkpointStorageProvider = InMemoryPersistencyStorageProvider (" integration_AgentCreateAndRestoreTest" )
647
648
val sayHello = " Hello World!"
648
649
val hello = " Hello"
@@ -730,7 +731,7 @@ class AIAgentIntegrationTest {
730
731
731
732
@ParameterizedTest
732
733
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
733
- fun integration_AgentCheckpointRollbackTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
734
+ fun integration_AgentCheckpointRollbackTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
734
735
val checkpointStorageProvider = InMemoryPersistencyStorageProvider (" integration_AgentCheckpointRollbackTest" )
735
736
736
737
val hello = " Hello"
@@ -845,7 +846,7 @@ class AIAgentIntegrationTest {
845
846
846
847
@ParameterizedTest
847
848
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
848
- fun integration_AgentCheckpointContinuousPersistenceTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
849
+ fun integration_AgentCheckpointContinuousPersistenceTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
849
850
val checkpointStorageProvider =
850
851
InMemoryPersistencyStorageProvider (" integration_AgentCheckpointContinuousPersistenceTest" )
851
852
@@ -922,7 +923,7 @@ class AIAgentIntegrationTest {
922
923
923
924
@ParameterizedTest
924
925
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
925
- fun integration_AgentCheckpointStorageProvidersTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
926
+ fun integration_AgentCheckpointStorageProvidersTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
926
927
val strategyName = " storage-providers-strategy"
927
928
928
929
val hello = " Hello"
@@ -991,7 +992,7 @@ class AIAgentIntegrationTest {
991
992
992
993
@ParameterizedTest
993
994
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
994
- fun integration_AgentWithToolsWithoutParamsTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
995
+ fun integration_AgentWithToolsWithoutParamsTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
995
996
assumeTrue(model.capabilities.contains(LLMCapability .Tools ), " Model $model does not support tools" )
996
997
val flakyModels = listOf (
997
998
GoogleModels .Gemini2_0Flash .id,
@@ -1045,7 +1046,7 @@ class AIAgentIntegrationTest {
1045
1046
1046
1047
@ParameterizedTest
1047
1048
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
1048
- fun integration_ParallelNodesExecutionTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
1049
+ fun integration_ParallelNodesExecutionTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
1049
1050
Models .assumeAvailable(model.provider)
1050
1051
1051
1052
val parallelStrategy = strategy<String , String >(" parallel-nodes-strategy" ) {
@@ -1120,7 +1121,7 @@ class AIAgentIntegrationTest {
1120
1121
1121
1122
@ParameterizedTest
1122
1123
@MethodSource(" openAIModels" , " anthropicModels" , " googleModels" )
1123
- fun integration_ParallelNodesWithSelectionTest (model : LLModel ) = runTest(timeout = 120 .seconds) {
1124
+ fun integration_ParallelNodesWithSelectionTest (model : LLModel ) = runTest(timeout = 180 .seconds) {
1124
1125
Models .assumeAvailable(model.provider)
1125
1126
1126
1127
val selectionStrategy = strategy<String , String >(" parallel-selection-strategy" ) {
0 commit comments