Vibe coding your way to Agentic AI
If someone told me that “vibe coding” would be a thing someday, I would have laughed it away. But, here we are. Agentic AI is already starting to change the way we interact with AI. One can think of vibe coding as an “agentic” way of developing software. Let’s see how one can “vibe code” an Agentic AI application.
Tools of the Trade
No pun intended, here are the developer tools one could use.
- The Cloud Editor in Google Cloud Shell. This editor is similar in look and feel to VS Code. So, the application development can now happen entirely in the cloud, without installing anything on the laptop.
- Install the Roo Code extension in the Cloud Shell Editor and configure it to use Gemini 2.0 Flash. You will have to create an API Key and set it up, as shown below.
- Lastly, we will use Google Agent Development Kit (ADK) framework to create an agentic application.
Once the Roo extension is installed, developer can use it in different modes such as - Architect, Code, Ask, Debug etc.
For example, in the example below, I "asked" Roo/Gemini 2.0 Flash to analyze unused imports in the code.
Beyond suggestions, I also used Roo/Gemini 2.0 to write the code and update the README.md. You can see the generated agent code at GitHub. The steps to install, test and deploy the app are in the same GitHub repository.
- Hand Coded by Me
- Overall agent skeleton code
- call_code_agent
- call_web_search
- Dockerfile
- Flask App
- Vibe Coded by AI
- get_exchange_rate
- get_historical_exchange rate
- get_exchange_rate_trend
- setenv.sh
- run.sh
- deploy.sh
Agentic AI using Google ADK
In this example, we have created a “currency agent” application. This application contains multiple agents and tools. All these agents and tools are leveraging Google ADK. There is no MCP or A2A in this example, that is for another day.
This Agentic AI app can - get current and historical currency exchange rates. In addition, it can perform ad hoc calculations and also search the web to analyse current events.
We can use the Google ADK Web Developer UI to test the Agentic AI application. As you can see in the screenshots, all of the below steps are from a single session. If we want to do this across sessions, we will need a stateful session service. This example uses an in-memory session service provided by Google ADK framework.
1. First, a user starts by asking for the current exchange rate. Due to the free API’s being used, the base currency is always US Dollar (USD).
2. Next, the user asks about the causes of currency fluctuations. This information is retrieved from the web.
3. Now, user is following up with historical exchange rates. Current and historical exchange rates are retrieved using tools, which in turn call APIs.
4. In addition, user can now ask for predictions. This is done by the agent writing python code to arrive at the prediction as well as show visualizations (which was not asked by the user at all). This is the first example of a “agentic ai” where an application understands the context and provides more intelligent answers to the user.
5. Next, is the second example of an “agentic ai” capability, formatting and summarizing data. In this case, it is a synthesis of data that was retrieved from multiple sources -
- Historical data from Currency APIs
- Future predicted exchange rate
- Analysis from the web
6. Here is the third example of “agentic ai” capability, perhaps the most comprehensive. User provides the high level instruction - to create a summary for USD to GBP currency pair. Agent understands the instruction and automatically performs all the steps that were done earlier for the USD to SGD currency pair, without explicit directions from the user.
8. Since the currency-agent application have access to the web, users can also perform adjacent analysis such as impact on stock market because of currency fluctuations.
9. And, combine the currency analysis with the stock market analysis. This is the fourth example of “agentic ai” capability, maintaining context and smartly responding to user requests.
10. Last step is to request for trading recommendations. The Gemini 2.0 Flash model is able to go through the context and provide some insights.
11. Google ADK does a great job at interpreting the multi-modal outputs provided by the various tools and agents. These outputs such as PDF and Images show up as artifacts. These artifacts can be presented to the user as well as used by the ADK framework to pass it as a context to various tools and agents for subsequent processing. In addition, the features like events, memory, session and context ensure that all user interactions are passed to the AI model.
12. The Google ADK Dev UI also enables the developer to visually check the flows and debug each step/interaction.
Design Pattern
Various design patterns will probably emerge on how we build the Agentic AI applications. Based on this example agent, an emerging design pattern could have the following attributes -
- An Agentic AI application is bound by a domain context, in this example it is currency exchange rates.
- The application can have multiple agents and/or tools. Typically, these tools perform tasks that are inter-related within the domain context.
- The tools can be a mix of -
- Ability to query structured data, typically present in a database
- A code interpreter that can perform ad-hoc tasks that do not have to be “hand coded”
- A search capability that is grounded on internal and/or external or unstructured data
- Tools that integrate with internal / external APIs
- Out of box capability for multimodal input and output
- Users start using the application by mainly providing the goals and letting the agent "think" and execute the workflows.
What’s Next
One can use the existing source code of the Currency Agent as a “seed” and let Roo/Gemini 2.0 Flash “vibe code” new agents automatically. More on that, later.
Comments
Post a Comment