|
1 | 1 | # agent-koog |
2 | 2 |
|
3 | | -This is a Kotlin Multiplatform project targeting Android. |
| 3 | +これは Android をターゲットとした Kotlin Multiplatform プロジェクトです。 |
| 4 | +Kotlin Multiplatform による Amazon Bedrock を使った Koog によるチャットボットエージェントライブラリと、そのフロントエンドとなる Android アプリです。 |
4 | 5 |
|
5 | | -- [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications. |
6 | | - It contains several subfolders: |
| 6 | +- [/app](./app/src)は、フロントエンドとなる Android アプリです。 |
| 7 | +- [/share](./share/src) は Compose Multiplatformアプリケーション間で共有されるコード用です。 |
7 | 8 |
|
8 | | - - [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets. |
9 | | - - Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. |
10 | | - For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, |
11 | | - the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls. |
12 | | - Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin) |
13 | | - folder is the appropriate location. |
| 9 | +## 環境変数 |
14 | 10 |
|
15 | | -## Build and Run Android Application |
| 11 | +サンプルアプリのため、AWSの一時的なクレデンシャルや OpenTelemetry Observer の設定はビルド時に環境変数から解決しています。 |
| 12 | +Android Studio を使用する場合は、Android Studio の起動時に設定されている必要があります。 |
16 | 13 |
|
17 | | -To build and run the development version of the Android app, use the run configuration from the run widget |
18 | | -in your IDE’s toolbar or build it directly from the terminal: |
| 14 | +| 環境変数名 | 必須か? | 設定する値の説明 | デフォルト値 | |
| 15 | +| -------- | ---- | -------------- | ---------- | |
| 16 | +| AWS_ACCESS_KEY_ID | 必須 | AWS のアクセスキーID (AWS IAM Identity Center の一時的なクレデンシャルの値で可) | (なし) | |
| 17 | +| AWS_SECRET_ACCESS_KEY | 必須 | AWS のシークレットキー (AWS IAM Identity Center の一時的なクレデンシャルの値で可) | (なし) | |
| 18 | +| AWS_SESSION_TOKEN | 条件次第 | AWS のセッショントークン (AWS IAM Identity Center の一時的なクレデンシャルの場合は必須) | (なし) | |
| 19 | +| AWS_REGION | 任意 | AWS のリージョン | us-west-2 | |
| 20 | +| OTLP_BACKEND | 条件次第 | 使用する Observer を指定。指定されない場合や不正値の場合は OpenTelemetry のトレーシングを送信しません。指定可能なObserver は現状、 jaeger または langfuse。※ langfuse は動作未確認 | (なし) | |
| 21 | +| OTLP_ENDPOINT | 任意 | OpenTelemetry Observer のエンドポイント URL。OTLP_BACKEND に jaeger または langfuse が指定されている場合にのみ使われます。 | <http://10.0.2.2:4318/v1/traces> | |
| 22 | +| OTLP_HEADERS | 任意 | Observer にテレメトリーを送信する際に付与する HTTP リクエストヘッダーを `ヘッダー名:値` 形式で指定できます。複数指定する場合は `,` 区切りとする想定ですが、現状は 1 つのみの指定しか対応していません。 | (なし) | |
19 | 23 |
|
20 | | -- on macOS/Linux |
| 24 | +### macOS で環境変数を設定して Android Studio を起動する方法 |
| 25 | + |
| 26 | +```shell |
| 27 | +# (環境変数を export で設定) |
| 28 | +export AWS_ACCESS_KEY_ID=XXXX |
| 29 | +# (環境変数の設定の記述を割愛) |
| 30 | + |
| 31 | +# Android Studio を起動 |
| 32 | +open -a "Android Studio" |
| 33 | +``` |
| 34 | + |
| 35 | +## Androidアプリケーションのビルドと実行 |
| 36 | + |
| 37 | +Androidアプリの開発バージョンをビルドして実行するには、IDEのツールバーにある実行ウィジェットから実行構成を使用するか、ターミナルから直接ビルドしてください: |
| 38 | + |
| 39 | +- macOS/Linuxの場合 |
21 | 40 |
|
22 | 41 | ```shell |
23 | 42 | ./gradlew :composeApp:assembleDebug |
24 | 43 | ``` |
25 | 44 |
|
26 | | -- on Windows |
| 45 | +- Windowsの場合 |
27 | 46 |
|
28 | 47 | ```shell |
29 | 48 | .\gradlew.bat :composeApp:assembleDebug |
30 | 49 | ``` |
31 | 50 |
|
32 | 51 | --- |
| 52 | +[Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)について詳しく学ぶ… |
| 53 | + |
| 54 | +## 可観測性(Observability) |
33 | 55 |
|
34 | | -Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)… |
| 56 | +Langfuse などの SaaS を使用する前に、ローカルで Jaeger を使用して確認して、OpenTelemetry のトレースがきちんと登録できることを確認した上で SaaS を使うことで、アプリ側の計装や Android のネットワーク設定の問題か SaaS との連携固有の問題なのかを切り分けできます。 |
35 | 57 |
|
36 | | -## Observability |
| 58 | +### Jaeger の起動方法 |
37 | 59 |
|
38 | 60 | `$download_url` は <https://www.jaegertracing.io/download/> からダウンロードURLを調べて取得したURLに置き換えてください。 |
39 | 61 |
|
40 | 62 | ```shell |
41 | | -# Jaegerを起動 |
42 | | -curl -sSL "$download_url" -o jaeger-2.13.0.tar.gz |
43 | | -tar -xzf jaeger-2.13.0.tar.gz |
44 | | -cd jaeger-2.13.0 |
| 63 | +# Jaeger を起動 |
| 64 | +curl -sSL "$download_url" -o jaeger.tar.gz |
| 65 | +tar -xzf jaeger.tar.gz |
| 66 | +cd jaeger |
45 | 67 | COLLECTOR_OTLP_ENABLED=true ./jaeger \ |
46 | 68 | --set=receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317 \ |
47 | 69 | --set=receivers.otlp.protocols.http.endpoint=0.0.0.0:4318 |
48 | 70 | ``` |
49 | 71 |
|
50 | | -Access to <http://localhost:16686/search> |
| 72 | +<http://localhost:16686/search> にアクセスしてください |
0 commit comments