Skip to content
Merged
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
18 changes: 17 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ updates:
- '/agents/agent-voltagent/'
- '/agents/agent-sdk/'
- '/agents/agent-strands/'
- './agents/agents-langchain/'
- '/agents/agents-langchain/'
- '/basic/cdk/'
- '/basic/app/'
- '/mcp/clients/mastra-mcp-client/'
Expand Down Expand Up @@ -55,3 +55,19 @@ updates:
npm:
patterns:
- '*'

- package-ecosystem: gradle
directories:
- '/agents/agent-koog/'
schedule:
interval: daily
timezone: Asia/Tokyo
allow:
- dependency-type: all
rebase-strategy: auto
assignees:
- poad
groups:
gradle:
patterns:
- '*'
Comment thread
poad marked this conversation as resolved.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,29 @@ jobs:
- name: lint
run: pnpm lint

build-android:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
java-version: 17
distribution: zulu

- uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build with Gradle
working-directory: agents/agent-koog
run: |
chmod +x gradlew
./gradlew assembleDebug -x lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ dist
.env
!.env.local.template
**/tsconfig.tsbuildinfo

.DS_Store
19 changes: 19 additions & 0 deletions agents/agent-koog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.iml
.kotlin
.gradle
**/build/
xcuserdata
!src/**/build/
local.properties
.idea
.DS_Store
captures
.externalNativeBuild
.cxx
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
node_modules/
50 changes: 50 additions & 0 deletions agents/agent-koog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# agent-koog

This is a Kotlin Multiplatform project targeting Android.

- [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications.
It contains several subfolders:

- [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets.
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls.
Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin)
folder is the appropriate location.

## Build and Run Android Application

To build and run the development version of the Android app, use the run configuration from the run widget
in your IDE’s toolbar or build it directly from the terminal:

- on macOS/Linux

```shell
./gradlew :composeApp:assembleDebug
```

- on Windows

```shell
.\gradlew.bat :composeApp:assembleDebug
```

---

Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)…

## Observability

`$download_url` は <https://www.jaegertracing.io/download/> からダウンロードURLを調べて取得したURLに置き換えてください。

```shell
# Jaegerを起動
curl -sSL "$download_url" -o jaeger-2.13.0.tar.gz
tar -xzf jaeger-2.13.0.tar.gz
cd jaeger-2.13.0
COLLECTOR_OTLP_ENABLED=true ./jaeger \
--set=receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317 \
--set=receivers.otlp.protocols.http.endpoint=0.0.0.0:4318
```

Access to <http://localhost:16686/search>
9 changes: 9 additions & 0 deletions agents/agent-koog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
}
117 changes: 117 additions & 0 deletions agents/agent-koog/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)

// Add Kotlin serialization plugin for Koog API support
kotlin("plugin.serialization") version "2.2.0"
}

kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

sourceSets {
androidMain.dependencies {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(libs.androidx.material.icons.core)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.androidx.lifecycle.viewmodelCompose)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.opentelemetry.logback.appender.x.x)
implementation(libs.slf4j.api)
implementation(libs.logback.android)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
}
}
}

android {
namespace = "com.example.koog_example"
compileSdk = libs.versions.android.compileSdk.get().toInt()

defaultConfig {
applicationId = "com.example.koog_example"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"

// 環境変数から読み込んでBuildConfigに埋め込む
buildConfigField("String", "AWS_ACCESS_KEY_ID", "\"${System.getenv("AWS_ACCESS_KEY_ID") ?: ""}\"")
buildConfigField("String", "AWS_SECRET_ACCESS_KEY", "\"${System.getenv("AWS_SECRET_ACCESS_KEY") ?: ""}\"")
buildConfigField("String", "AWS_SESSION_TOKEN", "\"${System.getenv("AWS_SESSION_TOKEN") ?: ""}\"")
buildConfigField("String", "AWS_REGION", "\"${System.getenv("AWS_REGION") ?: "us-west-2"}\"")

buildConfigField("String", "OTLP_BACKEND", "\"${System.getenv("OTLP_BACKEND") ?: ""}\"")
buildConfigField("String", "OTLP_ENDPOINT", "\"${System.getenv("OTLP_ENDPOINT") ?: "http://10.0.2.2:4318/v1/traces"}\"")
buildConfigField("String", "OTLP_HEADERS", "\"${System.getenv("LANGFUSE_API_KEY") ?: ""}\"")
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
dex {
useLegacyPackaging = false
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
// 検証コードなのでproguard設定はしない
}
getByName("debug") {
applicationIdSuffix = ".debug"
isDebuggable = true
}
Comment thread
poad marked this conversation as resolved.
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
buildConfig = true
}
}

dependencies {
debugImplementation(compose.uiTooling)
implementation(libs.koog.agents)
implementation(libs.opentelemetry.exporter.otlp)
implementation(libs.opentelemetry.exporter.logging)
}

repositories {
google()
// Use Maven Central for resolving dependencies.
mavenCentral()
// Add JetBrains repository for Koog framework
maven {
url = uri("https://packages.jetbrains.team/maven/p/grazi/grazie-platform-public")
}
}

configurations.all {
// FIXME exclude netty from Koog dependencies?
exclude(group = "io.netty", module = "*")
exclude(group = "org.apache.httpcomponents.httpclient5", module = "*")
exclude(group = "org.apache.httpcomponents.core5", module = "*")
}
25 changes: 25 additions & 0 deletions agents/agent-koog/composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:exported="true"
android:name=".ChatActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="450dp"
android:height="450dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M56.25,18V46L32,60 7.75,46V18L32,4Z"
android:fillColor="#6075f2"/>
<path
android:pathData="m41.5,26.5v11L32,43V60L56.25,46V18Z"
android:fillColor="#6b57ff"/>
<path
android:pathData="m32,43 l-9.5,-5.5v-11L7.75,18V46L32,60Z">
<aapt:attr name="android:fillColor">
<gradient
android:centerX="23.131"
android:centerY="18.441"
android:gradientRadius="42.132"
android:type="radial">
<item android:offset="0" android:color="#FF5383EC"/>
<item android:offset="0.867" android:color="#FF7F52FF"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M22.5,26.5 L32,21 41.5,26.5 56.25,18 32,4 7.75,18Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="44.172"
android:startY="4.377"
android:endX="17.973"
android:endY="34.035"
android:type="linear">
<item android:offset="0" android:color="#FF33C3FF"/>
<item android:offset="0.878" android:color="#FF5383EC"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="m32,21 l9.526,5.5v11L32,43 22.474,37.5v-11z"
android:fillColor="#000000"/>
</vector>
Loading