Skip to content

refactor!: extract developer helpers in helpers folder#978

Merged
guglielmo-san merged 12 commits into1.0-devfrom
guglielmoc/refactor_utils_and_helpers
Apr 17, 2026
Merged

refactor!: extract developer helpers in helpers folder#978
guglielmo-san merged 12 commits into1.0-devfrom
guglielmoc/refactor_utils_and_helpers

Conversation

@guglielmo-san
Copy link
Copy Markdown
Member

@guglielmo-san guglielmo-san commented Apr 17, 2026

Description

Extracts developer-facing helper functions from a2a.utils into a dedicated a2a.helpers package.

What changed

  • New a2a.helpers package with two modules:
    • proto_helpers.py — unified helpers for creating/inspecting Messages, Artifacts, Tasks, Events, and StreamResponses
    • agent_card.py — moved from utils/agent_card.py
  • Relocated internal functions to their actual consumers:
    • append_artifact_to_task -> server/tasks/task_manager.py
    • canonicalize_agent_card, _clean_empty -> utils/signing.py
  • Removed unused helpers

Motivation
This is the first in a series of PRs to simplify the a2a.utils structure. The goal is to stop mixing developer-facing convenience helpers with internal SDK machinery.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 17, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/tasks/task_manager.py 98.32% 98.68% 🟢 +0.36%
src/a2a/utils/helpers.py 96.73% 93.51% 🔴 -3.23%
src/a2a/utils/signing.py 93.18% 95.38% 🟢 +2.20%
src/a2a/utils/task.py 96.63% 95.16% 🔴 -1.47%
src/a2a/helpers/agent_card.py (new) 100.00%
src/a2a/helpers/proto_helpers.py (new) 94.12%
Total 92.59% 92.54% 🔴 -0.05%

Generated by coverage-comment.yml

Copy link
Copy Markdown
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 refactors the A2A Python SDK by consolidating and unifying helper functions for managing A2A types—including Messages, Artifacts, Tasks, and Events—into a new a2a.helpers package. The changes involve moving utility functions from a2a.utils, updating references across the client and server implementations, and relocating append_artifact_to_task to the TaskManager. Feedback identifies a bug in new_text_artifact_update_event regarding artifact_id generation for appended chunks, a missing role validation check in new_task_from_user_message, and a redundant dictionary conversion during metadata updates.

Comment thread src/a2a/helpers/types.py Outdated
Comment thread src/a2a/helpers/proto_helpers.py
Comment thread src/a2a/server/tasks/task_manager.py
@guglielmo-san guglielmo-san changed the title refactor!: extract user helpers in separate folder refactor!: extract developer helpers in helpers folder Apr 17, 2026
@guglielmo-san guglielmo-san marked this pull request as ready for review April 17, 2026 09:56
@guglielmo-san guglielmo-san requested a review from a team as a code owner April 17, 2026 09:56
@guglielmo-san guglielmo-san enabled auto-merge (squash) April 17, 2026 10:25
@guglielmo-san guglielmo-san merged commit 5f3ea29 into 1.0-dev Apr 17, 2026
18 checks passed
@guglielmo-san guglielmo-san deleted the guglielmoc/refactor_utils_and_helpers branch April 17, 2026 10:27
ishymko added a commit that referenced this pull request Apr 17, 2026
ishymko added a commit that referenced this pull request Apr 17, 2026
ishymko pushed a commit that referenced this pull request Apr 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.0.0-alpha.2](v1.0.0-alpha.1...v1.0.0-alpha.2)
(2026-04-17)


### ⚠ BREAKING CHANGES

* clean helpers and utils folders structure
([#983](#983))
* Raise errors on invalid AgentExecutor behavior.
([#979](#979))
* extract developer helpers in helpers folder
([#978](#978))

### Features

* Raise errors on invalid AgentExecutor behavior.
([#979](#979))
([f4a0bcd](f4a0bcd))
* **utils:** add `display_agent_card()` utility for human-readable
AgentCard inspection
([#972](#972))
([3468180](3468180))


### Bug Fixes

* Don't generate empty metadata change events in VertexTaskStore
([#974](#974))
([b58b03e](b58b03e)),
closes [#802](#802)
* **extensions:** support both header names and remove "activation"
concept ([#984](#984))
([b8df210](b8df210))


### Documentation

* AgentExecutor interface documentation
([#976](#976))
([d667e4f](d667e4f))
* move `ai_learnings.md` to local-only and update `GEMINI.md`
([#982](#982))
([f6610fa](f6610fa))


### Code Refactoring

* clean helpers and utils folders structure
([#983](#983))
([c87e87c](c87e87c))
* extract developer helpers in helpers folder
([#978](#978))
([5f3ea29](5f3ea29))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants