Build Your First Agentic AI with Python & Gemini | Hello World AI Agent in 10 Minutes
Dev to AI
0:00 / 0:00
Build Your First Agentic AI with Python & Gemini | Hello World AI Agent in 10 Minutes
249 просмотров · 2 нед. назад
Dev to AI
17 подписчиков
249 просмотров · 2 нед. назад
What You'll Build
We'll create a simple AI agent with two tools:
🖥️ System Platform Tool
Detects the operating system, machine, platform, and system information.
🕐 Current Date & Time Tool
Returns the current date and time for a requested timezone.
The interesting part?
We don't manually decide which function to call.
We give the tools to the Gemini model, and the model decides which tool to use based on the user's request.
🧠 What You'll Learn
What is Agentic AI?
Generative AI vs Agentic AI
How AI agents use tools
How to create a Python virtual environment
How to use the Google Gemini Python SDK
How to securely load API keys using .env
How to create Python functions as AI tools
How Gemini decides when to call a tool
How tool arguments can be generated from natural language
How to build a simple interactive AI agent
🛠️ Technologies Used
Python
Google Gemini API
google-genai
python-dotenv
Python datetime
Python zoneinfo
⏱️ Chapters
00:00 — Introduction
00:30 — Generative AI vs Agentic AI
02:00 — Project Setup
03:30 — Gemini API Key & Project Structure
04:15 — Writing the Agent Code
04:15 — Gemini Client & Imports
05:00 — Creating the System Platform Tool
06:00 — Creating the Date & Time Tool
06:45 — Creating the AI Agent
08:15 — Running the Application
09:45 — Wrap-up
💻 Example Questions
We'll test our agent with:
"What platform am I running on?"
The agent identifies that it needs system information and calls the platform tool.
"What is the current time in Asia/Tokyo?"
The agent selects the date/time tool and passes the timezone as an argument.
"What is the capital of France?"
No tool is required, so the model answers directly.
This demonstrates a fundamental concept of Agentic AI:
Give the model tools, and let the model decide when those tools are needed.
📁 Project Structure
hello-world-ai-agent/
├── venv/
├── .env
├── requirements.txt
└── app/
└── agent.py
🔐 Security Note
Never share your Gemini API key publicly.
Do not commit your .env file to GitHub or include your API key directly in your source code.
🚀 What's Next?
This simple example is the foundation for more advanced AI agents.
The same approach can be extended to:
REST APIs
Databases
File systems
Web services
Business automation
External tools
Multi-step AI workflows
Follow DevToAI for more practical tutorials on Python, Generative AI, Agentic AI, Gemini, LLMs, and AI application development.
👍 If you found this tutorial useful, consider liking the video and subscribing to DevToAI.
#AgenticAI #Python #Gemini #AIAgent #GenerativeAI #GoogleGemini #PythonAI #LLM #AIProgramming #DevToAI
Links for API key creation
https://aistudio.google.com/api-keys
https://ai.google.dev/gemini-api/docs/api-key