Skip to content

feat(py#strands-agent): add AG-UI protocol support with CopilotKit React connection#543

Open
nx-plugin-for-aws wants to merge 12 commits intomainfrom
feat/ag-ui-support
Open

feat(py#strands-agent): add AG-UI protocol support with CopilotKit React connection#543
nx-plugin-for-aws wants to merge 12 commits intomainfrom
feat/ag-ui-support

Conversation

@nx-plugin-for-aws
Copy link
Copy Markdown
Collaborator

Reason for this change

Addresses the feature request in #480 to add support for the AG-UI protocol in the Strands Agent generators. AG-UI enables standardized agent-to-frontend communication for rich, interactive chat experiences powered by CopilotKit.

This PR builds on top of #539 (A2A protocol support) which establishes the protocol pattern.

Description of changes

  • Schema: Added AG-UI to the protocol enum option for both ts#strands-agent and py#strands-agent generator schemas
  • Python AG-UI Server: When protocol=AG-UI, generates a main.py using ag-ui-strands (StrandsAgent + create_strands_app()) to expose the agent via the AG-UI protocol over FastAPI
  • Infrastructure: AG-UI uses HTTP as the AgentCore protocol type (AG-UI is HTTP-based with SSE over POST)
  • React Connection: New react -> py#strands-agent connection generator that generates CopilotKit components:
    • <AgentNameCopilotProvider> wrapping the app with @copilotkit/react-core
    • HttpAgent from @ag-ui/client for AG-UI connection
    • IAM (SigV4), Cognito (JWT), and no-auth support
    • serve-local integration for development
  • TypeScript AG-UI: Added to schema with clear error message (not yet supported, pending strands-agents/sdk-typescript#347)
  • Dungeon Adventure: Updated tutorial to use AG-UI protocol with CopilotKit instead of custom HTTP streaming hook
  • Smoke Tests: Added AG-UI agent generation and React connection to smoke test suite
  • Documentation: Updated py-strands-agent guide, ts-strands-agent guide, dungeon adventure tutorial, and created new connection guide

Description of how you validated changes

  • All 1610 unit tests pass (no regressions)
  • Build passes cleanly with no errors
  • Lint passes with no errors (only pre-existing warnings)
  • End-to-end tested by:
    1. Compiling the local plugin
    2. Creating a test workspace with create-nx-workspace
    3. Linking the local plugin with pnpm link
    4. Generating a py#strands-agent with protocol=AG-UI
    5. Generating a React website with Cognito auth
    6. Running the connection generator to connect React -> py#strands-agent
    7. Verifying nx run-many --target build --all passes
    8. Verifying generated CopilotKit provider, HttpAgent setup, and main.tsx injection

Issue # (if applicable)

Closes #480.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

nx-plugin-for-aws and others added 8 commits April 2, 2026 22:00
Add a `protocol` option to the ts#strands-agent and py#strands-agent
generators, allowing users to choose between HTTP (default) and A2A
(Agent-to-Agent) protocol for their Strands Agents.

- Add `protocol` enum (HTTP/A2A) to both generator schemas
- Pass protocol through to CDK/Terraform infrastructure (ProtocolType)
- Include protocol in component metadata for downstream consumption
- Vend A2AExpressServer (TS) and A2AServer (Python) code for A2A agents
- Update @strands-agents/sdk to 1.0.0-rc.1 for A2A support
- Update strands-agents-tools to 0.3.0
- Update documentation for both TS and Python agent guides

Closes #323
- Reorganize templates into common/http/a2a directories for clarity
- A2A servers use port 9000 (per Strands SDK default) instead of 8080
- Python A2A uses to_fastapi_app() for hot-reload via fastapi dev
- Dockerfiles EXPOSE correct port (9000 for A2A, 8080 for HTTP)
- Python A2A uses uvicorn in Dockerfile for proper server start
- Use spread pattern for protocol-specific deps in withVersions
- Add strands-agents[a2a] dep for Python, @a2a-js/sdk for TypeScript
- React connection generator throws if target agent uses A2A protocol
- Move A2A docs sections below HTTP/FastAPI sections in guides
…cation docs

- Add A2A agent generation to smoke tests for both Python and TypeScript
- Document A2A agent invocation using strands-agents-tools[a2a_client] (Python)
- Document A2A agent invocation using @a2a-js/sdk (TypeScript)
- Fix A2AExpressServer API: use serve() not start(), port via constructor
- Wrap A2A index.ts in async main() to avoid top-level await in CJS bundle
- Update TS A2A docs to match corrected template code
The strands-agents[a2a] dependency pulls in greenlet which requires
C++ compilation. Using computeType=None avoids the bundle-arm target
which triggers cross-platform pip install and fails on CI runners
without the required C++ compiler flags.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 24.63768% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.05%. Comparing base (8c7d1f8) to head (1604179).

Files with missing lines Patch % Lines
...src/py/strands-agent/react-connection/generator.ts 0.00% 28 Missing ⚠️
...c/py/strands-agent/react-connection/serve-local.ts 7.14% 13 Missing ⚠️
...src/ts/strands-agent/react-connection/generator.ts 0.00% 2 Missing and 2 partials ⚠️
...ckages/nx-plugin/src/py/strands-agent/generator.ts 70.00% 0 Missing and 3 partials ⚠️
...ckages/nx-plugin/src/ts/strands-agent/generator.ts 80.00% 1 Missing and 1 partial ⚠️
packages/nx-plugin/src/connection/generator.ts 0.00% 1 Missing ⚠️
...ils/agent-core-constructs/agent-core-constructs.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #543      +/-   ##
==========================================
- Coverage   89.45%   88.05%   -1.40%     
==========================================
  Files          94       96       +2     
  Lines        3158     3224      +66     
  Branches      695      726      +31     
==========================================
+ Hits         2825     2839      +14     
- Misses        154      199      +45     
- Partials      179      186       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

📚 Documentation translations have been updated and committed (bba165c) to this PR.

docs/src/content/docs/es/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/es/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/es/guides/py-strands-agent.mdx
docs/src/content/docs/es/guides/ts-strands-agent.mdx
docs/src/content/docs/fr/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/fr/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/fr/guides/py-strands-agent.mdx
docs/src/content/docs/fr/guides/ts-strands-agent.mdx
docs/src/content/docs/it/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/it/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/it/guides/py-strands-agent.mdx
docs/src/content/docs/it/guides/ts-strands-agent.mdx
docs/src/content/docs/jp/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/jp/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/jp/guides/py-strands-agent.mdx
docs/src/content/docs/jp/guides/ts-strands-agent.mdx
docs/src/content/docs/ko/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/ko/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/ko/guides/py-strands-agent.mdx
docs/src/content/docs/ko/guides/ts-strands-agent.mdx
docs/src/content/docs/pt/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/pt/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/pt/guides/py-strands-agent.mdx
docs/src/content/docs/pt/guides/ts-strands-agent.mdx
docs/src/content/docs/vi/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/vi/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/vi/guides/py-strands-agent.mdx
docs/src/content/docs/vi/guides/ts-strands-agent.mdx
docs/src/content/docs/zh/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/zh/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/zh/guides/py-strands-agent.mdx
docs/src/content/docs/zh/guides/ts-strands-agent.mdx
docs/src/i18n/schema-translations.json

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

📚 Documentation translations have been updated and committed (5736a80) to this PR.

docs/src/content/docs/es/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/fr/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/it/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/jp/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/ko/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/pt/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/vi/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/zh/guides/connection/react-py-strands-agent.mdx

…act connection

- Add AG-UI as a protocol option for py#strands-agent generator
- Generate AG-UI server using ag-ui-strands (StrandsAgent + create_strands_app)
- AG-UI uses HTTP as the AgentCore protocol type (SSE over POST)
- Add react -> py#strands-agent connection generator with CopilotKit
- Generated CopilotProvider supports IAM (SigV4), Cognito (JWT), and no-auth
- Add AG-UI to ts#strands-agent schema with clear error (not yet supported)
- Update dungeon adventure tutorial to use AG-UI protocol
- Add connection guide for react -> py#strands-agent (AG-UI)
- Update smoke tests with AG-UI agent generation and connection
- Add @ag-ui/client, @copilotkit/react-core, @copilotkit/react-ui to TS versions
- Add ag-ui-protocol, ag-ui-strands to Python versions

Closes #480.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

📚 Documentation translations have been updated and committed (1604179) to this PR.

docs/src/content/docs/es/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/es/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/es/guides/py-strands-agent.mdx
docs/src/content/docs/es/guides/ts-strands-agent.mdx
docs/src/content/docs/fr/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/fr/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/fr/guides/py-strands-agent.mdx
docs/src/content/docs/fr/guides/ts-strands-agent.mdx
docs/src/content/docs/it/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/it/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/it/guides/py-strands-agent.mdx
docs/src/content/docs/it/guides/ts-strands-agent.mdx
docs/src/content/docs/jp/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/jp/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/jp/guides/py-strands-agent.mdx
docs/src/content/docs/jp/guides/ts-strands-agent.mdx
docs/src/content/docs/ko/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/ko/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/ko/guides/py-strands-agent.mdx
docs/src/content/docs/ko/guides/ts-strands-agent.mdx
docs/src/content/docs/pt/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/pt/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/pt/guides/py-strands-agent.mdx
docs/src/content/docs/pt/guides/ts-strands-agent.mdx
docs/src/content/docs/vi/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/vi/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/vi/guides/py-strands-agent.mdx
docs/src/content/docs/vi/guides/ts-strands-agent.mdx
docs/src/content/docs/zh/get_started/tutorials/dungeon-game/1.mdx
docs/src/content/docs/zh/guides/connection/react-py-strands-agent.mdx
docs/src/content/docs/zh/guides/py-strands-agent.mdx
docs/src/content/docs/zh/guides/ts-strands-agent.mdx
docs/src/i18n/schema-translations.json

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.

(strands-agent) AG-UI protocol support

2 participants