What if you could build a personality-driven quiz for your website not by writing JavaScript, but by giving an AI one instruction: “Analyze these blog posts and generate a 5-question quiz with the vibe of a 90s tech zine.” That’s not a hypothetical. Google engineers did exactly this to promote I/O 2026.
The same technique, running on Gemini 3.5 in Google AI Studio, is available to you right now for free. This tutorial walks you through setting up a functional, API-ready AI agent without deep engineering. We will also cover the three failure modes that break most attempts before they ship.
From Chatbot to Agent: What the Term Actually Means Here
The term “AI agent” often conjures images of fully autonomous systems. For our purposes, an agent is a system given a persona, a goal, explicit instructions, and bounded source data to complete a multi-step task. This is not a self-directed entity, but a directed one. It executes a specific workflow.
The I/O quiz is a prime example. The agent was instructed to analyze content and produce a structured output (the quiz) with a specific tone. This process requires more than a simple chat prompt. It relies on specific technical properties of the underlying model.
Gemini 3.5 is well-suited for this kind of agentic work. It offers a 2-million-token context window, allowing it to process vast amounts of source material. It also handles multimodal input, meaning it can understand text, images, and video. Crucially, its native, more reliable function calling ensures structured, API-ready output, and enables integration with external tools. These features let a non-engineer build complex logic directly into the prompt.
Build It: The Vibe-Based Quiz Generator, Step by Step
Let’s build that quiz generator in Google AI Studio. This process will give you a working prompt you can copy and adapt for your own needs. We will focus on the System Instructions, structured prompt, and explicit JSON output enforcement.
First, navigate to Google AI Studio. Create a new “Freeform” prompt. We will use the System Instructions panel to define the agent’s core behavior.
System Instructions Setup
Enter the following text into the System Instructions panel. This defines the agent’s persona and core rules:
You are a highly creative content analyst and quiz generator. Your task is to analyze provided source material and generate a multiple-choice quiz. The quiz must reflect the tone and specific facts from the source material.
Ensure all questions are directly derivable from the provided SOURCE MATERIAL. Do NOT invent facts.
This instruction sets the stage. It gives the AI a role and a clear primary directive. The negative constraint is critical, as we will see later.
Structured Prompt Design
Next, we construct the main prompt in the chat input area. This prompt uses labeled sections to guide the model. This structure makes the task explicit and helps enforce boundaries.
---SOURCE MATERIAL---
<PASTE YOUR SOURCE MATERIAL HERE>
---TASK---
Generate a 5-question multiple-choice quiz based on the provided SOURCE MATERIAL. Each question should have 4 options, with one correct answer. The quiz should have the vibe of a 90s tech zine: quirky, slightly irreverent, and full of insider references.
---OUTPUT FORMAT---
Respond ONLY with valid JSON. Do not include any conversational text or markdown outside the JSON block.
The JSON should adhere to the following schema:
{
"questions": [
{
"question_text": "string",
"options": [
"string",
"string",
"string",
"string"
],
"correct_answer_index": "integer (0-3)",
"explanation": "string"
}
]
}
Replace <PASTE YOUR SOURCE MATERIAL HERE> with the text you want the quiz based on. For example, you could use a blog post about early internet culture or a product announcement. The ---OUTPUT FORMAT--- section is non-negotiable for agentic workflows. It forces the model to produce machine-readable data.
Enforcing JSON Output
The line “Respond ONLY with valid JSON. Do not include any conversational text or markdown outside the JSON block” is a hard constraint. This tells Gemini 3.5 to skip the usual chat pleasantries. It ensures the output is immediately usable by an API.
In a production system, you still need client-side JSON parsing with error handling. A retry loop for malformed JSON is a common pattern. Do not assume the model will never make a mistake, even with strict instructions. Plan for failure in your code.
The Messy Middle: What Goes Wrong and How to Fix It
Your first run will likely not be the final run. This is where prompt iteration becomes debugging. Let’s look at a specific, realistic failure: hallucination.
Imagine you run the quiz generator. You provide a blog post about the history of modems. The quiz comes back, and one question asks: “What was the baud rate of the first quantum entanglement modem?” This question is not grounded in your source material. It is a hallucination.
This is a common issue with LLMs. They can generate plausible-sounding but entirely fabricated information. For customer-facing or decision-critical applications, this is unacceptable.
To fix this, we refine our System Instructions. We already included a negative constraint, but we need to make it more specific. The corrective addition looks like this:
You are a highly creative content analyst and quiz generator. Your task is to analyze provided source material and generate a multiple-choice quiz. The quiz must reflect the tone and specific facts from the source material.
Ensure all questions are directly derivable from the provided SOURCE MATERIAL. Do NOT invent facts. **If a fact is not present in the source material, do not include it in a question or explanation.**
The bolded sentence adds a stronger, more explicit negative constraint. It tells the model what not to do when it encounters missing information. This iterative refinement of instructions, based on observing model output, is a core part of agent development. It turns abstract prompt engineering into concrete problem-solving.
Three Agentic Workflows to Build This Week
The quiz generator demonstrates the core principles. Now, let’s generalize this technique to three business applications. Each uses Gemini 3.5’s capabilities for multi-step logic and structured output.
1. Customer Inquiry Triage
Agentic Mechanic: Multi-step conditional logic and categorization. Workflow: An agent analyzes incoming customer support emails. It identifies the product, issue type, and customer sentiment. Based on this, it categorizes the email as “Urgent Bug,” “Feature Request,” or “General Inquiry.” It then extracts key details.
Integration Note: The structured JSON output (e.g., {"category": "Urgent Bug", "product": "Analytics Dashboard", "sentiment": "negative", "summary": "User cannot export data."}) can be sent directly to a CRM or helpdesk system via its API. Google AI Studio’s “Get Code” feature provides boilerplate for this.
2. Social Media Content Adaptation
Agentic Mechanic: Multi-output adaptation and persona-driven content generation. Workflow: An agent takes a long-form blog post as input. It then generates three distinct social media posts: one for LinkedIn (professional, data-driven), one for X (concise, engaging, hashtag-heavy), and one for Instagram (visual-focused caption with emojis). Each output adheres to platform-specific constraints.
Integration Note: The structured output, containing the posts for each platform, can be directly fed into a social media scheduling tool like Buffer or Hootsuite using their respective APIs.
3. Competitive Research Analysis
Agentic Mechanic: Layered reasoning and data extraction from unstructured text. Workflow: An agent ingests multiple competitor reports or news articles. It extracts key product features, pricing changes, and market positioning statements. It then synthesizes this information into a structured comparison table. Finally, it identifies potential threats and opportunities.
Integration Note: The structured comparison table and insights, also in JSON, can be pushed into a project management tool like Notion or a communication platform like Slack. This keeps teams updated with actionable intelligence.
The Fine Print: Cost, Limits, and the Path to Production
Google AI Studio is free for prototyping and experimentation. This allows you to build and test your agents without upfront cost. This is a significant advantage for solopreneurs.
When you move to API usage, Gemini 3.5 has a clear pricing structure. Processing approximately 5,000 words (roughly 7,000 tokens) costs less than a penny. This makes it highly cost-efficient for many small-scale automations and product features. Pricing scales linearly with token usage, so large-context applications will cost more. Always monitor your API usage.
However, there are three architectural limitations you will hit when moving beyond prototyping. Understanding these is crucial for production.
First, statelessness. The base Gemini 3.5 model does not retain memory of past interactions. If your agent needs conversation history or relevant user data, you must pass it back into the prompt each turn. This state management is typically handled in your application layer, not by the model itself.
Second, no native internet access. The base model cannot browse the internet in real-time. If your agent needs current information (e.g., live stock prices, breaking news), it must use Function Calling to an external search API. Google Search API is a common choice. This allows the agent to retrieve real-time data and inject it into its context.
Third, and we’ve already touched on this, hallucination risk. While prompt engineering reduces it, no LLM is entirely immune. For any customer-facing or decision-critical output, human-in-the-loop review is non-optional. Build review steps into your workflow. This mitigates the risk of incorrect or misleading information reaching your users or influencing critical decisions.
See More
- Gemini Enterprise Agent Platform: Explore Google’s enterprise platform for managing and deploying AI agents at scale, offering more robust tooling for complex systems.
- Function Calling with Gemini: Learn how to integrate external tools and APIs into your Gemini agents for expanded capabilities like real-time data retrieval or database interactions.
- Monitoring LLM Outputs: Understand strategies and tools for observing, evaluating, and improving the quality of your AI agent’s outputs over time.