AI / Google Antigravity Gemini Fundamentals Interview Questions
What is the Interactions API and how does it differ from generateContent?
The Interactions API is Google's new recommended interface for building with Gemini models and agents, generally available as of June 2026. The original generateContent API remains fully supported but is now considered legacy for new projects.
| Feature | generateContent | Interactions API |
|---|---|---|
| Status | Legacy (still fully supported) | Recommended for all new projects |
| State management | Manual - send full history every turn | Optional server-side via previous_interaction_id |
| Execution visibility | Single response object | Observable execution steps for debugging/UI |
| Background tasks | Not supported | background=true for long-running tasks |
| Caching efficiency | Standard | Higher cache hit rates via server-side state |
| Agent support | Limited | Built for managed agents and agentic workflows |
| Thinking steps | Hidden | Exposed as observable steps |
from google import genai client = genai.Client() # Interactions API - new recommended approach interaction = client.interactions.create( model="gemini-3.5-flash", input="I have 2 dogs in my house.", ) print(interaction.output_text) # Chain turns with previous_interaction_id (server manages state) follow_up = client.interactions.create( model="gemini-3.5-flash", input="How many paws are in my house?", previous_interaction_id=interaction.id, ) print(follow_up.output_text) # Gemini knows context from turn 1 # Legacy generateContent (still works, not deprecated) response = client.models.generate_content( model="gemini-3.5-flash", contents="I have 2 dogs in my house.", )
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
