Gemini's Code Mode Alternative

From the creator

Gemini API tool retrieval and code mode cut my agent's input tokens from about 564,000 to 30,000 on the same task, with the same correct answer. This video explains how code mode (code execution with MCP) keeps raw tool results out of the context window, how Gemini's tool retrieval (tool_search and defer_loading) loads only the tool definitions the model asks for, and how to wire the two into one agent. It also covers file slicing, which loads only the pages of a PDF or the cells of a spreadsheet that you need. Demo agent code: https://github.com/PromtEngineer/gemini-tool-retrieval-demo LINKS: Gemini API docs, Tool retrieval: https://aistudio.google.com/docs/tool-retrieval Introducing file slicing controls in the Gemini API: https://blog.google/innovation-and-ai/technology/developers-tools/file-slicing-controls/ Gemini Interactions API overview: https://aistudio.google.com/docs/interactions-overview Gemini API docs, Context caching: https://aistudio.google.com/docs/caching Cloudflare, "Code Mode": https://blog.cloudflare.com/code-mode/ Cloudflare, "Code Mode: give agents an entire API in 1,000 tokens" (search and describe): https://blog.cloudflare.com/code-mode-mcp/ Anthropic, "Code execution with MCP": https://www.anthropic.com/research/code-execution-with-mcp RELATED VIDEOS: What is an Agent Harness?: https://youtu.be/nWzXyjXCoCE Anthropic Just Killed Tool Calling (programmatic tool calling): https://youtu.be/8dVCSPXG6Mw Anthropic Just Fixed MCP's Biggest Problem (tool search): https://youtu.be/TVOoMwkpSRQ Is Context Rot Still Real? I Tested All 5 Failure Modes: https://youtu.be/N3lMEjynpr8 The token counts are single runs on my machine with a made-up company dataset, so your numbers will change with your tools and data. Disclosure: I recently joined Google. This video is based on Google's public docs and my own runs, and these are my own views. My voice to text App: whryte.com Website: https://engineerprompt.ai/ RAG Beyond Basics Course: https://prompt-s-site.thinkific.com/courses/rag Signup for Newsletter, localgpt: https://tally.so/r/3y9bb0 🦾 Discord: https://discord.com/invite/t4eYQRUcXB ☕ Buy me a Coffee: https://ko-fi.com/promptengineering 🔴 Patreon: https://www.patreon.com/PromptEngineering 💼Consulting: https://calendly.com/engineerprompt/consulting-call 📧 Business Contact: engineerprompt@gmail.com Become Member: http://tinyurl.com/y5h28s6h 💻 Pre-configured localGPT VM: https://bit.ly/localGPT (use Code: PromptEngineering for 50% off). Chapters 00:00 Why AI Agents Struggle With Hundreds of Tools 01:57 What Code Mode Is and What It Fixes 05:26 Combine Tool Retrieval With Code Mode 06:36 Demo: All Tools vs Tool Retrieval vs Code Mode 09:25 Gemini File Slicing for PDFs and Spreadsheets 10:19 Tool Retrieval Limitations and Code Mode Rules 11:07 When to Use Tool Retrieval vs Code Mode

More like this

Running one yourself?

List your AI event,
wherever it is.

A meetup, a workshop, a hackathon, a conference. Any city, or online. Tell us about it and it lands in front of people already learning this stuff.