Skip to content

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

Open
kevinlu310 wants to merge 5 commits intoa2aproject:1.0-devfrom
kevinlu310:artifact-streamer
Open

feat: Add ArtifactStreamer helper for streaming text artifact updates#842
kevinlu310 wants to merge 5 commits intoa2aproject:1.0-devfrom
kevinlu310:artifact-streamer

Conversation

@kevinlu310
Copy link
Contributor

@kevinlu310 kevinlu310 commented Mar 16, 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 🦕

kevinlu310 and others added 3 commits March 16, 2026 09:51
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@kevinlu310 kevinlu310 requested a review from a team as a code owner March 16, 2026 16:55
@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 the ArtifactStreamer utility, a significant enhancement for handling text artifact updates. It provides a robust mechanism for incrementally streaming text content into a single artifact, ensuring data consistency and adherence to the A2A specification's append semantics. This simplifies the development of features that require real-time or chunked text output, making it easier to manage dynamic artifact updates.

Highlights

  • New Utility Class: Introduced the ArtifactStreamer utility class to simplify the process of streaming text into a single artifact across multiple events.
  • Stable Artifact ID: The ArtifactStreamer ensures a stable artifact ID is maintained throughout the streaming process, enabling proper append semantics as per the A2A specification.
  • Integration and Testing: The ArtifactStreamer is exported from a2a.utils and comes with comprehensive unit tests to validate its functionality and ensure reliability.
  • Protobuf Adaptation: The implementation is adapted to use 1.0-dev protobuf-based types (a2a.types.a2a_pb2) for consistency with the latest data structures.
Changelog
  • .pre-commit-config.yaml
    • Added a blank line for formatting.
  • pyproject.toml
    • Added a blank line for formatting in the dev dependency list.
  • src/a2a/utils/init.py
    • Imported and exposed the new ArtifactStreamer class.
  • src/a2a/utils/artifact.py
    • Implemented the ArtifactStreamer class, including its initialization, append method for adding text chunks, and finalize method to signal completion, all utilizing TaskArtifactUpdateEvent and Artifact protobuf types.
  • tests/utils/test_artifact.py
    • Added a new test suite, TestArtifactStreamer, with extensive unit tests covering stable artifact ID generation, explicit ID usage, default and custom naming, correct event structure for append and finalize operations, and multi-chunk streaming behavior.
Activity
  • The author implemented the ArtifactStreamer class and its associated methods.
  • Comprehensive unit tests were added for the new ArtifactStreamer functionality, covering various scenarios like stable artifact ID generation, explicit IDs, append/finalize event structure, and multi-chunk streaming.
  • Existing test_artifact.py tests were verified to continue passing, ensuring no regressions.
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 utility for managing streaming text updates to an artifact. The implementation is clear, well-documented, and accompanied by thorough unit tests. A critical issue has been identified where a required module is used without being imported, which will lead to a runtime error. Addressing this will make the new utility robust and ready for use.

@github-actions
Copy link

github-actions bot commented Mar 16, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

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