Skip to content

feat: integrate CopilotKit with AG-UI LangGraph for generative UI and tool support#63

Open
tylerslaton wants to merge 3 commits intoawslabs:mainfrom
CopilotKit:feat/fix-followup-after-frontend-tools
Open

feat: integrate CopilotKit with AG-UI LangGraph for generative UI and tool support#63
tylerslaton wants to merge 3 commits intoawslabs:mainfrom
CopilotKit:feat/fix-followup-after-frontend-tools

Conversation

@tylerslaton
Copy link

@tylerslaton tylerslaton commented Mar 20, 2026

Summary

Integrates CopilotKit with the LangGraph single-agent pattern to enable generative UI, frontend tool calls, shared state (Canvas/Todos), and human-in-the-loop interactions.

Preview

A deployed version of the stack is available here:
https://main.d3pq26xcsy7ipt.amplifyapp.com/

copilotkit-starter.mp4

Scope and review guide

The diff shows ~17k lines but ~15k of that is lockfile churn (package-lock.json, uv.lock). The actual code changes are ~2,250 lines across 52 files, split across three self-contained layers that each need the others to work end-to-end.

The PR is organized into 3 commits, one per layer:

1. Agent layer — patterns/langgraph-single-agent/ (~400 lines)

Commit: 6878c1f — start here

The core integration point. langgraph_agent.py is the main file — it wires CopilotKitMiddleware and LangGraphAGUIAgent into the existing agent. Three new tools are added under tools/: query_data (reads a financial CSV), manage_todos, and get_todos. Unit tests in tests/unit/test_tools.py.

2. Frontend — frontend/src/ (~1,300 lines)

Commit: b191118

  • CopilotChatInterface.tsx — the new chat component, drop-in alongside the existing ChatInterface
  • components/generative-ui/PieChart, BarChart, MeetingTimePicker, ToolReasoning — UI components the agent can render inline
  • components/canvas/TodoCanvas/TodoCard/TodoColumn/TodoList — shared-state canvas synced with the agent's todos
  • hooks/useCopilotExamples (registers example prompts), useTheme (light/dark mode)
  • Tests in frontend/src/test/

3. Infrastructure — infra-cdk/ + infra-terraform/ (~500 lines)

Commit: 8707c68

Adds a CopilotKit Lambda runtime to both CDK and Terraform stacks. The CDK Lambda is in infra-cdk/lambdas/copilotkit-runtime/. Terraform equivalent in infra-terraform/modules/backend/copilotkit_runtime.tf. Config and SSM parameter wiring in supporting files.

What's included

Agent (patterns/langgraph-single-agent/)

  • Wires CopilotKitMiddleware and LangGraphAGUIAgent into the LangGraph agent
  • Adds query_data tool (financial CSV data), manage_todos/get_todos tools, and AgentState with todos field
  • Extends LangGraphAGUIAgent to resolve actor identity from JWT or forwarded props

Frontend (frontend/)

  • CopilotChat — CopilotKit-powered chat with generative UI support
  • Generative UI components: PieChart, BarChart, MeetingTimePicker, ToolReasoning
  • TodoCanvas — shared state canvas synced with agent state
  • Theme support and example suggestions

Infrastructure

  • CopilotKit Lambda runtime added to CDK and Terraform stacks

tylerslaton and others added 3 commits March 20, 2026 17:05
…ative UI

- Wire CopilotKitMiddleware and LangGraphAGUIAgent into the LangGraph agent
- Add query_data tool with sample financial CSV for generative chart UI
- Add manage_todos/get_todos tools and AgentState with todos field for shared state
- Add Excalidraw MCP middleware and suggestion
- Add unit test infrastructure for agent tools

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
…onents

- Add CopilotChatInterface powered by CopilotKit with generative UI support
- Add PieChart and BarChart for financial data visualization
- Add ToolReasoning default tool renderer
- Add MeetingTimePicker for human-in-the-loop interactions
- Add TodoCanvas with TodoCard/TodoColumn/TodoList for shared agent state
- Add useCopilotExamples hook consolidating all CopilotKit registrations
- Add ThemeProvider and useTheme hook with light/dark mode toggle

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
- Add CopilotKit Lambda runtime to CDK and Terraform stacks
- Add SSM parameters and outputs for CopilotKit runtime URL
- Update frontend deployment scripts to include CopilotKit runtime config

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
@tylerslaton tylerslaton force-pushed the feat/fix-followup-after-frontend-tools branch from 0a6b570 to 8707c68 Compare March 21, 2026 00:07
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.

1 participant