Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fa6a5a3
KG-232: Add step-01-basic-agent example project setup
denis-domanskii Sep 12, 2025
e0b27da
KG-232: step-01-basic-agent example implemented + other examples move…
denis-domanskii Sep 15, 2025
5056ec3
KG-232: Update `step-01-basic-agent` with event handling and logging …
denis-domanskii Sep 15, 2025
886274d
KG-232: Update `main` to accept task as CLI argument with validation
denis-domanskii Sep 15, 2025
0a975d3
Revert "KG-232: step-01-basic-agent example implemented + other examp…
denis-domanskii Sep 16, 2025
4564fdb
KG-232: Include `step-01-basic-agent` in Gradle settings and build sc…
denis-domanskii Sep 16, 2025
c25f0e9
KG-232: Update `step-01-basic-agent` with `.gitignore` cleanup and ma…
denis-domanskii Sep 16, 2025
9607b3e
Merge remote-tracking branch 'origin/develop' into codeagent/step-01-…
denis-domanskii Sep 16, 2025
f132c89
KG-232: Simplify dependencies and update module files for `step-01-ba…
denis-domanskii Sep 16, 2025
c2baf17
KG-232: Update `step-01-basic-agent` prompt and integrate Shadow plug…
denis-domanskii Sep 17, 2025
a223ce4
KG-232: Update `main` to require project path and task as CLI arguments
denis-domanskii Sep 17, 2025
76ae4fb
KG-232: Update `main` to require project path and task as CLI arguments
denis-domanskii Sep 17, 2025
ce5e218
KG-232: Migrate from the deprecated shadowJar version to the relevant…
denis-domanskii Sep 17, 2025
306c36d
:alembic: GPT5
BLannoo Sep 22, 2025
3c10830
:alembic: remove temperature for GPT5
BLannoo Sep 22, 2025
265d8a5
Merge remote-tracking branch 'origin/develop' into codeagent/step-01-…
denis-domanskii Sep 23, 2025
961de52
KG-232: Add Gradle wrapper and configuration for `step-01-basic-agent…
denis-domanskii Sep 23, 2025
ea51f79
KG-232: Remove example projects from Gradle settings to streamline co…
denis-domanskii Sep 23, 2025
7067161
KG-232: Remove `:examples` module from `koog-agents` dependencies to …
denis-domanskii Sep 24, 2025
d7557a2
KG-232: Add custom tracing attributes in `step-01-basic-agent`
denis-domanskii Sep 24, 2025
91ba5aa
KG-427: Add support for trace-level attributes in Langfuse integration
denis-domanskii Sep 24, 2025
a71ece8
Clarify span type in Langfuse OpenTelemetry documentation
denis-domanskii Sep 25, 2025
9b02940
Merge branch 'domanskii/KG-427-Support-LangFuse-trace-level-attribute…
denis-domanskii Sep 25, 2025
62a291c
Merge remote-tracking branch 'origin/develop' into codeagent/step-01-…
denis-domanskii Sep 25, 2025
a8d0262
Merge remote-tracking branch 'origin/develop' into codeagent/step-01-…
denis-domanskii Sep 26, 2025
b6d908f
Refactor event handling in `step-01-basic-agent`: replace `onToolCall…
denis-domanskii Sep 26, 2025
7a2c5a0
Simplify logging in `step-01-basic-agent` by removing tool arguments …
denis-domanskii Sep 30, 2025
156b8f6
Merge remote-tracking branch 'origin/develop' into codeagent/step-01-…
denis-domanskii Oct 1, 2025
0c8e257
Remove unused OpenTelemetry imports and rename `onToolExecutionStarti…
denis-domanskii Oct 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/code-agent/step-01-basic-agent/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Module Code Agent (Step 1)

Code Agent example.
Empty file.
26 changes: 26 additions & 0 deletions examples/code-agent/step-01-basic-agent/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("ai.kotlin.jvm")
alias(libs.plugins.shadow)
application
}

application.mainClass.set("ai.koog.agents.examples.codeagent.step01.MainKt")

dependencies {
implementation(project(":agents:agents-core"))
implementation(project(":agents:agents-ext"))
implementation(project(":prompt:prompt-executor:prompt-executor-llms-all"))

implementation(libs.kotlinx.coroutines.core)

implementation(libs.logback.classic)
}

tasks.test {
useJUnitPlatform()
}

tasks.shadowJar {
archiveBaseName.set("code-agent")
mergeServiceFiles()
}
51 changes: 51 additions & 0 deletions examples/code-agent/step-01-basic-agent/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package ai.koog.agents.examples.codeagent.step01

import ai.koog.agents.core.agent.AIAgent
import ai.koog.agents.core.agent.singleRunStrategy
import ai.koog.agents.core.tools.ToolRegistry
import ai.koog.agents.ext.tool.file.EditFileTool
import ai.koog.agents.ext.tool.file.ListDirectoryTool
import ai.koog.agents.ext.tool.file.ReadFileTool
import ai.koog.agents.ext.tool.file.WriteFileTool
import ai.koog.agents.features.eventHandler.feature.handleEvents
import ai.koog.prompt.executor.clients.openai.OpenAIModels
import ai.koog.prompt.executor.llms.all.simpleOpenAIExecutor
import ai.koog.rag.base.files.JVMFileSystemProvider
import kotlinx.coroutines.runBlocking

val agent = AIAgent(
promptExecutor = simpleOpenAIExecutor(System.getenv("OPENAI_API_KEY")),
strategy = singleRunStrategy(),
systemPrompt = """
You are a highly skilled programmer tasked with updating the provided codebase according to the given task.
Your goal is to deliver production-ready code changes that integrate seamlessly with the existing codebase and solve given task.
""".trimIndent(),
llmModel = OpenAIModels.Chat.GPT4_1,
temperature = 0.0,
toolRegistry = ToolRegistry {
tool(ListDirectoryTool(JVMFileSystemProvider.ReadOnly))
tool(ReadFileTool(JVMFileSystemProvider.ReadOnly))
tool(WriteFileTool(JVMFileSystemProvider.ReadWrite))
tool(EditFileTool(JVMFileSystemProvider.ReadWrite))
},
maxIterations = 100
) {
handleEvents {
onToolCall { ctx ->
println("Tool called: ${ctx.tool.name}, args=${ctx.toolArgs}")
}
}
}

fun main(args: Array<String>) = runBlocking {
if (args.size < 2) {
println("Error: Please provide the project absolute path and a task as arguments")
println("Usage: <absolute_path> <task>")
return@runBlocking
}

val (path, task) = args
val input = "Project path: $path\n\n$task"
val result = agent.run(input)
println(result)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<root level="ERROR">
<appender-ref ref="STDOUT" />
</root>
</configuration>
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mockito="5.19.0"
mockk = "1.13.8"
opentelemetry = "1.51.0"
oshai-logging = "7.0.7"
shadow = "8.1.1"
shadow = "9.1.0"
slf4j = "2.0.17"
testcontainers = "1.19.7"
exposed = "0.58.0"
Expand Down Expand Up @@ -120,5 +120,5 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
spring-management = { id = "io.spring.dependency-management", version.ref = "spring-management" }
1 change: 1 addition & 0 deletions koog-agents/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ val excluded = setOf(
":agents:agents-features:agents-features-sql", // Optional SQL persistence provider
":agents:agents-mcp-server",
":examples",
":examples:code-agent:step-01-basic-agent",
":integration-tests",
":test-utils",
":koog-spring-boot-starter",
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include(":agents:agents-tools")
include(":agents:agents-utils")

include(":examples")
include(":examples:code-agent:step-01-basic-agent")

include(":integration-tests")

Expand Down
Loading