Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

freeCodeCamp

Guide to Agentic AI - Build a Python Coding Agent with Gemini

via freeCodeCamp

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn to build a functional AI coding agent from scratch using Python and the free Gemini Flash API in this comprehensive 2-hour project-based tutorial. Discover how powerful AI tools work by creating an agentic loop powered by tool calling, starting with fundamental concepts of AI agents, agentic loops, and tool calling mechanisms. Set up your Python development environment using UV and establish your first connection with the Gemini API to make initial API calls. Master command-line argument handling, conversation history management, and debugging techniques with verbose flags. Implement four essential tools that enable your agent to interact with codebases: getting file information, reading file content, writing to files, and executing Python code for feedback. Explore critical security considerations when running AI-generated code and understand how to craft effective system prompts for optimal agent behavior. Dive deep into function declarations for large language models, implement comprehensive function calling logic, and construct the complete agentic loop that allows autonomous operation. Witness your agent autonomously identify and fix bugs in a calculator application, demonstrating real-world problem-solving capabilities. Gain hands-on experience with conversation management, error handling, and the iterative process that makes AI agents effective at complex coding tasks.

Syllabus

- 00:00:00 Introduction
- 00:01:14 Why Build an AI Agent?
- 00:01:49 Course Overview & What We're Building
- 00:02:25 How to Follow Along
- 00:03:47 What is an AI Agent? Agentic Loops & Tool Calling
- 00:06:03 The Agent's Four Tools
- 00:07:58 Prerequisites & Project Goals
- 00:10:08 Demo: Agentic vs. One-Shot Responses
- 00:13:07 Python Project Setup with UV
- 00:15:44 Getting Started with the Gemini API
- 00:19:21 Making Your First API Call
- 00:24:44 Accepting Command-Line Arguments
- 00:27:46 Managing Conversation History
- 00:30:39 Adding a Verbose Flag for Debugging
- 00:33:35 Setting Up the Project for Our Agent Calculator App
- 00:36:23 Building Tool #1: Get Files Info
- 00:49:39 Building Tool #2: Get File Content
- 00:58:24 Building Tool #3: Write File
- 01:05:26 Security Note: Dangers of Running AI-Generated Code
- 01:07:30 Building Tool #4: Run Python File
- 01:18:00 Understanding the System Prompt
- 01:33:10 How Tool Calling Works: Declaring Functions for the LLM
- 01:41:38 Adding All Function Declarations
- 01:49:19 Implementing the Function Calling Logic
- 01:57:30 Creating the Agentic Loop
- 02:07:11 Final Demo: Agent Fixes a Bug Autonomously
- 02:13:44 Conclusion & Next Steps

Taught by

freeCodeCamp.org

Reviews

Start your review of Guide to Agentic AI - Build a Python Coding Agent with Gemini

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.