And we are going to do this with Gemini 3. So Gemini 3 is the latest family of models of the whole Gemini group. Gemini 1 was a model about understanding. Gemini 2 was a model that could do some complex reasoning. But Gemini 3 is at its core an action model. It's a model that can take actions, that is very agentic, that can do extremely complex thinking as well. And I will not dive too much into this, but if you go to the LMArena, and if you don't know the LMArena, it's a leaderboard where people can play with models and you are blind, so you don't know which is the model that you're interacting with, but you choose which is the model that you prefer. So you get two responses and you'll say this is the response I like the most or this is the response I like the most, and based on that there is this leaderboard called the LMArena that tells you which are the models that are the most liked by people.
So again, at a very high level, it has state-of-the-art reasoning and multimodality. It can understand audio, text, video, code. It has a super long context window. It can do complex reasoning tasks, and it can do very complex agentic things. So you see in this image is exactly what I was explaining before about what an agent actually is. So you send a prompt, you explain to the model which are the tools that it has access to, and based on that the model may determine to just answer or maybe to do some function calls based on the prompt.
And finally, it's agentic coding, like it's a very strong code generation model. So today what we're going to do is first we are going to build an agent, and then we're going to build an application, an actual UI built entirely by Gemini. And the easiest way to just go and play with Gemini is in AI Studio. So that's aistudio.google.dev. I'm sure that many of you have already been using this. And here you have a couple of things. So you have the build interface, which is what we're going to use later today, but you also have the playground. And the playground is where you can actually experiment with the models. So I don't know if you want, tell me what's the weather today in New York. I just give you an example. You can give access to tools to the model. So let's say that I want the model to be able to go to Google Search and search what's the weather. So this is a very, very simple prompt. This is not a complex task.
Well, the model will go to Google Search. It's slow because I'm using the largest model that we have. It will do thinking. So here you can see like what's the actual reasoning that the model is doing. So, okay, the model knows that today is January 22nd, that we're asking for New York, and then it goes and it does the Google search, and okay, the weather is 45° F or 7° C, and you can see which are the sources as well, which is google.com and flexe.com. So that is in AI Studio. I will not dive too much into this, but here at the right you can just play with many things. You can experiment with different models such as Nano Banana for image generation, Gemini 3 Flash Preview, a couple of other models, and you can also experiment with the settings. So let's say that you want the model to have access to code execution, which means that you allow the model to run code, or you want the model to be able to call functions, or you want the model to be able to retrieve information from a specific URL. You can specify all of that.
So that's AI Studio or aistudio.google.dev. What is nice though is that all of these also has an API. Like all of these things that I'm doing here in an interface, we can also use through an API. Actually, if you click here at the top right, get code, you get the actual Python code that you can open in Colab. So there's this button here, open in Colab. You can download, you can, yeah, you can download, you can open in Colab, you can copy paste. You also have a code in TypeScript, in Java, in Go, in REST if you just want to do direct HTTP calls.
Have people lost audio? I'm seeing some people reporting in the chat that they cannot hear me. Okay, it works fine. All right, perfect. Then let's keep going. So the last topic I want to show today before we dive into code, and this will actually be mostly code, is the Interactions API. So this is a new API that we just launched in December. It's pretty much so the way we originally designed the Gemini API was around predictions, right? Like traditionally you send a prompt to get an answer, but now AI is evolving. AI is more about doing, about actions, about agency, right? So the APIs also need to evolve. The APIs need to be redesigned to be aligned with what's happening in the AI ecosystem. So the Interactions API, and that's what we're going to use today, is a unified interface for interacting with all of the Gemini ecosystem, so both models and agents, and it makes it much, much, much nicer with a much nicer developer experience to interact with the models. It simplifies everything. So we are going to do some coding. Feel free to scan this QR code. You can also go to GitHub, github.com/patrickloeber, who is a colleague from the team, genai-tutorials.
So just to show you here, this is genai-tutorials, and today we're going to do the Interactions API. So that's the first notebook that is here. All right. So let's do some coding. So I'm going to do everything today in a Google Colab. So if you don't know Google Colab, it's pretty much a web interface where you can execute and run Python notebooks. You have access to free GPUs, free TPUs, but in our context of today, we're just going to be using the Gemini API.
So the first thing as usual is just setting up an API key. I'm not doing anything special here, so you can ignore these lines. I'm instantiating a client. So this is pretty much the class that will allow us to interact with the Gemini API, and we will begin using the traditional API which is called generateContent. So generateContent is a standard REST endpoint that allows you to send a prompt and get a response, right? So a very traditional API experience. So here, to give you a very concrete example, you tell the model to generate content using the gemini-3 model, and you ask the model to tell a joke, and then you get the response. The response has a couple of different things, but this is the important part: 'Why don't scientists trust atoms? Because they make up everything.' So that's the joke generated by the model.
You can also do multiple turns, and that means that it's not just like 'tell me a joke' and you get the answer, but you can have actual conversations. And with the generateContent API, it's a bit, you need to manage the context yourself. So here, for example, in the first turn, you tell the model, 'Hello, what are the top three cities in Germany to visit? Only return the names of the cities.' And then you get the first answer using Gemini 3 Flash Preview, so just as we did before. Now, if you want to go to a second turn, you as the user of the API need to append that response to the contents. So here the contents, and then so that's the response, and then if you want to do a follow-up question or a follow-up prompt, you need to append again another turn. So here again the user, the role is a user, and as you can see the experience is not as nice, right? Like we need to append, it's a list with a dictionary inside that has a text key, and then the value is the actual second prompt, which is 'tell me something about the second city.' Then you have a response being generated again by 3 Flash Preview, and finally we can print the final response, the final result. So what do we see here? So the three cities that were provided were Berlin, Munich, and Hamburg. That was in the first turn. And in the second turn, the model says that the second city is Munich. And here are a couple of few facts about it. And then there are information about Oktoberfest and architecture and parks and so on.
So as I mentioned, the developer experience is not as nice. So we did another class called Chat, the chat interface. It's more of a utility class that handles everything that we just did itself. So you can create a client's chat create specifying which is the model that you are using, so Gemini 3 Flash Preview, and then you can just keep sending messages. So 'Hello, what are the top three cities?' so the exact same prompt, and you get the similar results, right? It's different because this is a model, this is not deterministic, but you can see that the experience is much nicer. You just create a chat, you send a message, you send another message. It's not on you to manage the whole conversation history.
Right, so we started already with the generateContent API. That's most likely what you have been using if you have built anything already with Gemini 3. But in December, as I was mentioning, we launched the Interactions API. So the Interactions API is this new API that we have. It's the same SDK, so you don't need to install anything differently. It's a new class, a new way of using our API that is much more aligned with what's happening in the AI ecosystem today, which means that rather than sending a prompt and getting a response, it's an experience more on actions, on interactions, allowing the model to do things. And we're about to see why the experience is much nicer and much simpler. So this will look very similar to the chat example that we just did. So 'Hello, what are the top three cities in Germany to visit? Only return the names of the cities.' That's one interaction. You can print that interaction. So Berlin, Munich, Hamburg, and we do a second interaction which is the Gemini 3 Flash Preview again, 'tell me something about the second city.' And the difference though is that you can specify here which was the previous interaction. So when we were using the chat, the chat was handling itself, like the whole history. With this kind of approach, you can do many interesting things. You can do branching, you can provide previous interactions to the model without you having to handle the whole thing yourself. You just specify the interaction ID.
So here's a bit more context. Interactions API is designed around a central resource, interaction. An interaction is a complete turn in a conversation or task, right? So pretty much it does a recording of the session. It contains all of the history of that specific interaction. So right now we have some very simple conversation, but in a couple of minutes we're going to do complex things with tool calls, tool results, final model outputs, and hence the Interactions API is quite nice. The Interactions API is not just for text, right? It is also for multimodality. So for example, here what we're going to do is we are going to ask Gemini 3 to generate a recipe for the shown scones. So here we have an image of some scones. The model has very strong multimodal capabilities. So the model can not just understand text, the model can also generate, sorry, understand complex images, complex videos, and generate text based on that. So for example, here we have the response of the model. So based on the visual evidence in the image, these are rustic blueberry cream scones topped with coarse sugar. There's a bunch of information about the scones based on the multimodal understanding of the model, and then it generates a full recipe of the scones from the picture. Yeah, so ingredients and then the full instructions.
So that's to understand images. But what happens if you want to generate images? So there's Gemini 3, which is the main model that we launched. There's also a model that you probably know as Nano Banana Pro or Nano Banana. So Nano Banana is a model built on top of Gemini. Nano Banana Pro was built on top of Gemini 3, and it's able to generate images of very high quality. And I'm just simplifying a lot because this model can really do Google searches. So it can go to Google, retrieve context from the web, and generate images based on that context. It can do syncing with the images, which means that the model can iterate with those images, and much, much, much more. But just to get started, I just asked the model to generate a sketch of a website about llamas and to make it very fun. So okay, so it generated like, all of this is generated with absolutely no context except what I just showed you, right? This prompt: 'generate a sketch of a website about llamas, make it very fun.' So this is a sketch. As you can see, it has Llama Palooza, it has like the navbar, meet the llama, llama facts, and so on. So all of this was entirely generated by the model, and as you saw, it took maybe like a couple of seconds. It was not very slow. We're going to do something with this image in a couple of minutes, but we still need to build an agent. So let's do that.
So the first thing that I mentioned before is that you can do tool calls. The most basic tool that you can use, or like a very good tool to know how to use, is called Google Search, which means that let's say that you have the models, but the models were trained some time ago, and you want the model to be able to generate content based on the news of today or based on some specific thing for which the model was maybe not trained. So let's say as an example that you want to ask the model who is, I don't know, who won the last Super Bowl or which president won the elections in X country last week. Google Search is a great tool to enable this. And the way to enable Google Search is just by adding one additional parameter, tools. And there you specify that the tool is of the type Google Search. And in this case, it tells me that the Philadelphia Eagles won the last Super Bowl, which was played on February of last year. And then a bit more information on that.
So this is one tool. This is Google Search. But the model can also do some other things. So let's say that you want the model to calculate the 50th Fibonacci number. So if you just ask the model to do that, maybe the model may be able to do that with very long context, but this is a term number 50 of the Fibonacci number, which is something that is very complex for anyone to just think about. So what you can enable is code execution, and code execution allows the model to generate code and then execute that code to be able to retrieve the answer. So rather than the model trying to do the math itself, the model could generate the function Fibonacci, run the Fibonacci function with 50, and then get the number itself. Right? So here you can see that the model, I think, correctly says the 50th Fibonacci number is 12 billion and so on. And then it explains a bit how Fibonacci is calculated. So it's 0, 1, 1, 2, and so on. Let's say that you want to see which was the code that the model used for this. So the interaction not only gives you the output of the model, it also provides you the code execution call and the code execution result. So you can see that the call was a resume bit, the call was code execution call content, and I'm going to scroll horizontally a bit. So here I can see the code. I know like the format is not very nice. I can format it later. But you can see that it implemented a function called def fibonacci. And you can see here how it's been calculated. Yeah, it's pretty much it. And that's the code execution code. And then you can see the code execution result content. So here you can see pretty much that we call fibonacci 50 and then the result.
So just to go back for a second and make sure that everyone understands what happened. We asked the model to generate or tell me what's the 50th number in the Fibonacci sequence. The model determined that to do that it would be better to generate code and use that code. So the code is pretty much a tool, right? So it will generate a function which will solve the task. In this case, it will create a Fibonacci function. It will then call the Fibonacci function with a parameter of 50, which is what is happening here. Now it has the answer. So it's now in the context. So now it can reply to the user. So an agent is not anything else than a loop.
One last example is the URL context, which I already showed a bit in AI Studio, which pretty much is you can ask the model to summarize something. So for example, there's this Wikipedia page of a neural network, and you want the model to be able to give me a summary. Here you can see like the model was able to retrieve the content from that website and generate a summary.
Okay, we are pretty much already done with what's an agent. But now let's actually build an agent from scratch. So we're going to do a couple of different steps. So the first step is defining which are the tools that we want the agent to be able to use. So so far we saw a couple of existing tools that we have created. So that is Google Search, code execution, and URL context. But you can specify any other tool. So let's say that you want the model to be able to read a file. You may want the model to be able to write a file, and you may want to enable the model to list the files in a directory. So just specify like the schema of each of those functions. You create those functions as well. And I'm setting up a dictionary that tells the model like read file, this is the definition, and this is the actual Python function to execute that. I'm not going to dive into the agent itself. But pretty much at a high level, it's doing what we did before, but in a nice class. So we instantiate the client, we instantiate the model, we manage here the interaction ID so we know which is the previous turn. What we're going to do right now is more of a CLI kind of experience. So we are going to be chatting with a model and asking it questions. So you can see here that the interactions are being created, we pass the previous interaction ID or the ID of the last interaction.
And then here we take care of formatting everything in a nice way. And now we're going to run the agent in a loop. So again, we are going to create a class. We are going to use Gemini 3 Flash Preview. We are going to use a couple of file tools, and we are going to tell the model that you're a helpful coding assistant, respond like a Linux terminal. So pretty much the agent is ready. Asking to check files in this directory. So okay, which are the files in my directory? So pretty much this is a prompt. The model is going to do the function call, list directory in this path. So that's the action that the model did. You get a function response, which are the files, and based on that, the actual model response. So what is going to be returned to me as a user? Again, the prompt was respond like a Linux terminal. So here it says, 'Yeah, look, it's not rocket science. You've got a handful of things in there. Here's the list. So why you couldn't just run ls yourself is beyond me,' which is very Linux-like. And yeah, it gives me the files, and yeah, that's pretty much it.
All right, so we have built an agent, and now we are going to move to AI Studio. So now we have learned how to use the API, which is what is being used under AI Studio. So for this part, there are no slides. We're just going to go to aistudio.google.dev/build. And if you're not familiar with this interface, pretty much it's an area or a playground where you can pipe code ideas. So you can just tell the model to generate me a demo based on whatever. You can see a bunch of different ideas from others. But what I'm going to do today is I'm going to copy paste the Llama Palooza sketch that we did before with Nano Banana, and I will ask it, please generate the website based on this sketch. You can configure a bunch of different things. This is a super simple prompt. And what is very cool is that now we are going to leverage the multimodal capabilities of the model. We are going to leverage the coding capabilities of the model. And you can see that the model is already generating code. Actually, I can go to the code tab, and I can see that the code is being generated right now. I'm not generating this. This is the model. This part was not scripted. So this is like, let's see what the actual website looks like. The input again was an image generated by Nano Banana.
Okay, let's wait a couple of seconds. It should be almost over. What is cool in the meantime is that you can actually save this just so you can download the app. You can save to GitHub. You can share with others. You can deploy the app. So if you want to deploy this in Cloud Run, you can do this. So you can see that the model generated a very initial website. So Llama Palooza, Her Llama, Fox, Woolly Wonders Shop, Adopt a Llama, and you can see a bit more information here. This is nice. This was again fully generated based on a generated sketch in under a minute, like 49 seconds here, which is quite impressive if you think about where we were a month ago. But I don't know, like the experience here feels maybe a bit too, I don't know, plain or a bit too like 2010 website. So maybe we want to iterate a bit. So on the left, you can keep coding, you can keep asking questions to the model. So let's say that I want to ask the model to add, let's say, a chatbot, add a chatbot where users can chat with a llama. And I can imagine like in this case, what the model is going to do is it's going to look at my prompt, it's going to look at the whole project, and it's going to determine, okay, we need to add a chatbot functionality. So Gemini is going to add a chatbot powered by Gemini as well. So it's not that I'm using Gemini to generate code and generate a website. I'm also using Gemini to generate a generative experience within the website. So again, it's now updating the code. It updated the code, and it updated the website. So now I have this button at the bottom left with the llama. I click it, and it tells me, 'Hello, I'm Larry the Llama. No problem here, just love and fun. Want to chat?' And yeah, now I have a full chatbot powered by Gemini that behaves like a llama directly in an app generated by Gemini.
So you can, yeah, so you can chat here. It will take a bit, and yeah, you can see that I'm chatting with Gemini. Cool thing here is that you can always look at the code. So it's not like you don't have visibility into what's happening. So you actually can go to Gemini.ts. So that's the TypeScript file for the generation in this case, and you can see that there's a bit of context here that you can modify. So yeah, so here you can see a bit more information. There's also the chatbot component and so on.
Let's say that you are maybe not happy with something here. Like, I actually like this quite a bit, but let's say that I want to change the color of this navigational bar. So there's this button that says 'Annotate app' that's at the bottom left, and you can click it, and then at the bottom you have this new bar that allows you to do a bunch of different things. So for example, I can add a rectangle here, and I can add some text here and say, 'Please change the color of this nav to green.' It's probably not a good design decision, but you can do a bunch of things. Let's say that you want to, I don't know, mark this area and ask the model to, I don't know, replace this with llamas because they are supposed to be llamas, but they don't look great. And again, these are all placeholders being generated. So I sketch it, I modify a bit directly in the website, and now I can click 'Add to chat.' So what is going to happen is that if you see at the left, it got added to the context. I click 'Submit,' and now the model took pretty much, sorry, the AI Studio pretty much took a screenshot of the website. It added that to the context, and now just with the comments I added directly in the website, it's going to make the changes. So yeah, it updated this to green. This maybe looks a bit more llama-like, although I'm not convinced about that.
So that's pretty much how you can build in AI Studio. The next thing that is very cool before wrapping up for today is that you can go to the app gallery, and the app gallery allows you to explore many apps built by other folks. So for example, let's say that you want to see some examples on very fast generation or video generation, or maybe some beautiful landing pages that you can use as an initial place. You can do that. For example, there is this one, Sky Metropolis. That's a kind of game experience where you are building a city. Okay, it's not working great right now. I will change to another one of the other demos. I'm just going to one of the landing pages.
So let's say that you have this very nice landing page. What is cool is that this was coded by someone else, but you can always go and look at the code. So I can always look at the code, and I can also do what is called mix and match, which is I like this app, I want to do some changes for me. So let's say that I want to do some changes, and I can just by code as I did before, like just prompt it or just do some modifications in the UI. But Gemini also gives me some suggestions here in what kind of things I can do. So let's say that I want to add a share button. So I can click that, send the prompt, and now it's going to update it. And once I'm happy with it, I can save it for myself. I can save to GitHub. I can deploy the app again. I can share it. So you have the link here that I can share with everyone else. And you can do a couple of other things. So as you can see, I'm not just coding something. I'm really like building a generative app that I can share with others, that you can share with others, and that others can also use as inspiration to generate or build their own applications based on this one.
And again, you can download this or publish it in GitHub. So the code at the end is yours. So okay, so it added a share button. It did the thinking. I actually can see the whole thinking. So I can see what was the reasoning of the model, and it did the changes. And yeah, I think it added a button for sharing. I'm actually not sure where it was added. But yeah, I think that was pretty much what I wanted to show for today. Thank you so much, and I think we will have quite a bit of time to go through questions and maybe keep coding and exploring other things that we can do with AI Studio.
This was, by the way, while I was preparing for this presentation, I also tried a very similar example with another generated image, and this was a llama drama website that was generated by Gemini, also here with a chatbot. In this case, it's Lorenzo the llama.