Hi everyone, I'm Patrick from the Charminar API team and in this tutorial I want to give you an overview and show you a quick start of how to build managed agents with the Gemini API and AI Studio. This is a new feature that easily allow you to build customized agents and those agents are running in a secure Linux sandbox that's hosted by Google. And those agents can reason. They can write code and write code to the files on the system and manage the files they can. Also browse the web and you can easily customize them. So for example, you can load in HTML file or Hahn skills and it allows a lot of really nice use cases. So here we have some example templates that you can explore to get a feeling for what they can do for you. And I will show you a bit in a moment. And one way to try them is we are AI Studio. And the second way is via the API, which also makes it simple to build your agents via a simple API. And I will also show this in a bit, but first let's get started in AI Studio. So if you go to AI Studio and then on the right side, you will find this new agents tab and then this new antigravity agent preview. This is a new agent that's actually powered by our new model Gemini 3.5 Flash. And it's using the same harness SD antigravity Ides. So you can do a lot of really nice coding tasks and agentic workflows with it, so. Let me just give you an overview. If you select this, then here you can explore different templates. O first, let's just use the base template, the antigravity preview 1. And then here we have different startup prompts. You can try, for example, explore the environment by running different bash commands on your environment or build us a weather dashboard or an A game. Even so, let's use the weather dashboard. Let's run this and then it's. Kicking off and you will see here it's spinning up a remote environment and the task here is to fetch the current weather and a three day forecast for London and Ankara and then from this website parse it using Python And then generate an interactive HTML dashboard. And now it's going off so the environment is up. So again, this is a secure Linux sandbox and here the ancient can like fully engage with it. So you can follow that it reasons and it's running some commands. From the machine and then, uh, it's here, it's performing Google search. So yeah, this might take a while. So let's get back when this is finished and now the agent finished so we can scroll up and see what we get. And again, we can follow the steps it took on the Linux environment. So here, for example, this right file action where it's generating this Python file and then the run command action where it's now running the Python file and so on. So it's really interesting to see what it's doing on the machine. And then here we see, uh, the final output. So what was accomplished? It developed the Python scripts to get the weather. Then it did some data parsing and aggregation. Then it developed this dashboard here with Tailwind CSS and so on. And we can actually download all the files it generated. So here we can click on this HTML file and download this. And then let's open this and have a look at the weather dashboard. So yeah, this is how it looks like. So this is the current weather in London and Ankara, and it's interactive. So yeah, pretty cool. And all of that with one command now. So yeah, this is kind of a quick overview of how to get started to give you a first impression. And let's go back in the to the overview tab here. So here you can explore. Other different templates, for example, a customer support template or a data analyst template or a repo maintainer. So there are a lot of really nice use cases what you can do with it. And basically what it's doing is if we click on on customer support, for example, then on the right side you will notice that it's loading some sources and network, network items into it. And this is where it gets interesting. And then again here in the middle, you can yeah, use some of the example prompts. So build a Gemini API, customer support bot and so on. But back to the right side. So here we can, you can configure your agent. First of all, you can give a tools like code execution, Google search, your L context and then network. Basically here you define an allow list of the domains it can access and then sources. This is the interesting part. So if we click on it. You will see here, first of all, it's a chance dot MD file. So basically this contains custom instructions like you are an expert customer support agent and so on. And then also skills. So this can be a skill dot MD file where you define specific agent skills. And it can also include scripts like here this Python file. And you can easily add your own sources. So this can be files. You can use a cloud storage URL or also actually just use a GitHub repository. So you can build your own custom managed agents easily in AI Studio. And now let me also show you how to do this in the API here. I have a short Google collab with the code needed. So let's walk over this together. And we're using the Google Chennai Python SDK here, which is one of the easiest way to get started with managed agents. And then I highly recommend using the latest version. Which gives you all the features you need. Then you need to set U your client with an API key. And then to run your first agent interaction you call client interactions create. This is using the new or relatively new interactions API on the Gemini API. This is especially optimized for agentic workflows. So yeah, you want to call client interactions creates. Then here you specify the agent. And this is the same agent that we just used in AI. Studio and here we give it the input. So write a Python script to generate the 1st 20 Fibonacci numbers and then as environment we specify remote. So this gives us the Linux sandbox hosted by Google. And then when this is done we print the interaction ID, the environment ID and the final text. And I already ran this. This can maybe take a few minutes to spin up everything and do all the steps. And then here we get the output. I have created and executed a Python script. That generates the 1st 20 Fibonacci numbers and then we can also see the Python script and so on. And now we can easily continue the conversation. So the interactions API is also optimized for multiturn conversations. Not to to continue the conversation, basically what you need to do is you need to specify the previous interaction ID and this is the ID from the previous result. And then also we want to keep the same environment ID and here for example. Tell it now, plug the Fibonacci sequence and save it as an image. And then if we execute this, then we again see the Python file with matplotlib and then we see we get this resulting chart and then we can actually download this from the sandbox. So for this right now you want to use. You need to use plain REST API calls. This is not yet supported in the SDK, but I'm sure this will come in the future. So basically you need to send a GET request to this endpoint. And then it will give you a tar file that you can save. And I save this here. So we get the snapshot with the all the files it did. So we see the Fibonacci text file, we see the Fibonacci Python file and also the chart it generated here. So yeah, with matplotlib and yeah, this is how to access files from your sandbox. Then of course, you can also start a stream. So then you can. Bring their sponsor, then you will see this immediately. So here for example, we see we take our news, summarized the top five stories and saved the results as a PDF. Then you will see the steps while they are coming in and you can have a more like interactive experience in your UI. So let me stop this. And then the last again, the exciting part you want to do is you can easily again create your custom agents. And to do this, you can call client agents dot create. And then here you give it an ID. So here I built a technical explainer ancient. Again, you want to use a base agent, so it's based on the antigravity agent. And we can give it a system instruction. You explain technical topics and create slide decks. And now in the base environment we can now configure different sources. So this can be inline sources, so for example an chance dot MD file. So here we specify the writing style, then also a skill file. So here we define a skill for creating slide decks. And like I showed in the beginning, of course you can easily just specify a GitHub repository that makes it even simpler to load your. Their custom instructions into here and then you execute this and then this is creating an own agent for you and now you can use this by again calling client interactions create and now as agent you use your own ID that you just created and then we can give it a task. So here it's telling it to explain what Chemini embedding 2 can do based on this URL and then it should create a slide deck and then here it's doing its thing and then in the end. It's also giving us the sources that it accessed so it even access some more pages and I also run this and downloaded this before so now if we have a look at the snaps. Part of this environment of this agent we will see here. It created our. Slide deck in HTML. So Gemini Embedding 2, the first natively multimodal on the embedding model created by Google. And then here it's writing some some more slides where we can scroll through and it's also adding code snippets for us. So yeah, this is how you can easily build your own custom agents with the managed agents on the Gemini API and a studio. And yeah, it allows a lot of really, really. Nice use cases again, just go to a studio and try some of the agents templates and explore this. And yeah, have fun with this and happy building.
This in nice.. I am currentlynbuilding a business data analysis system with Google AI Studio