Capstone: a real end-to-end Gemini workflow
Let's build one realistic thing end to end: a competitive intelligence assistant that reads your industry every morning, watches your competitors, and drops a grounded briefing into a Google Doc before you finish coffee. We'll make the architecture decisions out loud so you can swap the domain (legal, sales, research, recruiting) and reuse the skeleton.
The point of a capstone is the set of choices, more than the demo: which model tier, where the work runs, how facts stay fresh, and what triggers the whole thing. Get those right and the workflow survives contact with reality.
The scenario and the constraints
The assistant has four jobs every weekday at 7:00 a.m.:
- Pull the latest news and announcements about three named competitors.
- Read any PDFs or slide decks you dropped in a Drive folder yesterday (pricing sheets, analyst reports).
- Synthesize a one-page briefing with sources.
- Append it to a running "Competitive Intel" Doc and email you the highlights.
Constraints that drive the design:
- Facts must be current and citable, not hallucinated. That forces grounding.
- Inputs are mixed: web text, PDFs, images of charts. That forces native multimodality.
- It must run unattended on a schedule. That rules out the chat app as the engine.
- A non-engineer on your team should be able to tweak the prompt. That pushes some logic toward Workspace.
Decision 1: Where does this run?
You have three real homes for Gemini work, and they are not interchangeable.
- The Gemini app and Gems are for interactive use. A Gem is a saved, instructed version of Gemini (think a reusable personapersonaA semi-fictional, research-based representation of your ideal customer: their goals, frustrations, behaviours and decision criteria.View full definition → with standing instructions and files). Great for "ask my research assistant a question," useless as a 7 a.m. cron job because nobody is there to press enter.
- Gemini in Google Workspace runs *inside* Docs, Sheets, Gmail, and Drive. This is where the output lives and where Apps Script can automate it under your Workspace account.
- The Gemini API (via Google AI Studio for prototyping, or Vertex AI for production) is the programmable engine: model calls, grounding, structured output, scheduling.
The clean split for this capstone: Apps Script is the orchestrator and Workspace integration layer; the Gemini API does the heavy reasoning and grounding. Apps Script gives you a built-in scheduler (time-driven triggers), native access to Drive/Docs/Gmail, and a place for teammates to read the prompt. The APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → gives you model control your Workspace UI does not expose, like grounding configuration and JSON schemas.
If this were a larger, multi-step agent with tool use and memory, you would reach for the [Agent Development Kit (ADK)](https://google.github.io/adk-docs/) on Vertex AI instead. We will come back to that line in the sand.
Decision 2: Which model tier?
You have Pro and Flash tiers (currently the Gemini 3 generation). The instinct to use the biggest model everywhere is expensive and slow. Split by task.
- Flash for high-volume, latency-sensitive, "read and extract" work: skimming each news item, pulling key facts from a PDF. Cheap and fast, and the task is not hard reasoning.
- Pro for the final synthesis step: weighing sources, spotting contradictions, writing the briefing. This is one call per day, so paying for the stronger model costs almost nothing and the quality jump matters.
This two-tier pattern (Flash for fan-out, Pro for the final judgment) is the single most useful cost lever in production Gemini work. **Decide tier per *task*, not per *project***.
Model IDs change faster than lessons do. Older 2.5 models are on Google's retirement schedule, so check the models page for the current stable IDs and keep them in one config constant rather than scattered through your code.
Decision 3: How do facts stay fresh?
Training data is stale by definition, so the competitor news step uses grounding with Google Search. Grounding tells the model to issue real searches and return answers tied to live results, with citation metadata you can render as links.
You enable it as a tool on the request. Here is the core synthesis call in Python using the `google-genai` SDK, with search grounding on:
from google import genai
from google.genai import types
PRO_MODEL = "gemini-3-pro-preview" # check the models page for the current ID
FLASH_MODEL = "gemini-3-flash-preview"
client = genai.Client() # reads GEMINI_API_KEY from env
grounding = types.Tool(google_search=types.GoogleSearch())
resp = client.models.generate_content(
model=PRO_MODEL,
contents=(
"Summarize this week's announcements, pricing changes, and "
"product launches for Acme, Globex, and Initech. Flag anything "
"that affects our positioning. Cite every claim."
),
config=types.GenerateContentConfig(
tools=[grounding],
),
)
print(resp.text)
# resp.candidates[0].grounding_metadata holds the source URLsNotice there is no temperature setting. With older models you would drop it to around 0.3 for analysis work. Google's guidance for Gemini 3 is to leave temperaturetemperatureA setting that controls how random or predictable an AI model's output is: low keeps it safe and consistent, high makes it more varied and creative.View full definition → at the default of 1.0, because lower values can cause looping or worse output. Steer precision through the prompt instead ("cite every claim," "say 'no change' if nothing happened").
The grounding_metadata on the response carries the supporting links, so your briefing can footnote every claim. That citation trail is what makes the output trustworthy enough to forward to an executive. Check the grounding docs for the current metadata shape.
Decision 4: Handling the multimodalmultimodalAI that works across several input and output types at once: text, images, audio, video and data, instead of one format only.View full definition → inputs
The Drive folder may contain a competitor's PDF pricing sheet and a screenshot of a pricing table from a webinar. You do not OCR these separately. Gemini is natively multimodal: hand it the PDF and the image directly in the same request, and its long context window lets you include several full documents at once instead of chunking them.
This is the part of the workflow where you do *not* need RAGRAGA method that lets an AI model answer using your own documents, retrieving relevant passages before generating a response instead of relying only on training data.View full definition →. RAG earns its keep when your corpus is far bigger than the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.View full definition →. For "the three files someone dropped yesterday," putting them straight into a long-context prompt is simpler, cheaper to build, and loses no fidelity. Knowing when to skip the retrieval layer is an architecture skill.
pdf = client.files.upload(file="reports/globex_pricing.pdf")
chart = client.files.upload(file="reports/webinar_chart.png")
extract = client.models.generate_content(
model=FLASH_MODEL,
contents=[
pdf, chart,
"Extract every price, tier name, and feature change. "
"Return JSON: {items: [{vendor, tier, price, note}]}.",
],
config=types.GenerateContentConfig(
response_mime_type="application/json",
),
)Note response_mime_type="application/json". Asking for structured output instead of prose is what lets the next step (the Apps Script writer) consume the result reliably. Two more reasons this is Flash, not Pro: it runs once per file, and extraction is mechanical.
🎬 [VIDEO: "Multimodal promptingpromptingPrompt engineering is the practice of designing and refining text inputs to guide large language models toward accurate, relevant, and reliable outputs.View full definition → with the Gemini API" - https://www.youtube.com/@GoogleDevelopers - Google for Developers videos on sending PDFs and images in a single request and reading the response]
Decision 5: Orchestration and the schedule
Now wire it together. The scheduler is an Apps Script time-driven trigger, the cheapest reliable cron you already own inside Workspace. The script calls your API endpoint (or calls Gemini directly via UrlFetchApp), then writes results into Docs and Gmail with native services.
Here the orchestrator lives in Apps Script. It runs at 7 a.m., calls your synthesis service, and appends the briefing:
function dailyBriefing() {
const payload = { date: new Date().toISOString().slice(0, 10) };
const res = UrlFetchApp.fetch("https://your-service/brief", {
method: "post",
contentType: "application/json",
payload: JSON.stringify(payload),
});
const brief = JSON.parse(res.getContentText());
const doc = DocumentApp.openById("YOUR_DOC_ID").getBody();
doc.appendParagraph(brief.title).setHeading(DocumentApp.ParagraphHeading.HEADING2);
doc.appendParagraph(brief.summary);
brief.sources.forEach(s => doc.appendListItem(s.url));
GmailApp.sendEmail("you@company.com", "Daily Intel: " + brief.title, brief.summary);
}You set the 7 a.m. trigger once in the Apps Script UI under Triggers, or programmatically with ScriptApp.newTrigger. No server to babysit, no separate scheduler bill. If you want this purely server-side instead, run the Python on Cloud Run with Cloud Scheduler; the trade-off is more infra control for more setup.
Knowledge check
1. According to the lesson, what is the real value of building a capstone project like the competitive intelligence assistant?
2. Why does the requirement that facts must be 'current and citable' shape the design of the assistant?
3. In the capstone's architecture, what is the clean division of responsibilities between Apps Script and the Gemini API?
4. Select ALL reasons the lesson gives for why the Gemini chat app (or a Gem) is the wrong engine for this scheduled workflow.
Select all the correct answers.
5. Select ALL statements that correctly describe the three 'homes' for Gemini work discussed in the lesson.
Select all the correct answers.
The full architecture, assembled
Read the data flowdata flowAn automated sequence of steps that moves data from source to destination: ingestion, transformation, validation, and loading, so it arrives clean and ready to use.View full definition → once, top to bottom:
- 7:00 a.m. trigger (Apps Script time-driven trigger) fires
dailyBriefing. - Ingest (Flash, multimodal): each new Drive file is uploaded and extracted to JSON.
- Research (Pro, grounded): a search-grounded call gathers fresh competitor news with citations.
- Synthesize (Pro): one call combines the extracted file facts and the grounded news into a one-page briefing, JSON out (
{title, summary, sources}). - Deliver (Workspace): Apps Script appends to the running Doc and emails the summary.
The model tiers map cleanly onto the steps: Flash fans out over many small inputs, Pro makes the two calls that require judgment. Grounding is scoped to exactly one step. You do not ground the extraction step, because those facts come from the documents in front of you, not the web. Grounding the wrong step adds latency and can pull in irrelevant search results.
Where each tool earns its place
- API + AI Studio: prototyped the prompts and grounding in AI Studio, then exported to SDK code. AI Studio's "Get code" button is the fastest path from a working prompt to a script.
- Apps Script: the scheduler, the Workspace glue, and the one file a non-engineer teammate can safely edit (the briefing prompt and the recipient list).
- Vertex AI / ADK: not used here, on purpose. The day you add tools the model picks between (search *and* an internal CRM lookup *and* a calendar action), upgrade the orchestrator to ADK and deploy on Vertex AI. That is the threshold: multi-tool, multi-step decisions belong in an agent framework, not in hand-rolled
ifstatements.
The build order that actually works
Do not build top to bottom. Build the risky middle first.
- In AI Studio, get the grounded synthesis prompt right by hand. This is where quality lives or dies.
- Get the JSON extraction reliable on your real PDFs. Real files break naive prompts.
- Only then wrap both in Apps Script and add the trigger.
Scheduling and Doc-writing are boring and reliable. The model prompts are where you will iterate ten times, so prove them first.
What to watch in production
- Citations that don't resolve. Always render grounding URLs and click a few weekly. A briefing with dead sources is worse than no briefing.
- Silent file-type failures. Confirm the ingest step handles an empty Drive folder and an unreadable file without killing the whole run. Wrap each file in its own try/catch.
- Prompt drift. When a teammate edits the prompt in Apps Script, the output format can break the Doc writer. Keep the JSON schema requirement in the prompt and validate before writing.
- Model retirements. Google retires older model IDs on a published schedule. Put a calendar reminder to check the models page each quarter, and swap the constant before your 7 a.m. run starts returning errors.
Key Takeaways
- Split by task, not by project. Use Flash for high-volume extraction and Pro for the one or two calls that need real judgment. This is your biggest cost and latency lever.
- Scope grounding to the step that needs fresh facts. Ground the web-research call; never ground steps whose facts come from documents you already supplied.
- Skip RAG when long context is enough. For a handful of documents per run, put them into a long-context multimodal prompt instead of building a retrieval layer.
- Let Apps Script orchestrate Workspace, let the API do the reasoning. You get a free scheduler, native Docs/Gmail access, and an editable prompt for non-engineers, with full model control where it counts.
- Keep model IDs in one place and leave Gemini 3 temperature at the default. Steer precision with the prompt, and update the ID when Google retires a model.
- Graduate to ADK on Vertex AI only when you need real multi-tool agency. Hand-rolled steps are fine until the model must choose between several tools and remember across runs.
Frequently asked questions
How do you automate a daily briefing with Gemini without running a server?
Use Apps Script as the orchestrator and the Gemini API as the reasoning engine. Apps Script gives you a time-driven trigger (a free scheduler inside Workspace), native access to Drive, Docs and Gmail, and a place where a non-engineer can edit the prompt. The API handles the model calls, grounding and structured output that the Workspace UI does not expose.
When should I use Gemini Flash instead of Gemini Pro?
Use Flash for high-volume, latency-sensitive extraction work (skimming news items, pulling facts out of a PDF) and Pro for the one or two calls that require judgment, like weighing sources and writing a final synthesis. Decide the tier per task, not per project: Flash fans out over many small inputs, Pro makes the final call. Since the synthesis runs once a day, the stronger model costs almost nothing there.
What is grounding with Google Search in the Gemini API, and which step should use it?
Grounding with Google Search tells Gemini to issue real searches and tie its answer to live results, returning citation metadata you can render as links. You enable it as a tool on the request. Scope it to the step that needs fresh facts, typically the web-research call: grounding an extraction step whose facts come from documents you already supplied adds latency and can pull in irrelevant results.
Do I need RAG to analyze PDFs with Gemini, or is long context enough?
For a handful of documents per run, long context is enough: Gemini is natively multimodal, so you can pass PDFs and chart screenshots directly in the same request without chunking or a separate OCR step. RAG earns its keep when your corpus is far larger than the context window. Skipping the retrieval layer when you do not need it is simpler, cheaper to build, and loses no fidelity.
Should I lower the temperature on Gemini 3 for analysis tasks?
No. Google's guidance for Gemini 3 is to leave temperature at the default of 1.0, because lower values can cause looping or degraded output. That differs from older models, where dropping to around 0.3 was common for analytical work. Steer precision through the prompt instead, with instructions like "cite every claim" or "say 'no change' if nothing happened".
At what point should a Gemini workflow move to ADK on Vertex AI?
Move to the Agent Development Kit on Vertex AI when the model has to choose between several tools and remember across runs, for example search plus an internal CRM lookup plus a calendar action. Below that threshold, hand-rolled steps in Apps Script or a Python script are fine. Multi-tool, multi-step decisions belong in an agent framework rather than in a chain of if statements.
What to do, from this lesson
These actions are compiled in the role's Playbook.
- Default to a Flash-first cascade, escalating to Pro only where decisions matter