Skip to content

feat: Add ArtifactStreamer helper for streaming text artifact updates#834

Open
kevinlu310 wants to merge 8 commits intoa2aproject:mainfrom
kevinlu310:main
Open

feat: Add ArtifactStreamer helper for streaming text artifact updates#834
kevinlu310 wants to merge 8 commits intoa2aproject:mainfrom
kevinlu310:main

Conversation

@kevinlu310
Copy link
Contributor

@kevinlu310 kevinlu310 commented Mar 15, 2026

Description

Add ArtifactStreamer helper for streaming text artifact updates.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (if necessary)

Fixes #833 🦕

new_text_artifact generates a fresh UUID on every call, making it
unsuitable for streaming where append semantics require a stable
artifact ID across chunks. ArtifactStreamer holds a single artifact
ID and provides append() and finalize() methods that emit correctly
shaped TaskArtifactUpdateEvents with append=True.
@kevinlu310 kevinlu310 requested a review from a team as a code owner March 15, 2026 20:14
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 new utility class, ArtifactStreamer, designed to simplify the process of streaming text content into a single artifact over a series of events. This enhancement provides a structured way to handle incremental updates to artifacts, ensuring that all parts of a streamed artifact are correctly associated and finalized according to the A2A specification. It streamlines the creation and management of dynamic text artifacts.

Highlights

  • New ArtifactStreamer Helper: Introduced the ArtifactStreamer class to facilitate streaming text content into a single artifact across multiple events, ensuring proper append semantics.
  • Stable Artifact IDs: The ArtifactStreamer generates a stable artifact ID upon construction, allowing all streamed chunks to reference the same artifact consistently.
  • Event Emission Methods: Provided append and finalize methods within ArtifactStreamer to emit TaskArtifactUpdateEvent objects for incremental text updates and to signal the completion of the artifact stream, respectively.
Changelog
  • src/a2a/utils/init.py
    • Imported ArtifactStreamer from a2a.utils.artifact.
    • Added ArtifactStreamer to the __all__ export list.
  • src/a2a/utils/artifact.py
    • Imported TaskArtifactUpdateEvent from a2a.types.
    • Implemented the ArtifactStreamer class, including its __init__, append, and finalize methods for managing text artifact streaming.
  • tests/utils/test_artifact.py
    • Imported ArtifactStreamer and TaskArtifactUpdateEvent for testing purposes.
    • Added a new test class TestArtifactStreamer with comprehensive unit tests covering artifact ID generation, naming, append logic, and finalization.
Activity
  • The pull request was opened by kevinlu310.
  • The PR description includes a checklist for contributing, conventional commit guidelines, and mentions fixing issue [Feat]: Add streaming-aware helper for artifact updates #833.
  • No specific review comments or progress updates are available in the provided context.
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 helpful ArtifactStreamer class for managing streaming text artifact updates, which is a great addition. The implementation is clean and comes with a comprehensive set of unit tests. My feedback focuses on a minor improvement to enhance encapsulation by making internal attributes private, which is a common best practice in Python for clearer API boundaries. I've provided a set of related suggestions to apply this change consistently across the new class and its tests.

kevinlu310 and others added 6 commits March 15, 2026 13:18
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

[Feat]: Add streaming-aware helper for artifact updates

1 participant