Skip to content

fix(flags): A2A streaming - #1889

Open
saitarun-ent wants to merge 1 commit into
aws:mainfrom
saitarun-ent:fix/a2a-streaming
Open

fix(flags): A2A streaming#1889
saitarun-ent wants to merge 1 commit into
aws:mainfrom
saitarun-ent:fix/a2a-streaming

Conversation

@saitarun-ent

@saitarun-ent saitarun-ent commented Jul 31, 2026

Copy link
Copy Markdown

Description

The --stream flag was only working for HTTP agent runtimes and not A2A. This PR adds back the missing arguments needed to connect the flag to invokeA2ARuntime().

Related Issue

Closes #1887

Documentation PR

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@saitarun-ent
saitarun-ent requested review from a team and Copilot July 31, 2026 21:06
@github-actions github-actions Bot added the size/s PR size: S label Jul 31, 2026
@github-actions github-actions Bot added size/s PR size: S and removed size/s PR size: S labels Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Not ready to approve

The new A2A streaming path has correctness gaps (notably text-part format handling and bearer-token streaming behavior) and lacks targeted unit test coverage for the new message/stream branch.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR fixes agentcore invoke --stream for A2A runtimes by plumbing the CLI --stream flag into the A2A invoke path and adding an A2A message/stream (SSE) implementation in the AgentCore client wrapper.

Changes:

  • Passes the CLI --stream option through handleInvoke() into invokeA2ARuntime().
  • Extends A2AInvokeOptions with a stream?: boolean flag.
  • Implements an A2A message/stream SSE response reader to yield incremental text chunks.
File summaries
File Description
src/cli/commands/invoke/action.ts Wires --stream into the A2A invocation options passed to invokeA2ARuntime().
src/cli/aws/agentcore.ts Adds an A2A streaming option and SSE parsing path for message/stream.
Review details

Suppressed comments (1)

src/cli/aws/agentcore.ts:1053

  • Same as the status-update path: artifact-update streaming currently only recognizes kind:'text' parts, so streamed output can be silently empty if the runtime uses type:'text' parts (which is already supported in non-streaming parsing).
                  const text = artifact.parts
                    .filter(p => p.kind === 'text' && p.text)
                    .map(p => p.text!)
                    .join('');
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread src/cli/aws/agentcore.ts
Comment on lines +983 to +985
// Use message/stream (SSE) for real-time streaming when requested
if (options.stream) {
const streamBody = { ...body, method: 'message/stream' };
Comment thread src/cli/aws/agentcore.ts
Comment on lines +1038 to +1041
const text = status.message.parts
.filter(p => p.kind === 'text' && p.text)
.map(p => p.text!)
.join('');
Comment thread src/cli/aws/agentcore.ts
Comment on lines +983 to +987
// Use message/stream (SSE) for real-time streaming when requested
if (options.stream) {
const streamBody = { ...body, method: 'message/stream' };
options.logger?.logSSEEvent(`A2A streaming request: ${JSON.stringify(streamBody)}`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2A Agents don't seem to support streaming via "agentcore invoke"

2 participants