Part 16 of the free AI Engineer course: your first AI agent. An agent chooses between several tools, keeps going until the job is done, and knows when to stop. You see a multi-step run, five stop rules, why the message history becomes a cost problem, and how to test an agent. The "model" in the demos is a mock I wrote by hand, not a real AI, and no real API call is made. In this video: - Workflow or agent? Who decides the next step - The message list is the agent's memory - A real multi-step run and its trace (list orders, then calculate) - How the description steers the choice between tools - Five ways a run ends: done, max turns, max calls, token budget, repeat - The history problem: every turn re-sends everything, and trimming old results - Testing the path, not only the answer (20 tests) - 4 exercises and a quiz CHAPTERS 0:00 Start here: your first AI agent 1:09 What an agent is 2:55 The memory of an agent 3:44 A multi-step run 4:55 Choosing between tools 6:13 Stop rules 8:07 The history problem 9:45 Testing an agent 11:25 Put it together 12:56 Your turn 14:29 Check yourself COURSE CODE (Parts 1 to 16) Part 16 files: agent.py, tools.py, schema.py, mock_agent_model.py, demo16.py, test_agent.py. No extra packages (Python 3.11+). EXERCISES 1. Add a fifth read-only tool with a four sentence description and an input schema, then write a goal that needs it and a test for the path. 2. Add a new stop rule of your own (for example a time limit), and a test that proves it ends the run. 3. Run the trim demo with keep_last set to 2 and compare the estimated tokens and the answer. 4. Stretch: write the real model function (key in .env, never in code), run the same goals, compare its traces with my mock, and keep small limits. HONEST NOTES - I had no model key and my workspace cannot reach public APIs, so no real model was used in this part. The mock model is hand-written rules, not an AI; its replies have the same shape as the real API, so the loop, stop rules, history trimming and tests are real code. The terminal screens are real runs of my own code (Linux, Python 3.13, 5 Nov 2026) with made-up orders. Token numbers are a rough estimate (about 4 characters per token), not a real tokenizer. Windows not tested. - The ideas (workflow vs agent, start with the simplest solution, stopping conditions, human checkpoints, careful tool design, testing in a sandbox) come from Anthropic's article "Building effective agents" (published 19 Dec 2024) and Tool use pages, read 5 Nov 2026; they can change. No prices quoted. SOURCES (read 5 Nov 2026) Anthropic, Building effective agents: https://www.anthropic.com/engineering/building-effective-agents Anthropic, Tool use overview: https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview Subscribe to AI Made Clear for plain English AI tips. Disclosure: the voice is AI-generated. Screens labelled real run are real terminal output from my own code with a mock model (not a real AI); other screens are illustrations. Anthropic, Python and other names belong to their owners. This channel is not affiliated with any company named. Business inquiries: rabbihossain01941@gmail.com #AIEngineer #AIAgents #Python
The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!
If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.