Skip to content

refactor(kagent-adk): subclass upstream ADK executor and deduplicate …#1294

Open
EItanya wants to merge 3 commits intomainfrom
eitanya/delete-custom-a2a-executor-part-1
Open

refactor(kagent-adk): subclass upstream ADK executor and deduplicate …#1294
EItanya wants to merge 3 commits intomainfrom
eitanya/delete-custom-a2a-executor-part-1

Conversation

@EItanya
Copy link
Contributor

@EItanya EItanya commented Feb 13, 2026

…A2A constants

Structural alignment toward upstream google-adk A2A support:

  • Change A2aAgentExecutor to subclass google.adk.a2a.A2aAgentExecutor instead of the raw a2a-sdk AgentExecutor base class. Kagent's custom converters are plugged in via UpstreamA2aAgentExecutorConfig. All kagent-specific behavior (per-request runner lifecycle, OTel spans, Ollama error handling, partial event filtering, session naming, header forwarding, invocation ID tracking) is preserved via method overrides.

  • Replace locally-defined A2A DataPart metadata constants in kagent-core/_consts.py with imports from upstream google.adk.a2a.converters.part_converter. The values are identical; this eliminates duplication and ensures kagent stays in sync with upstream definitions.

  • Bump google-adk dependency to >=1.25.0.

No behavior change — all existing tests pass.

…A2A constants

Structural alignment toward upstream google-adk A2A support:

- Change A2aAgentExecutor to subclass google.adk.a2a.A2aAgentExecutor
  instead of the raw a2a-sdk AgentExecutor base class. Kagent's custom
  converters are plugged in via UpstreamA2aAgentExecutorConfig. All
  kagent-specific behavior (per-request runner lifecycle, OTel spans,
  Ollama error handling, partial event filtering, session naming, header
  forwarding, invocation ID tracking) is preserved via method overrides.

- Replace locally-defined A2A DataPart metadata constants in
  kagent-core/_consts.py with imports from upstream
  google.adk.a2a.converters.part_converter. The values are identical;
  this eliminates duplication and ensures kagent stays in sync with
  upstream definitions.

- Bump google-adk dependency to >=1.25.0.

No behavior change — all existing tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Copilot AI review requested due to automatic review settings February 13, 2026 14:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the kagent A2A (Agent-to-Agent) implementation to better align with upstream google-adk patterns while preserving all kagent-specific behaviors. The changes focus on eliminating code duplication and establishing a cleaner inheritance hierarchy.

Changes:

  • A2aAgentExecutor now subclasses the upstream google-adk A2aAgentExecutor instead of the raw a2a-sdk AgentExecutor base class
  • A2A DataPart metadata constants are now imported from upstream google.adk.a2a.converters.part_converter instead of being locally defined
  • Bumped google-adk dependency from >=1.22.1 to >=1.25.0

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
python/uv.lock Updated dependency versions: google-adk 1.22.1→1.25.0, fastapi 0.123.10→0.129.0, added pyopenssl 25.3.0 and httpx dependencies
python/packages/kagent-core/src/kagent/core/a2a/_consts.py Replaced local A2A constant definitions with imports from upstream google.adk.a2a.converters.part_converter
python/packages/kagent-adk/src/kagent/adk/_agent_executor.py Refactored A2aAgentExecutor to subclass upstream executor; added adapter functions for converters; removed unused opentelemetry import; moved asyncio import to proper location
python/packages/kagent-adk/pyproject.toml Updated google-adk version requirement to >=1.25.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

A2A_DATA_PART_METADATA_TYPE_EXECUTABLE_CODE = "executable_code"
# Re-export A2A DataPart metadata constants from upstream google-adk.
# These are the canonical definitions — kagent should not redefine them.
from google.adk.a2a.converters.part_converter import ( # noqa: E402
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The # noqa: E402 comment is unnecessary here. E402 ("module level import not at top of file") applies when imports appear after code statements, but this import is at the top of the file immediately after comments. The noqa directive should be removed as it's misleading and serves no purpose.

Suggested change
from google.adk.a2a.converters.part_converter import ( # noqa: E402
from google.adk.a2a.converters.part_converter import (

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 10
from google.adk.a2a.converters.part_converter import ( # noqa: E402
A2A_DATA_PART_METADATA_IS_LONG_RUNNING_KEY,
A2A_DATA_PART_METADATA_TYPE_CODE_EXECUTION_RESULT,
A2A_DATA_PART_METADATA_TYPE_EXECUTABLE_CODE,
A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL,
A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE,
A2A_DATA_PART_METADATA_TYPE_KEY,
)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Import of 'A2A_DATA_PART_METADATA_IS_LONG_RUNNING_KEY' is not used.
Import of 'A2A_DATA_PART_METADATA_TYPE_CODE_EXECUTION_RESULT' is not used.
Import of 'A2A_DATA_PART_METADATA_TYPE_EXECUTABLE_CODE' is not used.
Import of 'A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL' is not used.
Import of 'A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE' is not used.
Import of 'A2A_DATA_PART_METADATA_TYPE_KEY' is not used.

Copilot uses AI. Check for mistakes.
Address PR review feedback:
- Remove unnecessary `# noqa: E402` directive
- Use `X as X` syntax for explicit re-exports so linters recognize
  these imports are intentionally re-exported, not unused

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Copy link
Contributor Author

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

Addressed both comments in dd68443:

  1. noqa removal — Good catch, removed the unnecessary # noqa: E402.
  2. "Unused imports" — These are intentional re-exports (consumed by __init__.py and downstream packages). Switched to the explicit X as X re-export syntax so linters recognize them as intentional.

peterj
peterj previously approved these changes Feb 13, 2026
supreme-gg-gg
supreme-gg-gg previously approved these changes Feb 13, 2026
@EItanya EItanya dismissed stale reviews from supreme-gg-gg and peterj via 9e97da1 February 13, 2026 18:08
…dependency

kagent-core is a lightweight library that should not depend on google-adk.
The previous re-export from google.adk caused ImportError in packages like
kagent-openai that depend on kagent-core but not google-adk. Define the
constants as local string literals and add a sync-check test in kagent-adk
to ensure they stay aligned with upstream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@EItanya EItanya force-pushed the eitanya/delete-custom-a2a-executor-part-1 branch from 9e97da1 to 3ecd539 Compare February 13, 2026 18:12
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.

3 participants