Lesson 1 of 6
What Is a Google Gemini AI Agent?
On this page
- What you will learn
- Gemini in plain language
- A chat reply versus an agent
- The four parts of your agent
- Who does what: the most important idea in the course
- What you will build and what you will not
- Reusable prompt
- Expected output
- Common errors and fixes
- Validation checklist
- Hands-on exercise
- Knowledge check
- References
You have probably used an AI chat window: you type a question, a model replies. That is useful, but the reply only contains words. It cannot look up your order, check a stock level or read a file, because the model has no access to your systems.
An AI agent closes that gap. In this course you will build a small one with Google Gemini: a helper for a fictional bookshop, Lantern Lane Books, that answers shop questions and looks up the status of sample orders. This first lesson has no code to run. It gives you the vocabulary and the mental picture that every later lesson relies on, so the code in lessons 3 to 6 reads as plain common sense rather than magic.
PromptFable is independent. It is not affiliated with or endorsed by Google, and Gemini and Google AI Studio are products of their owners. Everything here is written from the public documentation, which changes; each lesson links the official page to check.
What you will learn
- Explain Gemini and an AI agent in everyday language.
- Compare a plain chat reply with the behaviour of an agent-style application.
- Name the four parts of the course project: the model, the instructions, the function and the application.
- Describe who does what when Gemini asks for a function to be run.
Before you start
- No AI experience is needed.
- Basic familiarity with reading short Python programs. You will install Python in lesson 3 if you do not already have it.
- Curiosity about how an assistant can use real data.
Gemini in plain language
Gemini is the name of Google's family of AI models. A model is a very large mathematical system that has learned patterns from enormous amounts of text, images and other data. Given some input, it produces the output that best fits those patterns. For text, that means it predicts a sensible continuation of what you wrote, which is why it can answer questions, summarise, translate and draft.
You can reach Gemini in two broad ways. Google AI Studio is a web workspace where you try models and create API keys, and the Gemini API lets your own program send a request and receive a response. This course uses the API, because an agent is a program you write. Lesson 2 explains the setup.
Two limits matter from the start. First, a model knows only what it learned during training plus whatever you put in the request. It does not know today's orders for Lantern Lane Books. Second, a model can state wrong things confidently. Both limits are the reason agents exist: you give the model reliable data and clear rules rather than hoping it guesses.
- Model
- The Gemini system that reads your request and writes a response. You choose one by name.
- Prompt
- The text you send to the model, including the question and any context.
- API
- A way for one program to ask another for something. The Gemini API lets your program ask a Gemini model for a response.
- SDK
- A software development kit: a library that makes API calls easier. Google's official one is called the Google Gen AI SDK.
A chat reply versus an agent
Imagine a customer types: "Where is order LL-2071?" Compare two ways of answering.
| Plain chat response | Agent-style application | |
|---|---|---|
| What the model can use | Only the words in the conversation and what it learned in training. | The conversation plus results from functions your program offers. |
| Answer to "Where is LL-2071?" | It has no order data, so it should say it cannot know. A careless model might invent a plausible status. | The application looks up the order in its data and gives Gemini the real record to explain. |
| Who decides what runs | Nothing runs. It is only text. | Gemini can request a function; your code decides whether to run it. |
| Risk | Confident but ungrounded answers. | Wrong or unsafe function calls, which is why you validate them. |
So in this course an agent is simple: an application that uses a model to decide what to do next, and can call functions to fetch information or act, in a loop, until it has an answer. Some people reserve the word for very autonomous systems. Ours is deliberately small, because a small agent you fully understand is better to learn from than a large one you do not.
The four parts of your agent
Every agent in this course has the same four parts. Learn to point at each one in the code; it makes debugging much easier.
- The model. A Gemini model chosen by name, such as the one you will set in a single constant in lesson 3. It reads the conversation and writes the next reply, or asks for a function.
- The instructions. A block of text, called a system instruction, that tells the model its job, its boundaries and its tone. For Lantern Lane Books it also contains the shop's frequently asked questions, so shop questions are answered from the instructions alone.
- The function. One piece of your own code,
get_order_status(order_id), that looks up an order in sample data. It is read-only: it can look, never change. - The application. The Python program,
agent.py, that connects the other three. It sends requests, receives Gemini's reply, validates any function request, runs the function and sends the result back.
- User asks
"Where is order LL-2071?"
- Application sends
Question, instructions and the function description go to Gemini.
- Gemini requests
It replies with a function name and arguments, not an answer.
- Application runs
Your code validates the arguments and runs get_order_status.
- Application returns the result
The order record goes back to Gemini.
- Gemini answers
It writes a friendly reply based on the record.
Gemini never reaches into your program. Everything in the middle column happens in your code.
Who does what: the most important idea in the course
When people first hear "the AI can call a function", many picture the model reaching into their computer and running code. That is not what happens. Gemini only produces a structured message that says, in effect, "please call get_order_status with order_id LL-2071". Your program reads that message and decides what to do. It might run the function. It might refuse because the argument looks wrong. It might ask a human first.
This is the reason the course keeps repeating one rule: the model proposes, your application disposes. The function runs in your Python process, with your permissions, and only if your code chooses to run it. That is also why the safety work in lesson 6 sits in your code, not in a clever sentence in a prompt.
A second consequence is cost and speed. Every round trip between your program and Gemini is a separate API request. An order question needs two: one that ends with a function request and one that carries the result back. You will see this in lesson 5.
What you will build and what you will not
The guided project is the Lantern Lane Books order helper, in a folder called gemini-order-helper. It answers a handful of shop questions from a short FAQ you paste into the instructions, and checks order status using one read-only function and a small file of invented orders. The data contains no real customers and no personal details.
- It does not change anything. There is no cancelling, refunding or emailing.
- It does not connect to a real database or shop system.
- It runs in your terminal on your own machine, so the API key never reaches a web page.
- It is a learning project. Before any real use you would need testing, monitoring and review, which a short course cannot cover.
| Lesson | You add |
|---|---|
| 2 | A Google AI Studio account, an API key and a safe place to keep it. |
| 3 | A working project, the SDK and your first request. |
| 4 | A system instruction with the shop FAQ and clear boundaries. |
| 5 | The order function and the manual request loop. |
| 6 | Validation, error handling, a confirmation pattern and a final test pass. |
Reusable prompt
Explain it back
Check your understanding by asking an assistant to critique your own explanation of an agent.
I am learning to build an AI agent. In my own words: an agent is an application that sends a question to a language model, lets the model ask for a function to be run, runs that function in my own code after checking it, and sends the result back so the model can answer. Please tell me what I have right, what I have missed, and one common misunderstanding beginners have about function calling. Keep it under 150 words.Show the reusable template
Replace each {{placeholder}} with your own details.
I am learning to build an AI agent. In my own words: {{your_explanation}}. Please tell me what I have right, what I have missed, and one common misunderstanding beginners have. Keep it under 150 words.Expected output and limitations
A short reply that confirms the request-and-return loop, notes that the model does not execute code itself, and may add points such as validation, limits on repeated calls or keeping data private.
You have the loop right: the model proposes a call, your code runs it and returns the result.
Missing: validating the arguments before running anything, and limiting how many times the loop can repeat.
Common misunderstanding: thinking the model runs the function itself. It only produces a request; your program executes it.Limitations to keep in mind
- Replies vary between runs and between models; do not expect this exact wording.
- The assistant may add detail that is true in general but not part of this course. Check it against the official documentation.
Common errors and how to fix them
Believing Gemini will run my Python function for me.
Why it happens: The phrase "function calling" sounds like the model makes the call.
Fix: Remember that Gemini returns a request containing a name and arguments. Your own code receives it, validates it and runs the function. Lesson 5 shows each step.
Expecting a chat subscription to be the same thing as API access.
Why it happens: Both involve Gemini and a Google account.
Fix: Using a consumer chat product and calling the API from code are separate routes. Lesson 2 covers what you need for the API and why limits and billing can differ.
Making the agent too ambitious before the basics work.
Why it happens: It is tempting to add refunds or email early.
Fix: Keep this project read-only. Consequential actions need validation and human approval, which lesson 6 introduces as a pattern.
Validation checklist
Tick each item once you have confirmed it.
Hands-on exercise
Sketch your agent on paper
Draw the four parts of the Lantern Lane Books agent as boxes. Draw arrows for one order question and label each arrow with what travels along it. Then pick a different small business and decide what its one read-only function would be.
You will need
- Paper or a notes app.
- The flow diagram in this lesson as a reference, which you should not copy but redraw from memory.
Acceptance criteria
Your work is done when every one of these is true.
Hints (2)
- Count the arrows between the application and Gemini for an order question. There are two requests.
- Good read-only functions fetch a record by an ID, such as a booking, a parcel or a library loan.
Show a model answer
A strong sketch shows the user talking to the application, the application talking to Gemini twice for an order question, and the function box connected only to the application and a data store. For a bicycle repair shop, the function might be get_repair_status(job_id). It should check that the ID has the expected format and that the job exists before returning anything.
Knowledge check
Choose an answer, then check it. Nothing is recorded — this is for you.
Show the answer and explanation
Answer: B. Your application runs it, in your own process. Gemini only returns a request with the function name and arguments. The first option is tempting because the phrase function calling suggests the model does the calling, but the model has no access to your code.
Show the answer and explanation
Answer: B. The agent can look up real data through a function and let the model explain it. The first option is wrong because the model cannot know fictional order data from training, and that is the very gap functions fill.
Show the answer and explanation
Answer: B. The system instruction is text that sets the model's role and rules. The function is a separate part, and the key is a credential kept outside the instructions entirely.
- Written by
- PromptFable Editorial
- Last updated 13 Nov 2026
- Review
- Reviewed by Waseem Nadir, Technical Reviewer
- Last reviewed 27 Nov 2026
References
Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.
- Gemini API documentation home(opens in a new tab)
Google · Official documentation · Check here for current models, SDKs and interfaces.
- Function calling with the Gemini API(opens in a new tab)
Google · Official documentation
- OWASP Top 10 for LLM Applications(opens in a new tab)
OWASP · Official documentation · Background on treating model output as untrusted.
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.