How to Build and Test an AI Agent with Gemini

TL;DR
Build an AI agent by using Gemini CLI to generate code, ADK to define its logic and tools, and project-level instructions to constrain its behavior. Connect external services through MCP servers, protect changes with version control, evaluate tool selection against predefined cases, automate those checks with pytest, and deploy the tested agent to Cloud Run.
Transcript
BUILD AN AI AGENT WITH GEMINI CLI AND ADK Welcome to the Agentverse, champions! In this series, we're assembling a team of specialists: a developer, a data engineer, a platform engineer, and an architect. Each of you will embark on your own quest, mastering unique tools and skills. But, in the end, we must all unite to defeat the final boss, AKA bu... Read More
Key Insights
- Gemini CLI is a terminal-based AI assistant that converts natural-language intent into development actions. In the demonstration, it creates HTML and CSS files, starts a Python web server, modifies the website, and coordinates operations across connected external tools.
- The YOLO flag authorizes Gemini CLI to execute actions without requesting confirmation. The presenter describes it as useful in a lab or non-production environment and explicitly recommends caution when considering the same unrestricted execution behavior elsewhere.
- Model Context Protocol servers are portals through which an AI system can interact with external tools and services. The demonstrated connections let Gemini CLI manage a Gitea repository, track issues, generate an image with Imagen, and incorporate that asset into the website.
- Version control is a safeguard against unwanted AI-generated changes. The workflow creates a Gitea repository, commits the initial website, records the missing profile picture as an issue, commits the completed update, and closes the issue after verification.
- Context engineering supplies instructions to an LLM at multiple levels. The source identifies system prompts, short-term context such as conversation history or design documents, and long-term guidance such as policies, style guides, coding standards, and guardrails.
- GEMINI.md is a persistent project-level rulebook that Gemini CLI automatically searches for and loads into working memory. The demonstrated file specifies Python practices involving type hints, docstrings, naming conventions, and dependency management.
- The ADK agent uses an MCPToolset to connect with tools exposed by a custom MCP server. Functions decorated with ADK's mcp.tool() decorator become available to the agent, and the presenter verifies that seven newly requested weapon tools were added correctly.
- Agent evaluation tests more than textual output by checking whether the agent selects appropriate tools. The workflow uses an evalset.json challenge set, test_config.json judging criteria, ADK evaluation, generated synthetic data, and pytest automation within a continuous integration pipeline.
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: How do you build an AI agent with Gemini CLI and ADK?
Start by creating clear project instructions and a technical blueprint, then use Gemini CLI to generate the agent's core code from natural-language prompts. Build the agent with ADK, connect its tools through an MCPToolset and a custom MCP server, inspect the generated functions, evaluate behavior against predefined cases, automate the checks with pytest, and deploy the tested agent to Cloud Run.
Q: How does Gemini CLI support vibe coding?
Gemini CLI accepts natural-language descriptions of the desired result, determines a sequence of actions, and performs development work from the terminal. In the demonstrated workflow, it creates index.html and styles.css, starts the website with Python's built-in web server, modifies the page to include a generated image, manages repository operations, and helps create agent code and automated tests.
Q: What does the YOLO flag do in Gemini CLI?
The YOLO flag tells Gemini CLI that it may execute actions on the user's behalf without asking for confirmation. This reduces interruptions during the demonstrated vibe-coding workflow. The presenter says it is suitable for a lab or non-production environment, while also warning viewers to use caution when applying the flag in other settings because actions proceed without individual approval.
Q: What is an MCP server used for in this workflow?
An MCP server provides a connection between the AI system and an external tool or service. The workflow connects Gemini CLI to Gitea so it can create a repository, commit files, push changes, and manage an issue. A separate MCP connection provides access to Imagen for generating a profile picture, while the agent's custom MCP server exposes callable weapon functions.
Q: How is version control used with AI-generated code?
Version control preserves known states so developers can recover when AI-generated changes do not work as intended. The demonstration connects Gemini CLI to a local Gitea server, creates the shadowblade-profile repository, commits and pushes the website files, logs the missing picture as an issue, and commits the completed update after visually verifying the revised website.
Q: How does GEMINI.md create guardrails for an AI agent?
GEMINI.md stores persistent project-level instructions that Gemini CLI automatically finds and loads into its working memory. In the demonstration, it serves as a long-term rulebook containing Python coding practices for type hints, docstrings, naming conventions, and dependency management. These guidelines complement the agent_design.md blueprint and help constrain implementation before substantial development effort is invested.
Q: How do ADK evaluations test an AI agent?
The adk eval command runs the agent against a golden dataset of predefined challenges plus generated synthetic data. The evalset.json file defines the cases that represent expected missions, while test_config.json specifies how performance should be judged. A central evaluation criterion is whether the agent chooses the correct tools, allowing the workflow to validate its operational logic rather than only its prose.
Q: How can AI agent evaluation be automated in CI?
The manual ADK evaluation can be converted into an automated pytest check that uses the same AgentEvaluator library as the adk eval command. Gemini CLI generates the test file so evaluations run whenever changes pass through the continuous integration pipeline. The test examines the agent's output for evidence that its logic behaves correctly before the agent proceeds toward deployment on Cloud Run.
Summary & Key Takeaways
-
Gemini CLI turns natural-language instructions into executable development actions. The demonstration uses it to create a dark-themed profile website, start a Python web server, revise the page, and coordinate work across connected services. The YOLO flag permits execution without confirmation, but the presenter recommends caution outside labs or non-production environments.
-
MCP servers extend Gemini CLI beyond code generation. A Gitea connection enables repository creation, commits, pushes, and issue tracking, while an Imagen connection generates a pixel-art profile picture and stores it in a bucket. Gemini then modifies the website to use the image and closes the tracked issue after completion.
-
The agent is built with ADK under project-level guardrails stored in GEMINI.md and a design blueprint in agent_design.md. Its custom MCP server exposes callable tools, including seven added weapon functions. ADK evaluation checks behavior and tool selection, pytest automates the evaluation for CI, and the completed agent is deployed to Cloud Run.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Google Cloud Tech 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator