You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Description This PR introduces a new feature allowing server maintainers to provide custom ID generators for system-created objects. I identified 2 key areas requiring ID generation: - [`ResourceContext`](https://github.com/a2aproject/a2a-python/blob/19091262d07b5226becdb177ed4d780b4befb5f4/src/a2a/server/agent_execution/context.py): Manages the creation of new task and context IDs when not supplied by the client. - [`TaskUpdater`](https://github.com/a2aproject/a2a-python/blob/19091262d07b5226becdb177ed4d780b4befb5f4/src/a2a/server/tasks/task_updater.py): Helper responsible for generating IDs for new artifacts and messages during task updates. To address this, a new abstract class, `IDGenerator`, has been introduced. This class enables the creation of specific ID generators for different resource types, which can then be integrated into the relevant SDK components. Alternative approaches were considered: 1. Using a single `IDGenerator` instance for all resource types, with resource type information passed to the generate method. This option was discarded due to potential coupling issues and increased maintenance complexity. 1. Implementing an additional `IDGeneratorRegistry` to manage per-resource-type generators via a `get_id_generator(resource_type)` method. While this would simplify object passing, it introduces additional indirection and overall system complexity. # Prerequisites - [x] Follow the [`CONTRIBUTING` Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) 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. - [x] Ensure the tests and linter pass (Run `bash scripts/format.sh` from the repository root to format) - [x] Appropriate docs were updated (if necessary) Fixes#378 🦕 --------- Co-authored-by: lkawka <lkawka@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
0 commit comments