Skip to content

feat: genkit agents - #242

Merged
xavidop merged 3 commits into
mainfrom
xavier/agents
Jul 4, 2026
Merged

feat: genkit agents#242
xavidop merged 3 commits into
mainfrom
xavier/agents

Conversation

@xavidop

@xavidop xavidop commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Description

Support For Genkit Agents

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • CI/CD improvements

Changes Made

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Breaking Changes

New agents redefined

Documentation

  • README updated
  • Plugin documentation updated
  • API documentation updated
  • Sample code updated

xavidop and others added 3 commits July 1, 2026 08:38
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.6.0 to 13.7.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](checkstyle/checkstyle@checkstyle-13.6.0...checkstyle-13.7.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 13.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

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

Copy link
Copy Markdown

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 introduces the beta Agents API for Genkit Java, replacing the old agent and chat session implementations with a robust stateful, multi-turn agent framework. It adds the com.google.genkit.ai.agent package, supporting both server-managed and client-managed sessions, bidirectional streaming, detached execution, and session state persistence. Feedback on these changes highlights critical security vulnerabilities regarding path traversal in FileSessionStore where sessionId is resolved against the filesystem without validation. Additionally, a potential ClassCastException was identified in InProcessTransport due to raw class deserialization of parameterized state, a redundant filter was found in FileSessionStore's chain pruning, and a potential thread leak was noted due to an unclosed ScheduledExecutorService.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread ai/src/main/java/com/google/genkit/ai/agent/FileSessionStore.java
Comment thread ai/src/main/java/com/google/genkit/ai/agent/FileSessionStore.java
}

try {
return (AgentOutput<S>) JsonUtils.getObjectMapper().treeToValue(outNode, AgentOutput.class);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Because AgentOutput.class is a raw class, Jackson will deserialize the parameterized custom state field as a LinkedHashMap instead of the concrete POJO class S. This will cause a ClassCastException when the caller attempts to cast or use the state as S. To support custom POJO state types correctly, the Agent and transport should be aware of the concrete Class<S> stateType (which can be passed from CustomAgentConfig) and use Jackson's TypeFactory to construct the proper parametric type (e.g., mapper.getTypeFactory().constructParametricType(AgentOutput.class, stateType)).

Comment thread ai/src/main/java/com/google/genkit/ai/agent/FileSessionStore.java
Comment thread ai/src/main/java/com/google/genkit/ai/agent/FileSessionStore.java
@xavidop xavidop changed the title Xavier/agents feat: Genkit Agents Jul 4, 2026
@xavidop xavidop changed the title feat: Genkit Agents feat: genkit agents Jul 4, 2026
@xavidop
xavidop merged commit 7798bd0 into main Jul 4, 2026
13 of 15 checks passed
@xavidop
xavidop deleted the xavier/agents branch July 4, 2026 14:34
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.

1 participant