Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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-06-add-reasoning/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Module Code Agent (Step 4)

Code Agent example.
37 changes: 37 additions & 0 deletions examples/code-agent/step-06-add-reasoning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Code Agent Example — Step 04: Add Sub‑agent

Run a code‑editing agent that can also delegate smart "find in codebase" queries to a sub‑agent.

## Quick start
1) Build (from repo root):
```bash
./gradlew -p examples/code-agent/step-04-add-subagent shadowJar
```
The JAR: `examples/code-agent/step-04-add-subagent/build/libs/code-agent-all.jar`.

2) Run (macOS/Linux):
```bash
OPENAI_API_KEY=sk-... \
LANGFUSE_PUBLIC_KEY=pk-... \
LANGFUSE_SECRET_KEY=sk-... \
LANGFUSE_HOST=https://langfuse.labs.jb.gg \
LANGFUSE_SESSION_ID=my-session \
java -jar examples/code-agent/step-04-add-subagent/build/libs/code-agent-all.jar \
"/absolute/path/to/project" \
"task description"
```
Windows (PowerShell): set the env vars with `$env:VAR = "..."` then run the same `java -jar ...` command.

## Arguments
- 1st: absolute path to the target project.
- 2nd: natural‑language task for the agent (quote if it has spaces).

## Environment
- Required to run: `OPENAI_API_KEY`.
- Observability (Langfuse): all four are required to enable it — `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, `LANGFUSE_HOST`, `LANGFUSE_SESSION_ID`. If any are missing or blank, Langfuse is disabled and the program prints which ones are missing.
- Optional: `BRAVE_MODE=true` to auto‑approve shell commands (use with care).

## Notes
- JDK 17+ required. Internet access needed.
- Entry point: `src/main/kotlin/Main.kt`.
- If the JAR isn’t found, make sure the build completed and the file exists at the path above.
22 changes: 22 additions & 0 deletions examples/code-agent/step-06-add-reasoning/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.shadow)
application
}

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

dependencies {
implementation("ai.koog:koog-agents")
implementation(libs.kotlinx.coroutines.core)
implementation(libs.logback.classic)
}

tasks.test {
useJUnitPlatform()
}

tasks.shadowJar {
archiveBaseName.set("code-agent")
mergeServiceFiles()
}
8 changes: 8 additions & 0 deletions examples/code-agent/step-06-add-reasoning/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx4096M

#Gradle
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[versions]
kotlin = "2.2.20"
kotlinx-coroutines = "1.10.2"
kotlinx-serialization = "1.8.1"
logback = "1.5.13"
shadow = "9.1.0"

[libraries]
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
251 changes: 251 additions & 0 deletions examples/code-agent/step-06-add-reasoning/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading