A tutorial demonstrating how to implement structured output using Google's ADK (Agent Development Kit) framework. This example uses an email generator agent to show how to create type-safe, structured responses with Pydantic schemas and Gemini 3 Flash model.
Sign in to save downloads to your library and vote.
Preview
๐ง Email Generation Agent with Structured Output
A tutorial demonstrating how to implement structured output using Google's ADK (Agent Development Kit) framework. This example uses an email generator agent to show how to create type-safe, structured responses with Pydantic schemas and Gemini 3 Flash model.
Tutorial Features
-
๐ Structured Output Implementation:
- Learn how to use Pydantic schemas for type-safe output
- Understand how to define structured response formats
- See how Google ADK handles structured responses
-
๐ฏ Email Generator Example:
- Practical example using email generation as the use case
- Shows how to create professional email content with proper structure
- Demonstrates real-world application of structured output
-
๐ง Google ADK Best Practices:
- Simple agent definition with clear instructions
- Proper use of output schemas for reliable results
- Minimal codebase demonstrating core concepts
๐ Getting Started
-
Set up your environment:
cd 3_2_email_agent # Copy the environment template cp env.example .env # Edit .env and add your Google AI API key # Get your API key from: https://aistudio.google.com/ -
Install dependencies:
# Navigate back to the directory cd .. # Install required packages pip install -r requirements.txt -
Run the Agent
# Start the ADK web interface adk webThen:
- Open the web interface in your browser
- Select the "email_generator_agent"
- Enter your email request (e.g. "Write a professional email to schedule a meeting with a client")
- The response will be a structured JSON with subject and body fields
Tutorial Overview
This tutorial demonstrates structured output implementation in Google ADK:
- Agent Definition: Learn how to create a
LlmAgentwith Gemini 3 Flash - Output Schema: Understand how to use Pydantic models for structured responses
- Instructions: See how to write clear prompts for structured output
- Structured Response: Learn how to handle JSON responses with defined schemas
Code Structure
agent.py: Contains the main agent definition and Pydantic schema__init__.py: Module initialization for easy imports
Dependencies
google-adk: Google's Agent Development Kitpydantic: Data validation and settings management
How Structured Output Works
This tutorial shows how Google ADK handles structured output:
- Input Processing: Takes natural language requests and processes them through the agent
- Content Generation: Uses Gemini 3 Flash to generate content based on instructions
- Output Structuring: Automatically formats responses according to the Pydantic schema
- Response Validation: Ensures the output matches the defined structure and types
This approach demonstrates how to create reliable, type-safe responses in Google ADK applications.
Ingestion metadata
- Source catalog
- awesome-llm-apps
- Repository
- Shubhamsaboo/awesome-llm-apps ยท main
- File path
- ai_agent_framework_crash_course/google_adk_crash_course/3_structured_output_agent/3_2_email_agent/README.md
- Last refreshed
- 7/24/2026, 3:00:13 AM (52m ago)
- Refresh schedule
- Daily ยท 03:00 UTC
- Dedupe status
- Unique ยท deduped by (source, url)