Skip to content

A2A: Various usage cleanups in Kagent harness - #2385

Merged
EItanya merged 7 commits into
jetc/feat/a2a-v1-migrationfrom
jetc/feat/a2a-cleanup
Aug 7, 2026
Merged

A2A: Various usage cleanups in Kagent harness#2385
EItanya merged 7 commits into
jetc/feat/a2a-v1-migrationfrom
jetc/feat/a2a-cleanup

Conversation

@supreme-gg-gg

Copy link
Copy Markdown
Contributor

This PR changes A2A output to be now artifact-based rather than assistant-message/history-based. Consumers should render Task.Artifacts; transient progress remains in task status updates.

Motivation

This refactor aligns kagent’s A2A usage with the protocol’s separation between task state and task output, as A2A protocol specification noted:

Messages SHOULD NOT be used to deliver task outputs. Results SHOULD BE returned using Artifacts associated with a Task. This separation allows for a clear distinction between communication (Messages) and data output (Artifacts).

Previously, streamed assistant text and tool data were carried in WORKING status messages, with an artifact emitted only at the end of the task. That made status updates serve two roles and required clients to reconstruct the response from transient state. Task output is now emitted as TaskArtifactUpdateEvents throughout execution. Status updates communicate only task lifecycle, HITL, failures, etc. A terminal status closes the task, while lastChunk closes an individual artifact.

This is a breaking wire-level change for consumers that read assistant output from status messages or task history. Consumers should instead render Task.Artifacts and process artifact updates as they arrive.

Change surfaces

ADK/BYO:

  • Go ADK: replaced the custom executor flow with the upstream ADK A2A executor, configured for OutputArtifactPerEvent, so ADK events become A2A artifact updates. Subsequently, cleanup all kagent specific partial event handling logic since upstream supports it now. Partial events and emitted as artifacts with append=true.
  • Python ADK: Similar refactor as Go. Python still uses custom executor, but in a follow up PR we will bump python-adk to 2.0 which allows upstreaming executor
  • Applies the same A2A change to BYO harness and improves them (CrewAI, OpenAI Agents SDK) by making their converters / event handlers return appropriate tool calling / agent delegation data parts

UI/CLI:

  • UI: use task status updates for working/progress and HITL instead of canonical assistant response, which is now moved to artifact part updates, and adds relevant buffering and flushing mechanisms for handling streaming cases (similarly for CLI, except that the Go TUI does not support streaming messages)
  • UI cleanup: subagent session IDs are now taken from function-response data, cleanup following fix(go-adk): add per-call session isolation for Agent tools #2153

@chromatic-com

chromatic-com Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Testing paused

Monthly snapshot limit reached. Update your plan for additional snapshots and to resume testing.

@supreme-gg-gg
supreme-gg-gg force-pushed the jetc/feat/a2a-cleanup branch from 403b90a to 43b8108 Compare August 3, 2026 17:43
@supreme-gg-gg
supreme-gg-gg marked this pull request as ready for review August 3, 2026 17:44
@supreme-gg-gg
supreme-gg-gg requested a review from a team as a code owner August 3, 2026 17:44
Copilot AI review requested due to automatic review settings August 3, 2026 17:44
@supreme-gg-gg
supreme-gg-gg marked this pull request as draft August 3, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 kagent’s A2A “task output” handling to follow the A2A spec: canonical outputs stream via TaskArtifactUpdateEvent / Task.Artifacts, while TaskStatusUpdateEvent is reserved for lifecycle/progress/HITL/error/auth signals. It updates the UI, CLI (TUI), Go ADK harness, Python runtimes/converters, and E2E/tests accordingly.

Changes:

  • UI transcript reconstruction and streaming now consume artifacts (plus dedicated WORKING progress text), and “finished reply” chrome is derived from terminal task status rather than message metadata.
  • Go ADK executor delegates to upstream adka2a.Executor configured for OutputArtifactPerEvent; Go E2E assertions now validate artifact output for sync/streaming.
  • Python converters/executors (ADK/OpenAI/LangGraph/CrewAI) shift from status-message output to artifact events; legacy “result aggregation” helpers are removed.

Reviewed changes

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

Show a summary per file
File Description
ui/src/lib/messageHandlers.ts Rebuild transcript/streaming around artifact updates; add terminal-task + per-task token-stat derivation.
ui/src/lib/tests/messageHandlers.test.ts Update/add tests for artifact-based transcript, HITL anchoring, and token stat collection.
ui/src/components/chat/ToolCallDisplay.tsx Stop deriving subagent session id from function_call metadata; rely on function_response/tool-result path.
ui/src/components/chat/StatusDisplay.tsx Allow showing transient WORKING progress text separate from chat transcript.
ui/src/components/chat/ChatMessage.tsx Move reply actions/token tooltip gating to derived terminal-task state instead of message metadata.
ui/src/components/chat/ChatInterface.tsx Wire terminal task tracking + per-task token stats; plumb WORKING status progress text.
ui/src/components/chat/tests/ChatInterface.sendGuard.test.tsx Update send-guard mock streams/tasks to reflect artifacts-as-output.
ui/playwright/mocks/server.mjs Update mock SSE stream to emit artifact update + terminal status (no assistant message in status).
python/packages/kagent-openai/src/kagent/openai/_event_converter.py Convert OpenAI agent events (including handoffs) into artifact updates instead of WORKING status messages.
python/packages/kagent-openai/src/kagent/openai/_agent_executor.py Emit artifact output (including fallback final output) and always send terminal completed status.
python/packages/kagent-langgraph/src/kagent/langgraph/_executor.py Remove task-result aggregation; publish a single terminal completed status after streaming.
python/packages/kagent-langgraph/src/kagent/langgraph/_converters.py Convert LangGraph messages/tool responses into artifact updates (not status-update messages).
python/packages/kagent-crewai/tests/test_executor.py Update tests to record events and assert a content-bearing closing artifact is emitted.
python/packages/kagent-crewai/src/kagent/crewai/_listeners.py Emit tool/agent events as artifacts; keep WORKING status for progress-only updates.
python/packages/kagent-core/src/kagent/core/a2a/_task_store.py Remove partial-history filtering now that outputs are artifact-based.
python/packages/kagent-core/src/kagent/core/a2a/_task_result_aggregator.py Remove legacy status-message-based result aggregation helper.
python/packages/kagent-core/src/kagent/core/a2a/init.py Stop exporting removed aggregator.
python/packages/kagent-adk/tests/unittests/test_artifact_streaming.py New tests for splitting HITL parts out of artifacts into status.
python/packages/kagent-adk/tests/unittests/converters/test_event_converter.py Update converter tests for artifact emission + OutputArtifactPerEvent semantics.
python/packages/kagent-adk/src/kagent/adk/converters/event_converter.py Emit TaskArtifactUpdateEvent (append/replace + last_chunk) rather than WORKING status messages.
python/packages/kagent-adk/src/kagent/adk/_agent_executor.py Implement artifact streaming + HITL/auth status handling; remove TaskResultAggregator usage.
go/core/test/e2e/remotemcpserver_tls_test.go Update helper callsites to new runSyncTest signature (artifact-based validation).
go/core/test/e2e/invoke_api_test.go Make sync/streaming E2E assertions validate final artifact output consistently.
go/core/cli/internal/tui/chat.go Buffer/commit artifact text according to append/lastChunk; treat status messages as control-plane.
go/core/cli/internal/tui/chat_test.go Add tests for artifact buffering, replacement, tool-part processing, and task snapshot rendering.
go/adk/pkg/taskstore/store.go Stop stripping partial events/artifacts before persistence.
go/adk/pkg/README.md Update docs to reflect upstream executor usage and artifact-based output.
go/adk/pkg/models/openai_adk.go Populate TotalTokenCount in usage metadata.
go/adk/pkg/a2a/executor.go Replace custom executor flow with upstream adka2a.Executor configured for OutputArtifactPerEvent.
go/adk/pkg/a2a/executor_test.go Rewrite tests to validate decision-transform delegation, cleanup forwarding, and artifact streaming semantics.
go/adk/pkg/a2a/converter.go Add GenAI→A2A part converter hook for upstream executor while preserving kagent filtering.
go/adk/pkg/a2a/converter_test.go Update tests for converter behavior and long-running tool metadata preservation.

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

Comment thread python/packages/kagent-crewai/src/kagent/crewai/_listeners.py
Comment thread go/adk/pkg/a2a/executor.go Outdated
Comment thread python/packages/kagent-adk/src/kagent/adk/_agent_executor.py
@supreme-gg-gg
supreme-gg-gg force-pushed the jetc/feat/a2a-cleanup branch from 43b8108 to 714e526 Compare August 6, 2026 01:20
@supreme-gg-gg
supreme-gg-gg force-pushed the jetc/feat/a2a-cleanup branch from 714e526 to 8df6d52 Compare August 6, 2026 02:30
@supreme-gg-gg
supreme-gg-gg marked this pull request as ready for review August 6, 2026 02:45
@supreme-gg-gg
supreme-gg-gg force-pushed the jetc/feat/a2a-cleanup branch 2 times, most recently from 6fbc14b to 5f9e3ca Compare August 6, 2026 15:51
@EItanya
EItanya force-pushed the jetc/feat/a2a-cleanup branch from 5f9e3ca to df11ef6 Compare August 6, 2026 20:38
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
… executor to use artifact-based a2a streaming protocol

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
@supreme-gg-gg
supreme-gg-gg force-pushed the jetc/feat/a2a-cleanup branch from df11ef6 to 8cb3e6b Compare August 7, 2026 14:20
@EItanya
EItanya merged commit 11f4fa8 into main Aug 7, 2026
32 checks passed
@EItanya
EItanya deleted the jetc/feat/a2a-cleanup branch August 7, 2026 15:01
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.

4 participants