Build Your First AI Agent in Python (Step by Step)

From the creator

This beginner-friendly tutorial walks you through how to build your first AI agent in Python from scratch, step by step, with no prior experience required. 🤖 Install Agentspan in seconds: pip install agentspan or npm install @agentspan-ai/sdk First, you'll set up everything you need to follow along, including Python, the Java Development Kit (JDK), and the uv package manager, then install the free and open-source Agentspan framework with a single command. Next, you'll build your first AI agent in Python using just three simple building blocks: a tool the agent can call, the agent itself, and a single line of code that runs it. Then, you'll open the Agentspan dashboard and watch every step your agent takes, including the exact inputs and outputs of each tool call, so you can see exactly what your AI agent is doing. Afterward, you'll build a more capable agent that reads a Python file and writes its own pytest tests for each function, saving its progress one step at a time. Along the way, you'll learn why your agent's state lives on a server instead of inside your Python script, the design choice behind everything that follows. Then, you'll crash your agent on purpose by killing the Python process in the middle of a run, and watch it resume exactly where it left off when you start it back up. Finally, you'll learn how to make your agent idempotent so it can survive reruns. Start building with Agentspan ➜ pip install agentspan Host: David DeWinter Sponsor: Agentspan 📚 RESOURCES Resource Guide (commands & code) ➜ https://docs.google.com/document/d/1vx9qDblLCNyRp7z-M4H6_ICnaSlOcto4Ep4DvyfAFmQ/edit Agentspan ➜ https://agentspan.ai/ Agentspan Docs ➜ https://github.com/agentspan-ai/agentspan Python ➜ https://www.python.org/downloads/ Java JDK (Adoptium Temurin) ➜ https://adoptium.net/temurin/releases uv (Python package manager) ➜ https://docs.astral.sh/uv/ OpenAI API Keys ➜ https://platform.openai.com/api-keys Anthropic API Keys ➜ https://platform.claude.com/ ⌚ TIMESTAMPS 0:00 - What You'll Build 0:23 - Install Prerequisites 1:46 - VS Code Setup 2:33 - API Keys & Providers 3:22 - Tool, Agent & Run 5:30 - Start the Server 6:07 - Agentspan Dashboard 6:58 - Test-Writing Agent 9:12 - Crash & Resume 12:02 - Next Steps 📩 NEWSLETTER Get the latest high-quality tutorials and tips and tricks videos emailed to your inbox each week: https://kevinstratvert.com/newsletter 🔽 CONNECT WITH ME Official website: http://www.kevinstratvert.com LinkedIn: / kevinstratvert Discord: https://bit.ly/KevinStratvertDiscord Twitter: / kevstrat Facebook: / kevin-stratvert-101912218227818 TikTok: / kevinstratvert Instagram: / kevinstratvert 🎁 PARTNERS & DISCOUNTED OFFERS 💻 Hostinger | https://hostinger.kevinstratvert.com 📋 Notion | https://notion.kevinstratvert.com 💵 Quickbooks Online | https://qbo.kevinstratvert.com 🎙️ Voicemod AI Voice Changer | https://voicemod.kevinstratvert.com 🕵️ VidIQ | https://vidiq.kevinstratvert.com 🎒 MY COURSES Go from Excel novice to data analysis ninja in just 2 hours: https://kevinstratvert.thinkific.com 🎓TRAINING Take your skills, or your team’s, to the next level by partnering with us for expert training: https://kevinstratvert.com/training 🙏 REQUEST VIDEOS https://forms.gle/BDrTNUoxheEoMLGt5 🔔 SUBSCRIBE ON YOUTUBE https://www.youtube.com/user/kevlers?... 🙌 SUPPORT THE CHANNEL Hit the THANKS button in any video! Amazon affiliate link: https://amzn.to/3kCP2yz ⚖ DISCLOSURE Some links are affiliate links. Purchasing through these links gives me a small commission to support videos on this channel. The price to you is the same.

Choose to Build with AI
Matched to AI Agents

AI Maker Residence 3

The third AI workshop taught by our legendary teacher, Nick Sarafa. This is a full-day hands-on training workshop for purposeful co-creation with AI using Claude Code. Imagine having access to hundreds of billions of dollars of computing power and knowing exactly how to make it work for you through the power of super intelligence.

◆ Fri 09 Oct 2026 ◆ KOKO Cafe, London ◆ With Nick Sarafa
AI Maker Residence 3
Live event
AI Maker Residence 3
Fri 09 Oct 2026

More like this

Running one yourself?

List your AI event,
wherever it is.

A meetup, a workshop, a hackathon, a conference. Any city, or online. Tell us about it and it lands in front of people already learning this stuff.