Skip to content

fix: move A2AExpressServer to dedicated subpath export for browser compatibility#721

Merged
pgrayy merged 3 commits intostrands-agents:mainfrom
pgrayy:fix/a2a-browser-compat
Mar 25, 2026
Merged

fix: move A2AExpressServer to dedicated subpath export for browser compatibility#721
pgrayy merged 3 commits intostrands-agents:mainfrom
pgrayy:fix/a2a-browser-compat

Conversation

@pgrayy
Copy link
Copy Markdown
Member

@pgrayy pgrayy commented Mar 23, 2026

Description

The ./a2a barrel export re-exports A2AExpressServer, which imports Express (a Node-only dependency). This causes bundlers targeting browser environments to fail when importing from @strands-agents/sdk/a2a, even if the consumer only needs browser-safe types like A2AAgent or A2AServer.

This PR moves A2AExpressServer to a dedicated ./a2a/express subpath export so the main ./a2a entry point remains browser-safe.

Related Issues

N/A

Documentation PR

strands-agents/docs#695

Type of Change

Breaking change

Testing

Integration tests were restructured to validate browser compatibility:

  • a2a-agent.test.ts tests A2AAgent invoke/stream against a server started in global setup, runs in both Node and browser environments

  • express-server.test.node.ts tests Express-specific functionality (standalone serve, middleware, image file parts), Node-only

  • I ran npm run check

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.

@github-actions github-actions bot added the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
pgrayy added a commit to pgrayy/docs that referenced this pull request Mar 23, 2026
The TypeScript SDK moved A2AExpressServer from the ./a2a barrel export
to a dedicated ./a2a/express subpath for browser compatibility.

See: strands-agents/sdk-typescript#721
@github-actions
Copy link
Copy Markdown

Issue: The PR description says "Resolves: #718" but #718 appears to be a different PR (log message clarification), not an issue describing the browser compatibility problem.

Suggestion: Update the PR description with the correct issue reference, or remove the reference if there's no corresponding issue. If this problem was discovered but not tracked as an issue, consider documenting the root cause more explicitly in the PR description.

@github-actions
Copy link
Copy Markdown

Assessment: Request Changes

This PR introduces a well-structured fix for browser compatibility by moving A2AExpressServer to a dedicated subpath export. The code quality is good, and the test restructuring properly validates the separation.

Review Categories
  • Documentation: Breaking change requires a documentation PR to update import paths in examples. The PR description acknowledges this need but doesn't link to a docs PR.
  • API Review: This modifies the public API surface (import paths changed). Consider adding the needs-api-review label per the API bar raising guidelines.
  • PR Description: The "Resolves: fix: clarify A2AAgent log message for non-text content stripping #718" reference appears to link to an unrelated PR rather than an issue.

The test restructuring and code organization are solid. Please address the documentation PR requirement before merging.

@github-actions github-actions bot removed the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
@github-actions github-actions bot added the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
@github-actions
Copy link
Copy Markdown

Assessment: Request Changes

Thanks for addressing the documentation PR link and issue reference! However, there are a couple of new issues:

Review Categories
  • Unrelated file: bug-bash.md (360 lines) appears to be accidentally included in this PR
  • PR description: The Testing section says a2a-agent.test.ts "runs in both Node and browser environments" but the file is now named a2a-agent.test.node.ts (Node-only). Please update the description to reflect the actual test structure.

Once the unrelated file is removed and the description is updated, this looks good to merge.

@github-actions github-actions bot removed the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
@pgrayy pgrayy force-pushed the fix/a2a-browser-compat branch from b2d8ae6 to d7c7809 Compare March 23, 2026 18:34
@pgrayy pgrayy temporarily deployed to manual-approval March 23, 2026 18:35 — with GitHub Actions Inactive
@github-actions github-actions bot added the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
@github-actions
Copy link
Copy Markdown

Assessment: Approve

All previous feedback has been addressed. The PR now cleanly separates A2AExpressServer into a dedicated subpath export while keeping the main ./a2a entry point browser-safe.

Review Summary
  • Documentation PR: Properly linked (strands-agents/docs#695)
  • Test structure: Well-organized with a2a-agent.test.ts for browser-compatible tests and express-server.test.node.ts for Node-only Express tests
  • Global setup: Properly starts A2A server with CORS headers for cross-origin browser tests and returns cleanup function
  • Code quality: Clean separation of concerns with minimal changes

Nice work on the test restructuring to properly validate browser compatibility!

@github-actions github-actions bot removed the strands-running <strands-managed> Whether or not an agent is currently running label Mar 23, 2026
pgrayy added 2 commits March 25, 2026 11:24
- Check project test files before starting the A2A Express server
- Narrow try/catch to only credential resolution so real failures propagate
@pgrayy pgrayy temporarily deployed to manual-approval March 25, 2026 16:04 — with GitHub Actions Inactive
@github-actions github-actions bot added the strands-running <strands-managed> Whether or not an agent is currently running label Mar 25, 2026
@github-actions
Copy link
Copy Markdown

Assessment: Approve

The latest commit "fix: only start A2A server when A2A tests are in scope" addresses zastrowm's concern about the server starting for every test.

Response to Open Review Threads

Thread 1 (server starts for every test): ✅ Addressed - setup now checks hasA2ATests before starting server

Thread 2 (browser environment skip): The global setup runs in the parent Node process, not browser. Browser tests connect to the server via HTTP with CORS headers.

Thread 3 (when does test skip): The file is a2a-agent.test.ts (not .node.ts) so it runs in both environments. Skip occurs when Bedrock credentials aren't available.

I've replied to each thread with detailed explanations.

@github-actions github-actions bot removed the strands-running <strands-managed> Whether or not an agent is currently running label Mar 25, 2026
@pgrayy pgrayy added this pull request to the merge queue Mar 25, 2026
Merged via the queue into strands-agents:main with commit aa916f2 Mar 25, 2026
24 of 25 checks passed
@pgrayy pgrayy deleted the fix/a2a-browser-compat branch March 25, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants