Skip to content

Conversation

@apascal07
Copy link
Collaborator

No description provided.

@github-actions github-actions bot added the docs Improvements or additions to documentation label Jan 16, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @apascal07, 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 introduces a detailed design document for enhancing Genkit Go with robust bidirectional streaming capabilities. It proposes three new core primitives: 'BidiAction' for fundamental streaming operations, 'BidiFlow' for observable streaming, and 'SessionFlow' for managing stateful, multi-turn interactions with automatic persistence. The document comprehensively covers the API surface, integration with existing tracing and session management infrastructure, and provides concrete examples to guide implementation and usage, aiming to facilitate the development of advanced conversational agents and streaming applications.

Highlights

  • Introduction of Core Bidirectional Primitives: Details the design for 'BidiAction' (core bidi operations), 'BidiFlow' (bidi actions with observability), and 'SessionFlow' (stateful, multi-turn agent interactions with persistence).
  • Comprehensive API Design: Outlines the API for defining and interacting with these new primitives, including 'NewBidiAction', 'DefineBidiAction', 'DefineBidiFlow', 'DefineSessionFlow', and the unified 'StreamBidi' method for starting connections.
  • Advanced Session Management: Describes how 'SessionFlow' handles automatic session state persistence, including resuming existing sessions, starting new ones with initial state, and integrating with a 'session.Store'.
  • Integrated Observability and Action Registration: Explains the tracing integration for 'BidiFlows' (spans open for connection lifetime, real-time Dev UI visualization) and updates to 'ActionDesc' for 'StreamSchema' and 'InitSchema'.
  • Detailed Implementation Notes and Examples: Provides insights into error handling, goroutine management, thread safety, channel backpressure, Go 1.23 iterator usage for turn semantics, and a shutdown sequence. Includes practical examples for an echo flow and a chat agent.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 introduces a comprehensive design document for new bidirectional streaming features in Genkit Go, including BidiAction, BidiFlow, and SessionFlow. The document is well-structured and detailed. My review focuses on ensuring the clarity and consistency of the proposed design. I've identified a significant contradiction in the description of the Stream() method's behavior which could lead to implementation errors. I've also suggested a clarification in one of the code examples to improve understanding of the multi-turn flow. Overall, this is a solid design that will be even stronger with these clarifications.

apascal07 and others added 2 commits January 16, 2026 15:59
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@apascal07 apascal07 changed the title doc(go): design for BidiAction, BidiFlow, and SessionFlow docs(go): design for BidiAction, BidiFlow, and SessionFlow Jan 17, 2026
@apascal07 apascal07 changed the title docs(go): design for BidiAction, BidiFlow, and SessionFlow doc(go): design for BidiAction, BidiFlow, and SessionFlow Jan 17, 2026
}

// SessionFlowOutput wraps the output with session info for persistence.
type SessionFlowOutput[State, Out any] struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's define these as common schemas (in genkit-tools/common/src/types) standardized across runtimes.

Copy link
Collaborator Author

@apascal07 apascal07 Jan 17, 2026

Choose a reason for hiding this comment

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

I tend to agree but we haven't been doing the core concepts (action, etc) as generated types because they have type parameters and they're just "core" to the runtime and sometimes implemented differently. But Artifact I agree.

Copy link
Collaborator Author

@apascal07 apascal07 Jan 17, 2026

Choose a reason for hiding this comment

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

In Go, we only generate types for the ai package. Not for any technical reason but that's just been the use case since they tend to be POD structs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, we literally must define these types in genkit-tools/common/src/types because we will be building Dev UI agent playground. So, not only we need zod types for the Dev UI, we also need those types to be the same across languages (which generation ensures). So, I guess I don't have a strong opinion if you want to maintain these types by hand in Go, up to you, but they need to be treated as "source of truth is in genkit-tools/common".

@apascal07 apascal07 changed the title doc(go): design for BidiAction, BidiFlow, and SessionFlow RFC: BidiAction, BidiFlow, and Agent in Go Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants