Skip to content

Conversation

@EugeneTheDev
Copy link
Contributor

Add Koog Framework Examples to Samples

This PR introduces comprehensive examples demonstrating A2A protocol implementation using Koog, JetBrains' open-source agentic framework for building enterprise-ready AI agents, targeting JVM backend, Android, iOS, JS, and WasmJS.

What's Added

Two progressive examples showing different A2A communication patterns:

1. Simple Joke Agent (simplejoke)

  • Basic message-based A2A communication
  • Direct request-response pattern using sendMessage()
  • Demonstrates minimal A2A server setup with AgentCard and message storage

2. Advanced Joke Agent (advancedjoke)

  • Full task-based A2A workflow implementation
  • Graph-based agent architecture using Koog's GraphAIAgent
  • Complete task lifecycle: Submitted → Working → InputRequired → Completed
  • Interactive clarifications via InputRequired state
  • Streaming task events and artifact delivery
  • Structured LLM outputs with type-safe parsing

Key Features Demonstrated

  • A2A Protocol Integration: Both simple message-based and advanced task-based workflows
  • Graph-based Agent Design: Maintainable, visual agent logic using nodes and edges
  • Koog's Prompt DSL: Type-safe prompt building with automatic context management

Why Koog?

Adds diversity to A2A samples by showcasing:

  • JVM/Kotlin ecosystem representation
  • Type-safe agent development with compile-time guarantees
  • Multi-platform deployment options beyond Node.js/Python

Each example includes detailed inline documentation and runnable Gradle tasks for immediate testing.

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @EugeneTheDev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the A2A samples by integrating comprehensive examples built with JetBrains' Koog framework. It provides two distinct demonstrations: a straightforward message-based agent and a more complex task-oriented agent. These examples serve to showcase Koog's robust capabilities for developing enterprise-grade AI agents using Kotlin, covering various A2A communication patterns and highlighting the framework's multi-platform support and type-safety.

Highlights

  • New Koog Framework Examples: Introduces two new examples, a "Simple Joke Agent" and an "Advanced Joke Agent," demonstrating A2A protocol implementation using JetBrains' Koog framework.
  • Simple Joke Agent: Showcases basic message-based A2A communication with a direct request-response pattern and minimal server setup.
  • Advanced Joke Agent: Illustrates a sophisticated task-based A2A workflow, featuring Koog's graph-based agent architecture, full task lifecycle management (Submitted → Working → InputRequired → Completed), interactive clarifications, streaming task events, and structured LLM outputs.
  • Koog Features Demonstrated: Highlights key Koog capabilities such as A2A Protocol Integration, Graph-based Agent Design for maintainable logic, and a type-safe Prompt DSL for LLM interactions.
  • Kotlin/JVM Ecosystem Integration: Adds diversity to A2A samples by representing the JVM/Kotlin ecosystem, emphasizing type-safe agent development with compile-time guarantees and multi-platform deployment options.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds excellent examples for the Koog framework, showcasing both simple and advanced A2A communication. The code is well-structured and provides a great starting point for new users. My review includes a few suggestions to improve the examples, mainly correcting the run commands in the README to ensure they work out-of-the-box, enhancing the robustness of the client code, and fixing a minor logic issue. Overall, this is a valuable addition to the samples repository.

@zeroasterisk
Copy link
Collaborator

Generally LGTM

@ryanaiagent ryanaiagent self-assigned this Oct 3, 2025
@ryanaiagent
Copy link

Hi @EugeneTheDev , thanks for the PR! The Super-Linter check failed due to some linting errors. Could you please check the CI logs and fix them?

@EugeneTheDev
Copy link
Contributor Author

@ryanaiagent I see a lot of unrelated failures in other parts of the project that I didn't modify in this PR. What should I do about them?

@EugeneTheDev
Copy link
Contributor Author

I updated Koog project to use ktlint Gradle plugin and formatted it. I also added .editorconfig to the root to help with formatting and linter configurations (only for Kotlin files), please let me know if you are okay with it. Also, I updated CI checks to ignore gradlew and gradlew.bat files from linter checks (these are Gradle Wrapper scripts that shouldn't be checked by linters). I ran Super-linter locally for koog subdirectory, and there are no linter violations now. However, as I mentioned previosly, it seems to fail with some other violations in other parts of the proejct which I didn't modify in this PR, so I don't know what I should do with it.

@zeroasterisk
Copy link
Collaborator

@holtskinner would you be so kind as to either fix the linter, or bypass it?
We have had a few internal conversations about this.

@zeroasterisk
Copy link
Collaborator

/gemini can you recommend a solution to the linter errors? They seem to be unrelated to these changes.

@gemini-code-assist
Copy link
Contributor

That's a common challenge when introducing new modules or frameworks with their own linting configurations. It's good that you've already set up .editorconfig and ktlint for the koog subdirectory and ignored the gradlew scripts, @EugeneTheDev.

To address the unrelated linter failures in the CI, a robust solution would be to modify the .github/workflows/linter.yaml to run linting only on the files changed in the current pull request, or specifically target the samples/java/koog directory. This ensures that your changes are linted according to the new koog specific rules, without being blocked by pre-existing issues in other parts of the codebase.

Would you like me to provide a suggestion for how to modify the linter.yaml workflow to achieve this more targeted linting?

@zeroasterisk
Copy link
Collaborator

/gemini yes, can you add your recommended linter changes to this PR so we can pass checks. I'm ok with this being bundled into this PR.

@gemini-code-assist
Copy link
Contributor

Certainly! To address the unrelated linter failures and focus the linting on the samples/java/koog directory, you can modify your .github/workflows/linter.yaml file to include the LINTER_PATHS environment variable for the Super-Linter action. This will instruct Super-Linter to only check files within that specific path.

Here's a suggestion for how you might update the relevant step in your linter.yaml:

      - name: Run Super-Linter
        uses: github/super-linter@v4
        env:
          DEFAULT_BRANCH: main
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          LINTER_PATHS: samples/java/koog

You might need to adjust the uses version or other env variables to match your existing configuration, but adding LINTER_PATHS: samples/java/koog should achieve the desired targeted linting.

@zeroasterisk
Copy link
Collaborator

/gemini no that doesn't work, we want the linter to always work, for every path, but want to ignore linter errors or scope linter runs to only changed files. this is your second and last chance to recommend a solution.

@gemini-code-assist
Copy link
Contributor

Thank you for the clarification, @zeroasterisk. I understand that the goal is to ensure the linter runs across the entire codebase but only reports issues on files modified within the current pull request, or to ignore pre-existing issues in unchanged files.

The previous suggestion using LINTER_PATHS would restrict the linter to only the specified directory, which isn't what you're looking for if you want a full codebase scan with targeted reporting.

For Super-Linter, the most effective way to achieve your requirement of linting all files but only showing errors for changed files is to set the VALIDATE_ALL_CODE environment variable to false. This instructs Super-Linter to only report issues on files that have been modified in the current pull request, while still processing the entire repository to understand context (though it won't fail the build for pre-existing issues).

Here's how you can modify your .github/workflows/linter.yaml to implement this:

      - name: Run Super-Linter
        uses: github/super-linter@v4
        env:
          DEFAULT_BRANCH: main
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          VALIDATE_ALL_CODE: false

This configuration will allow the linter to run on the entire codebase but will only highlight and fail the PR for issues found in the files changed by this pull request. This should help in integrating new code without being blocked by legacy linting issues.

@zeroasterisk
Copy link
Collaborator

Embarrassing... the flag is VALIDATE_ALL_CODEBASE and it's already VALIDATE_ALL_CODEBASE=false

@EugeneTheDev EugeneTheDev force-pushed the eugenethedev/koog-samples branch from 6c186bb to ed8c9f2 Compare October 10, 2025 15:45
@EugeneTheDev EugeneTheDev removed their assignment Oct 10, 2025
@EugeneTheDev
Copy link
Contributor Author

Since all the checks are passing now, and I see no additional comments, are we good to merge?

@zeroasterisk zeroasterisk self-requested a review October 17, 2025 02:13
@zeroasterisk zeroasterisk self-assigned this Oct 17, 2025
@EugeneTheDev
Copy link
Contributor Author

Thanks for approving, can you merge it? I don't have permissions to merge it myself

@holtskinner holtskinner merged commit eb3885f into a2aproject:main Oct 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants