In this guide, you will learn how to build a frontend for your Agent Development Kit (ADK) Agents using AG-UI Protocol and CopilotKit. ADK will power the AI agents backend, while CopilotKit powers the frontend, and then AG-UI creates a bridge that enables the frontend to communicate with the backend.
This is essentially a quickstart guide to help you get started fast, and to see how the agent <> user pieces fully fit together.
Before we jump in, we want to give a special shoutout to Mark Fogle and Syed Fakher for initially building the ADK/AG-UI integration. With that said, here is what we will cover:
Here is a preview of what you can build when you bring your ADK agent to the frontend using AG-UI + CopilotKit.
Agent Development Kit (ADK) is an open-source framework designed to simplify the process of building complex and production-ready AI agents.
Out of the box, ADK equips your AI agents with:
With ADK, you can go from an idea into a working prototype within hours, while maintaining complete flexibility to extend and customize your AI agent.
If you want to dive deeper, check out the ADK docs.
Now that you have learned about ADK, let's see how to use it together with AG-UI and CopilotKit to build full-stack AI agents.
To fully understand this tutorial, you need to have a basic understanding of React or Next.js
We'll also make use of the following:
Check out the CopilotKit ⭐️ GitHub
In this section, you will learn how to set up a full-stack ADK agent using a CLI command that sets up the backend using AG-UI protocol and the frontend using CopilotKit. This flow is fully covered in the Getting Started guide within the CopilotKit docs.
Let’s dive in.
If you don’t already have an ADK agent, you can set up one quickly by running the CLI command below in your terminal.
Then give your project a name as shown below.
Once your project has been created successfully, install dependencies using your preferred package manager:
After installing the dependencies, create a .env
file in the root folder and add your [Gemini API key].(https://makersuite.google.com/app/apikey)
Then start the development server using your preferred package manager:
Once the development server is running, navigate to http://localhost:3000/ and you should see your ADK + AG-UI + CopilotKit agent up and running.
Congrats! You've successfully integrated an ADK Agent chatbot into your application. To start, try the provided tools to set the web page theme, write proverbs, or get the weather, as shown below.
In this section, you will learn how your ADK agent is integrated with the AG-UI protocol and exposed to the frontend as an ASGI application.
Let’s jump in.
To get started, install the AG-UI ADK package together with other necessary dependencies, such as FastAPI and uvicorn, in order to use them to run your ADK agent.
Once you have installed the AG-UI package, configure your ADK agent by defining the agent name, specifying Gemini 2.5 Flash as the Large Language Model (LLM), and defining the agent’s instructions, as shown below in the ./agent.py
file.
After configuring your ADK agent, create an ADK middleware agent instance that wraps your ADK agent to integrate it with AG-UI protocol, as shown below in the ./agent.py
file.
Once you have created an ADK middleware agent instance, configure a FastAPI endpoint that exposes your AG-UI wrapped ADK agent to the frontend.
Congrats! You've successfully integrated your ADK Agent and AG-UI protocol, and it is available at http://localhost:8000 (or specified port) endpoint. Let’s now see how to add a frontend to your AG-UI wrapped ADK agent.
In this section, you will learn how to add a frontend to your ADK + AG-UI agent using CopilotKit, which runs anywhere that React runs.
Let’s get started.
To get started, install the latest packages for CopilotKit into your frontend.
Once you have installed CopilotKit packages, set up the Copilot runtime instance with an HttpAgent instance in the /api/copilotkit
API route that enables your frontend to make HTTP requests to the backend.
After setting up a Copilot Runtime instance, set up the CopilotKit provider component that manages your ADK agent sessions.
To set up the CopilotKit Provider, the [<CopilotKit>](https://docs.copilotkit.ai/reference/components/CopilotKit)
component must wrap the Copilot-aware parts of your application.
For most use cases, it's appropriate to wrap the CopilotKit provider around the entire app, e.g., in your layout.tsx
file.
Once you have set up the CopilotKit Provider, set up a Copilot UI component that enables you to interact with your ADK agent. CopilotKit ships with several built-in chat components, which include CopilotPopup, CopilotSidebar, and CopilotChat.
To set up a Copilot UI component, define it alongside your core page components, e.g., in your page.tsx
file.
After setting up a Copilot UI component, sync your ADK agent state with the frontend using CopilotKit hooks.
To sync your ADK agent state with the frontend, use the CopilotKit useCoAgent hook that allows you to share state bidirectionally between your application and the agent.
To render your agent's state, progress, outputs, or tool calls with custom UI components in real-time, you can use tool-based Generative UI.
Then try asking the agent to get the weather for a location. You should see the custom UI component that we added to render the get weather
tool call and display the arguments that were passed to the tool.
Once you have synced your ADK agent state with the frontend, stream your ADK agent responses or results in the frontend.
To stream your ADK agent responses or results in the frontend, pass the agent’s state field values to the frontend components, as shown below.
If you query your ADK agent, you should see the agent’s response or results streaming in the UI, as shown below.
In this guide, we have walked through the steps of building a frontend for your ADK agent using AG-UI protocol and CopilotKit.
While we’ve explored a couple of features, we have barely scratched the surface of the countless use cases for CopilotKit, ranging from building interactive AI chatbots to building agentic solutions—in essence, CopilotKit lets you add a ton of useful AI capabilities to your products in minutes.
Hopefully, this guide makes it easier for you to integrate AI-powered Copilots into your existing application.
Follow CopilotKit on Twitter and say hi, and if you'd like to build something cool, join the Discord community.
Subscribe to our blog and get updates on CopilotKit in your inbox.