Home›Real Python›Article

Quiz: Build an AI Agent From Scratch in Python: The Agentic Loop

Real Python · Dec 2, 2026

AI summary AI-generated, may contain mistakes

This article introduces a quiz that tests comprehension of a tutorial on building an AI agent from scratch in Python. The quiz revisits core concepts that turn a language model into an agent, including the harness, the conversation context, the tools the model can request, and the agentic loop that chains tool calls until an answer is reached.

In this quiz, you’ll test your understanding of Build an AI Agent From Scratch in Python: The Agentic Loop.

By working through this quiz, you’ll revisit what turns a language model into an agent: the harness around it, the conversation context it resends, the tools it can ask for, and the loop that lets it chain tool calls until it has an answer.

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Keep reading

Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.

More from Real Python

GLM 5.4 Draws a Python Reading a Book

AI summaryReal Python ran GLM 5.4 through an informal five-task benchmark of everyday Python skills, including using the turtle module to draw a python reading a book, which the model completed successfully with 172 lines of code. Across the tasks, the model wrote Python at a 3.10 level with some 3.11 features, avoided all ten unrelated edits in a cleanup test, correctly identified that itertools.flatten() doesn't exist, and cost $0.16 total. The full results are available on Real Python's website as part of their ongoing AI benchmark series.

Amazon Ergo Draws a Python Reading a Book

AI summaryThis article presents Real Python's informal AI benchmark of Amazon Ergo, which was tasked with drawing a python reading a book using Python's turtle module. Across five tasks, the model drew the snake with 3,205 drawing commands, used modern Python 3.11 features, correctly flagged that itertools.flatten() doesn't exist, and made zero unnecessary edits to a script. The full run took about 2.5 minutes and cost $0.18, with the model reporting Python 3.15.1 as the newest release.

Python Microservices With gRPC

AI summaryThis tutorial teaches readers how to implement Python microservices that communicate with each other using gRPC, explaining why splitting a monolithic application into independently deployed services offers benefits like modularity, flexibility, and robustness. It covers building middleware for monitoring, performing unit and integration tests, and deploying microservices to a production environment with Kubernetes, using a web app and a Recommendations microservice as a running example.

Plotting Declarative Charts With Altair

AI summaryThe article introduces Altair, a declarative Python visualization library where users describe what their data means—such as which columns map to axes, colors, and interactivity—and the library generates the chart, unlike Matplotlib's approach of scripting every visual detail. Altair produces web-native charts (HTML and JavaScript) that render in notebooks and can be saved as standalone files or embedded in web pages, making it ideal for interactive exploratory analysis. It's not a replacement for Matplotlib, which remains the better choice for pixel-precise publication figures or 3D plots, so the two libraries serve complementary use cases.

Step 5 Draws a Python Reading a Book

AI summaryReal Python's informal AI benchmark asked the Step 5 model to write a turtle program drawing a python reading a book, but the 253-line script failed with an AttributeError and produced zero drawing commands. Across the five tasks, the model scored at Python 3.10 for modernity, passed 7 of 12 modern idiom checkpoints, correctly caught the nonexistent itertools.flatten() function, and made 1 of 10 possible unrelated edits. The full run cost $0.15, used about 49.4k thinking tokens, and took roughly 6 minutes 44 seconds.