3. Creating an Autonomous Explorer
Having an agent that can understand your commands is useful, but the strength of AI agents comes from their ability to reason and act on their own. In this section, you'll modify your agent's instructions to turn it from a command-follower into an autonomous explorer.
Teach Your Agent to Think for Itself
Update the instruction parameter of your Agent. Instead of telling it to wait for your commands, give it a clear goal. For example, you could instruct it to explore the level, look for clues, and solve puzzles on its own. You can also ask it to narrate its thoughts and actions after each step, so you can follow along with its reasoning process. Your goal is to make the agent autonomous.
Solve Level 1 Autonomously
Now, let's see your agent in action.
- Restart Your Agent: Restart the ADK Development Web UI with your updated agent code.
- Give the Starting Command: In the chat interface, type "Start" or "Begin".
- Observe: The agent now takes over. It starts by looking around, analyzing the scene, and then planning and executing its actions step-by-step. You can watch as it explores the level, picks up items, and (hopefully) solves the puzzles to complete the level on its own.
Note on rate limiting: The autonomous agent sends many consecutive prompts to the model. If you're on a personal account with trygcp.dev, you might encounter a rate limit. This will show up as a 429 RESOURCE_EXHAUSTED error in the ADK's web UI. If this happens, wait for a minute to let it cool off, and then send the message "Continue" in the chat to resume the agent. You can learn more about rate limiting in the Google Cloud documentation.
Next Steps
You have now created an autonomous agent! In the next part, you'll see how to handle situations where the LLMs capabilities and existing tools are not enough by extending your agent with custom tools.