{"slug": "building-an-ai-agent-in-6-weeks-and-understanding-how-they-work", "title": "Building an AI Agent in 6 Weeks (and Understanding How They Work)", "summary": "Jeff Haemer, a software veteran since the 1980s, built a production-ready AI agent with 250 unit tests and three interfaces in six weeks through a Python Agentic AI cohort, overcoming challenges with mocking and interface design. The cohort's core-first architecture proved resilient when a Telegram integration failed, allowing him to continue without blocking progress.", "body_md": "# Building an AI Agent in 6 Weeks (and Finally Understanding How They Work)\n\n*Building agentic AI? I co-run a 6-week cohort where you ship a production-ready agent, not another API wrapper.*\n\nJeff Haemer has written software since he was teaching it at the University of Colorado in the early 1980s. But he felt he needed to brush up his Python, and above all get a grounding in AI.\n\nIn his words AI was \"a big undifferentiated cloud of things I didn't know.\" Time to change that.\n\nSix weeks into our [Python Agentic AI](https://pythonagenticai.com) cohort, he ended up with an [agentic application](https://github.com/Sudavit/expenses-ai-agent) with a few thousand lines of code, almost 250 unit tests, 100% coverage, and three working interfaces: a web UI, a command line, and a Telegram bot that talks to his phone.\n\nHe even went as far as running mutation testing. More than that, through the program he developed a *mental model* of how agents actually work under the covers.\n\n## The gap\n\nJeff came in with a long career behind him and a clear-eyed view of what he was missing:\n\n\"It's a giant world and changing every day, and I didn't even know in many ways where to start. When you told me you were thinking about doing an AI cohort, I said, please do that and sign me up, and I will happily jump in feet first.\"\n\nHe set expectations low on purpose. \"I expected myself to crash and burn because I have a very spotty background.\" He'd taught plenty of courses; he knew how the first run of anything goes. He signed on as the cohort's beta tester and decided to stay enthusiastic through whatever broke.\n\nWatch the full interview with Jeff:\n\n## Core logic first, interfaces on top\n\nAn agent is a program that takes a request, reasons about it with an AI model, and acts. The cohort builds the reasoning core first, then wraps interfaces around it. That structure got tested the hard way in the Telegram week, when connecting the agent to a chat app hit a wall.\n\n\"I got to the end of that week and I wasn't even close, and I said, okay, I failed you. And you said, go on to the next week, because we designed the software so those units are independent of one another. We'll rewrite it.\"\n\nHe moved on. The Telegram unit was independent, so an unfinished interface didn't block the rest of the build. We later rebuilt that week's material from almost 100 pages down to 41, starting from a simpler working version. When Jeff came back to it, it worked.\n\n\"It was beautiful. When we hit a speed bump, that worked. It proved itself.\"\n\nThere's a meta lesson here, and a reminder of what well-designed software looks like: build the thing that does the work first, keep the edges replaceable. This saved the beta cohort from going under.\n\n## Mocking, the thing he kept putting off\n\nThe concept that gave Jeff the most trouble was mocking, the practice of replacing a real outside service (an API, a database) with a stand-in so a test can run fast and offline.\n\n\"The biggest pain for me was finally understanding what mocking involves. I even asked a friend of mine, a test automation Python guy, and he said, I never really understood that either.\"\n\nHe avoided it until week four or five, when Juanjo made it non-negotiable:\n\n\"You got me to the point where I could actually separate my unit tests, which were independent of outside services, from my integration tests. I learned stuff about pytest, I learned stuff about mocking, and I learned stuff about my own code. I just ended up thinking about things in a different way.\"\n\nJeff's rigor with the test suite paid dividends. By the end they were catching real issues, including a function that slipped coverage when he deployed to a Debian box, which he set out to track down on his own.\n\n## AI as teaching assistant, not autopilot\n\nJeff wrote the code by hand. He used AI deliberately, as a tutor for the spots where his Python ran out, not as a generator to fill the file for him.\n\n\"I understand conceptually what to do here, but I don't know enough Python to struggle through the docs and work through all the bugs in that short amount of time. So, show me how to do this. AI turns into a great teaching assistant.\"\n\nUnit tests gave each week a *definition of done*. The result is an artifact he can reason about, not a diff he has to trust on faith.\n\n## Understanding by building\n\nThe win Jeff cared about most wasn't the repo. It was the *mental model*:\n\n\"It's different having done it than even reading about it. If somebody had written an explanation, a week later I'd have a vague idea, a month later I'd say I read an article about it but don't remember anything, and two months later I'd say I've never heard of that. This, I think I understand.\"\n\nHe tested it against a toy agent he found in the wild, a hallucinating Wikipedia clone, and could trace exactly what it did: validate the input, structure it, hand it to the model, get structured output back, cache it in a database.\n\nFrom \"big undifferentiated cloud of things I didn't know\" to a firm grounding in how AI agents work. Jeff ended up with a great artifact on GitHub, but the real win has been this deeper understanding that he will take to his next AI project.\n\nWe're excited to see what Jeff will build next with this new skill set.\n\nMost AI tutorials end at \"call the API.\" This cohort ends with a deployed agent: function calling, structured outputs, three interfaces, Docker, 95%+ test coverage. Six weeks of real engineering, not notebooks. [Join the next Agentic AI cohort →](https://pythonagenticai.com)", "url": "https://wpnews.pro/news/building-an-ai-agent-in-6-weeks-and-understanding-how-they-work", "canonical_source": "https://belderbos.dev/blog/jeff-haemer-agentic-ai-cohort/", "published_at": "2026-06-17 08:52:13+00:00", "updated_at": "2026-06-17 09:24:13.596605+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "machine-learning", "ai-products"], "entities": ["Jeff Haemer", "Python Agentic AI", "University of Colorado", "Telegram", "pytest", "Debian"], "alternates": {"html": "https://wpnews.pro/news/building-an-ai-agent-in-6-weeks-and-understanding-how-they-work", "markdown": "https://wpnews.pro/news/building-an-ai-agent-in-6-weeks-and-understanding-how-they-work.md", "text": "https://wpnews.pro/news/building-an-ai-agent-in-6-weeks-and-understanding-how-they-work.txt", "jsonld": "https://wpnews.pro/news/building-an-ai-agent-in-6-weeks-and-understanding-how-they-work.jsonld"}}