Skip to content

feat: add AG-UI CopilotKit integration UX sample#224

Open
rajjayaaws wants to merge 1 commit intostrands-agents:mainfrom
rajjayaaws:feature/ag-ui-copilotkit-sample
Open

feat: add AG-UI CopilotKit integration UX sample#224
rajjayaaws wants to merge 1 commit intostrands-agents:mainfrom
rajjayaaws:feature/ag-ui-copilotkit-sample

Conversation

@rajjayaaws
Copy link

Issue #, if available: N/A

Description of changes:
Adds a new UX demo (04-UX-demos/06-ag-ui-copilotkit-integration) showcasing how to build rich, interactive AI chat experiences using Strands Agents SDK with the AG-UI protocol and CopilotKit frontend.

The sample is an AgentCore documentation assistant that demonstrates three key AG-UI capabilities:

  1. Frontend Tool Calls The agent triggers actions that execute entirely in the browser. Two frontend tools are implemented:

show_notification — displays toast notifications (success, info, warning, error)
show_quiz_question — renders interactive multiple-choice quiz cards that wait for user input and return the result back to the agent

  1. Shared State (useCoAgent) Bidirectional state synchronization between the Strands agent and the React UI. The agent creates a learning checklist via the update_learning_checklist tool, which emits a STATE_SNAPSHOT event. The frontend renders this as an interactive sidebar panel where users can check off items. When the user asks about their progress, the agent reads the current state (including user-toggled checkboxes) from the frontend — demonstrating true two-way sync.

  2. Generative UI Custom React components render tool results inline in the chat stream. The search_knowledge tool results are displayed as expandable source cards with relevance scores and section tags, rather than raw JSON.

Architecture:
Python backend: Strands agent with ag-ui-strands adapter, serving AG-UI protocol over SSE
Next.js frontend: CopilotKit hooks (useCopilotAction, useCoAgent) connected via @ag-ui/client
Local knowledge base: Markdown files about AgentCore (no AWS infrastructure required)

What's included:
agent/ — Strands agent with 4 custom tools and AG-UI integration via StrandsAgentConfig for state management
frontend/ — Next.js app with CopilotKit, quiz card component, source card component, and checklist sidebar
agent/knowledge/ — 3 markdown files serving as a local knowledge base
start.sh — Single script to launch both services
Architecture diagram, .env.example files, and README following the samples template
Prerequisites: Python 3.12+, Node.js 20+, uv, AWS credentials with Bedrock model access.

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

Demonstrates Strands Agents SDK with AG-UI protocol and CopilotKit:
- Frontend tool calls (notifications, interactive quizzes)
- Shared state with useCoAgent (learning checklist)
- Generative UI (custom rendering for search results)
- Local markdown knowledge base for RAG-style retrieval
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.

1 participant