-
Notifications
You must be signed in to change notification settings - Fork 163
example/kotlin #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
example/kotlin #156
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #Thu Feb 05 00:09:41 IST 2026 | ||
| gradle.version=8.11.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Shirtify T-Shirt Store Agent (Kotlin + LangChain4j + Dropwizard) | ||
|
|
||
| A Kotlin implementation of the Shirtify t-shirt store agent using LangChain4j | ||
| with Dropwizard and the A2A (Agent-to-Agent) protocol. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - JDK 17 or higher | ||
| - Gradle 8.x | ||
| - OpenAI API key | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. Set your OpenAI API key: | ||
| ```bash | ||
| export OPENAI_API_KEY="your-api-key" | ||
| ``` | ||
|
|
||
| 2. Build the project: | ||
| ```bash | ||
| ./gradlew shadowJar | ||
| ``` | ||
|
|
||
| 3. Run the agent: | ||
| ```bash | ||
| java -jar build/libs/shirtify-dropwizard.jar server src/main/resources/config.yml | ||
| ``` | ||
|
|
||
| Or using Gradle: | ||
| ```bash | ||
| ./gradlew run --args="server src/main/resources/config.yml" | ||
| ``` | ||
|
|
||
| 4. The agent will be available at: | ||
| - Agent Card: `http://localhost:10004/.well-known/agent.json` | ||
| - A2A Endpoint: `http://localhost:10004/` | ||
| - Admin/Health: `http://localhost:10005/healthcheck` | ||
|
|
||
| ## Testing with Rogue | ||
|
|
||
| Run a red team scan against this agent: | ||
|
|
||
| ```bash | ||
| rogue-ai red-team --agent-url http://localhost:10004 --protocol a2a | ||
| ``` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| - `ShirtifyApplication.kt` - Dropwizard Application entry point | ||
| - `ShirtifyConfiguration.kt` - YAML configuration mapping | ||
| - `ShirtifyAgentService.kt` - LangChain4j AI Service (manual wiring) | ||
| - `ShirtifyTools.kt` - Tool definitions (inventory, email) | ||
| - `A2AResource.kt` - Jersey JAX-RS A2A endpoints | ||
| - `AgentHealthCheck.kt` - Dropwizard health check | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| - Kotlin 1.9 | ||
| - Dropwizard 4.0 | ||
| - LangChain4j 1.11.0 | ||
| - Jersey (JAX-RS) | ||
| - Jetty |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| plugins { | ||
| kotlin("jvm") version "1.9.25" | ||
| application | ||
| id("com.github.johnrengelman.shadow") version "8.1.1" | ||
| } | ||
|
|
||
| group = "com.shirtify" | ||
| version = "1.0.0" | ||
|
|
||
| application { | ||
| mainClass.set("com.shirtify.agent.ShirtifyApplicationKt") | ||
| } | ||
|
|
||
| java { | ||
| toolchain { | ||
| languageVersion = JavaLanguageVersion.of(17) | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| val dropwizardVersion = "4.0.7" | ||
| val langchain4jVersion = "1.11.0" | ||
|
|
||
| dependencies { | ||
| // Dropwizard | ||
| implementation("io.dropwizard:dropwizard-core:$dropwizardVersion") | ||
|
|
||
| // LangChain4j (core, no Spring Boot starters) | ||
| implementation("dev.langchain4j:langchain4j:$langchain4jVersion") | ||
| implementation("dev.langchain4j:langchain4j-open-ai:$langchain4jVersion") | ||
| implementation("dev.langchain4j:langchain4j-kotlin:$langchain4jVersion") | ||
|
|
||
| // Kotlin | ||
| implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2") | ||
| implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
|
|
||
| // Test | ||
| testImplementation("io.dropwizard:dropwizard-testing:$dropwizardVersion") | ||
| testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") | ||
| } | ||
|
|
||
| kotlin { | ||
| compilerOptions { | ||
| freeCompilerArgs.addAll("-Xjsr305=strict") | ||
| javaParameters = true // Required for LangChain4j tool parameter names | ||
| } | ||
| } | ||
|
|
||
| tasks.withType<Test> { | ||
| useJUnitPlatform() | ||
| } | ||
|
|
||
| tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { | ||
| archiveBaseName.set("shirtify-dropwizard") | ||
| archiveClassifier.set("") | ||
| archiveVersion.set("") | ||
| mergeServiceFiles() | ||
| manifest { | ||
| attributes["Main-Class"] = "com.shirtify.agent.ShirtifyApplicationKt" | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+68
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: What security advisories in 2025 matter for Dropwizard 4.0.7?Dropwizard 4.0.7 itself (released Mar 6, 2024) doesn’t have a widely-cited “Dropwizard-core” CVE issued in 2025; the main 2025 risk comes from transitive dependencies you may be pulling in. Notable 2025 advisories that can impact typical Dropwizard apps
Dropwizard-specific advisory (not 2025, but often flagged)
“Latest version” context (so you can patch effectively)
Practical takeaway: for “2025 security advisories” affecting a 4.0.7-based app, you generally need to (1) check the resolved versions of Jersey/BouncyCastle/etc. in your dependency tree, and (2) upgrade Dropwizard (preferably) or override those dependencies to patched versions. Sources: [1] [2] [3] [4] [5] [6] 🌐 Web query:
💡 Result:
Sources: GitHub Releases (langchain4j/langchain4j) [1], INCIBE CVE-2025-21604 (LangChain4j-AIDeepin) [2], LangChain4j docs “Latest Release Notes” [3]. 🌐 Web query:
💡 Result:
Java 17 compatibility (with Kotlin 1.9.25 / KGP 1.9.25):
Sources: 🌐 Web query:
💡 Result:
Sources: Citations:
🌐 Web query:
💡 Result: JUnit Jupiter 5.10.2 is not the latest stable in 2025. The latest stable (GA) JUnit Jupiter version released in 2025 was 5.14.1, released October 31, 2025. [1] Maven/Gradle coordinate: Sources Citations:
Upgrade Dropwizard and dependencies immediately: 4.0.7 is end-of-life (Jan 31, 2026) and has unpatched transitive dependency vulnerabilities. Dropwizard 4.0.7 (Mar 6, 2024) is at or past EOL with no further support. Additionally, 2025 advisories affect libraries it typically pulls in: CVE-2025-12383 (Eclipse Jersey — SSL configuration bypass) and CVE-2025-8885 (Bouncy Castle — DoS). Upgrade to Dropwizard 5.0.1 (Jan 27, 2026) or at minimum 4.0.17, or manually override Jersey and Bouncy Castle to patched versions. Other outdated dependencies worth upgrading:
LangChain4j 1.11.0 is the current stable version (no issues). 🤖 Prompt for AI Agents |
||
| 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.11.1-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file from version control.
The
.gradle/directory contains build-time artifacts auto-generated by Gradle and should not be committed. These files are machine-specific, can cause merge conflicts, and will be regenerated on each build.Add
.gradle/to your.gitignorefile if not already present, then remove this file from the repository.🤖 Prompt for AI Agents