Skip to content

Commit 32a1e35

Browse files
authored
SP1.2: Add Koog dependency + AIAgent/AgentService skeleton - Fix ktlint formatting
1 parent b4187a9 commit 32a1e35

3 files changed

Lines changed: 39 additions & 37 deletions

File tree

dispatcher-agent/src/main/kotlin/cz/vutbr/fit/interlockSim/dispatcher/agents/DefaultAgentService.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ class DefaultAgentService : AgentService {
6868

6969
// SP1.2 skeleton: create agent with tools and configuration stored
7070
// SP1.6: Will construct Koog agent, register tools, wire model
71-
val agent = KoogDispatchAgentImpl(
72-
tools = tools,
73-
modelName = modelName,
74-
systemPrompt = systemPrompt
75-
)
71+
val agent =
72+
KoogDispatchAgentImpl(
73+
tools = tools,
74+
modelName = modelName,
75+
systemPrompt = systemPrompt
76+
)
7677

7778
logger.debug { "DefaultAgentService: created KoogDispatchAgentImpl" }
7879
return agent

dispatcher-agent/src/test/kotlin/cz/vutbr/fit/interlockSim/dispatcher/agents/DefaultAgentServiceTest.kt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ class DefaultAgentServiceTest {
2828
@Test
2929
fun `createDispatchAgent returns a valid agent instance`() {
3030
runBlocking {
31-
val agent = service.createDispatchAgent(
32-
modelName = "mistral",
33-
tools = emptyList(),
34-
systemPrompt = "You are a railway dispatcher"
35-
)
31+
val agent =
32+
service.createDispatchAgent(
33+
modelName = "mistral",
34+
tools = emptyList(),
35+
systemPrompt = "You are a railway dispatcher"
36+
)
3637

3738
assertThat(agent).isNotNull()
3839
}
@@ -41,11 +42,12 @@ class DefaultAgentServiceTest {
4142
@Test
4243
fun `createDispatchAgent works with empty tool list`() {
4344
runBlocking {
44-
val agent = service.createDispatchAgent(
45-
modelName = "mistral",
46-
tools = emptyList(),
47-
systemPrompt = null
48-
)
45+
val agent =
46+
service.createDispatchAgent(
47+
modelName = "mistral",
48+
tools = emptyList(),
49+
systemPrompt = null
50+
)
4951

5052
assertThat(agent).isNotNull()
5153
}
@@ -55,11 +57,12 @@ class DefaultAgentServiceTest {
5557
fun `createDispatchAgent works with tool list`() {
5658
runBlocking {
5759
val tool = MockDomainTool("test_tool", "A test tool")
58-
val agent = service.createDispatchAgent(
59-
modelName = "llama2",
60-
tools = listOf(tool),
61-
systemPrompt = "System prompt"
62-
)
60+
val agent =
61+
service.createDispatchAgent(
62+
modelName = "llama2",
63+
tools = listOf(tool),
64+
systemPrompt = "System prompt"
65+
)
6366

6467
assertThat(agent).isNotNull()
6568
}
@@ -72,8 +75,6 @@ class DefaultAgentServiceTest {
7275
override val name: String,
7376
override val description: String
7477
) : DomainTool {
75-
override suspend fun execute(args: Map<String, Any?>): Any? {
76-
return "mock result"
77-
}
78+
override suspend fun execute(args: Map<String, Any?>): Any? = "mock result"
7879
}
7980
}

dispatcher-agent/src/test/kotlin/cz/vutbr/fit/interlockSim/dispatcher/agents/KoogDispatchAgentImplTest.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ import org.junit.jupiter.api.Test
2727
*/
2828
class KoogDispatchAgentImplTest {
2929
private val mockTool = MockDomainTool("test_tool", "A test tool")
30-
private val agent = KoogDispatchAgentImpl(
31-
tools = listOf(mockTool),
32-
modelName = "mistral",
33-
systemPrompt = "You are a railway dispatcher"
34-
)
30+
private val agent =
31+
KoogDispatchAgentImpl(
32+
tools = listOf(mockTool),
33+
modelName = "mistral",
34+
systemPrompt = "You are a railway dispatcher"
35+
)
3536

3637
@Test
3738
fun agentInitializesWithToolsAndModelConfiguration() {
@@ -42,12 +43,13 @@ class KoogDispatchAgentImplTest {
4243
@Test
4344
fun decideAsyncReturnsEmptyListInSkeleton() {
4445
runBlocking {
45-
val observation = DispatchObservation(
46-
snapshot = SimulationSnapshot.EMPTY,
47-
unapprovedTrains = emptyList(),
48-
innerBlockInputs = emptyList(),
49-
outerBlockInputs = emptyList()
50-
)
46+
val observation =
47+
DispatchObservation(
48+
snapshot = SimulationSnapshot.EMPTY,
49+
unapprovedTrains = emptyList(),
50+
innerBlockInputs = emptyList(),
51+
outerBlockInputs = emptyList()
52+
)
5153

5254
val decisions = agent.decideAsync(observation)
5355

@@ -64,8 +66,6 @@ class KoogDispatchAgentImplTest {
6466
override val name: String,
6567
override val description: String
6668
) : DomainTool {
67-
override suspend fun execute(args: Map<String, Any?>): Any? {
68-
return "mock result"
69-
}
69+
override suspend fun execute(args: Map<String, Any?>): Any? = "mock result"
7070
}
7171
}

0 commit comments

Comments
 (0)