<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amr Abdelaty on Medium]]></title>
        <description><![CDATA[Stories by Amr Abdelaty on Medium]]></description>
        <link>https://medium.com/@amr.abdelaty5445?source=rss-bd17ebdc8e02------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tZHSuVqCL1CxkLQoRuqxJg.png</url>
            <title>Stories by Amr Abdelaty on Medium</title>
            <link>https://medium.com/@amr.abdelaty5445?source=rss-bd17ebdc8e02------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:38:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amr.abdelaty5445/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Production-Grade AI Agent, Part 1: The 7-Layer Project Structure]]></title>
            <link>https://medium.com/@amr.abdelaty5445/building-a-production-grade-ai-agent-part-1-the-7-layer-project-structure-fce283d5a67a?source=rss-bd17ebdc8e02------2</link>
            <guid isPermaLink="false">https://medium.com/p/fce283d5a67a</guid>
            <category><![CDATA[production-ai-agent]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Amr Abdelaty]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 10:35:11 GMT</pubDate>
            <atom:updated>2026-08-22T10:35:11.349Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why most AI agent projects never make it to production</h3><p>Open ten “AI agent” repos on GitHub and you’ll see the same story nine times: a main.py, a requirements.txt, maybe a .env, and a prompt hardcoded somewhere in the middle of a 400-line file. It works great in a notebook. It works fine in a demo. Then someone asks &quot;how do we deploy this, monitor it, and evaluate whether it&#39;s actually getting better or worse over time?&quot; — and the project quietly stalls.</p><p>The gap between a <em>working</em> AI agent and a <em>production-grade</em> AI agent isn’t the model. It’s everything around the model: how the code is organized, how config is managed across environments, how you containerize and ship it, how you observe it once it’s live, and how you keep proving — with evidence, not vibes — that it still works after every change.</p><p>This is the first article in a series where I’ll walk through building a production-grade <strong>Web Assistant AI Agent</strong> from the ground up. Before we write a single line of agent logic, we need the skeleton it’s going to live in. That’s what this article is about: a battle-tested, 7-layer project structure, and exactly how to scaffold it on the command line.</p><p>By the end you’ll have a repo structure that’s ready for real engineering work — one that a serious AI/backend team would recognize as “production-grade” the moment they open it.</p><h3>The 7 layers of a production-grade AI agent project</h3><p>Think of the project not as a flat pile of folders, but as seven distinct layers, each with one job:</p><ol><li><strong>Foundation Layer</strong> — project identity, dependencies, licensing, docs</li><li><strong>Configuration Layer</strong> — environment-specific secrets and settings</li><li><strong>Source Layer</strong> — the actual agent logic</li><li><strong>Containerization Layer</strong> — how it ships and runs anywhere</li><li><strong>Observability Layer</strong> — how you see what it’s doing in production</li><li><strong>Evaluation Layer</strong> — how you prove it works, before and after every change</li><li><strong>Tooling &amp; Automation Layer</strong> — CI/CD, editor config, scripts, and runtime storage</li></ol><p>Let’s go through each one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tF7FwFViu3hrilPk3ECzg.png" /></figure><h3>1. Foundation Layer</h3><p>This is the project’s identity — the stuff that answers “what is this, who owns it, how do I install it.”</p><ul><li>pyproject.toml — single source of truth for dependencies, build config, and tool settings (ruff, mypy, pytest, etc.)</li><li>.python-version — pins the exact Python version so every dev and every environment matches</li><li>README.md — what the project is, how to run it</li><li>LICENSE — non-negotiable if this is ever open-sourced or shared</li><li>Makefile — one-word commands (make test, make run, make lint) instead of a README full of shell incantations everyone half-remembers</li></ul><h3>2. Configuration Layer</h3><p>AI agents talk to APIs — model providers, vector stores, external tools. Each environment needs its own keys and settings, and none of them belong in source code.</p><ul><li>.env — your actual local secrets (never committed)</li><li>.env.example — a template with the <em>keys</em> but no real values, so new devs know exactly what to configure</li><li>.env.development — dev-environment defaults</li><li>.env.production — production-environment defaults (values injected securely at deploy time, not committed with real secrets)</li></ul><h3>3. Source Layer</h3><ul><li>src/ — the actual agent: graph/workflow definitions, tools, prompts, retrieval logic, API layer. Everything that makes the agent <em>an agent</em> lives here, cleanly separated from infra and tooling.</li></ul><h3>4. Containerization Layer</h3><ul><li>docker/ — Dockerfiles, docker-compose configs, entrypoint scripts. This is what makes &quot;works on my machine&quot; irrelevant — the agent runs identically in dev, staging, and prod.</li></ul><h3>5. Observability Layer</h3><p>If you can’t see what your agent is doing in production, you don’t have a production system — you have a black box you’re hoping doesn’t break.</p><ul><li>prometheus/ — metrics collection: latency, token usage, error rates, tool-call counts</li><li>grafana/ — dashboards built on top of those metrics, so problems are visible before a user complains</li></ul><h3>6. Evaluation Layer</h3><ul><li>evals/ — this is what separates a serious AI project from a toy. Automated evaluation sets, golden datasets, scoring scripts, regression checks that run whenever the prompt, model, or logic changes. Without this layer, every change to the agent is a guess.</li></ul><h3>7. Tooling &amp; Automation Layer</h3><ul><li>.github/ — CI/CD workflows: linting, tests, evals, and deployment pipelines running automatically on every push/PR</li><li>.vscode/ — shared editor settings so the whole team gets consistent formatting, linting, and debug configs</li><li>scripts/ — one-off and recurring operational scripts (data migrations, seed scripts, maintenance tasks)</li><li>storage/ — local/runtime storage for artifacts, caches, or generated files the agent produces at runtime</li></ul><h3>Scaffolding it from scratch</h3><p>Here’s how to create this entire structure from an empty folder, using nothing but mkdir and touch.</p><pre># Create the project root and move into it<br>mkdir production-grade-ai-agent<br>cd production-grade-ai-agent</pre><pre># --- Layer 1: Foundation ---<br>touch pyproject.toml .python-version README.md LICENSE Makefile .gitignore</pre><pre># --- Layer 2: Configuration ---<br>touch .env .env.example .env.development .env.production</pre><pre># --- Layer 3: Source ---<br>mkdir src</pre><pre># --- Layer 4: Containerization ---<br>mkdir docker</pre><pre># --- Layer 5: Observability ---<br>mkdir prometheus grafana</pre><pre># --- Layer 6: Evaluation ---<br>mkdir evals</pre><pre># --- Layer 7: Tooling &amp; Automation ---<br>mkdir -p .github/workflows .vscode scripts storage</pre><p>That’s the whole skeleton — nine mkdirs and one touch batch, and you already have a structure most projects never reach.</p><h3>The trap: Git doesn’t track empty folders</h3><p>Here’s something that catches a lot of people off guard: <strong>Git tracks files, not folders.</strong> If you create an empty evals/ or storage/ directory and run git add ., Git will silently ignore it. Push your repo to GitHub, and your teammate clones it — no evals/ folder. No storage/ folder. The structure you carefully designed just... isn&#39;t there.</p><p>The fix is a well-known convention: drop a placeholder file called .gitkeep inside every folder you want Git to track, even while it&#39;s empty. .gitkeep has no special meaning to Git itself — it&#39;s just a file, and an empty folder with a file in it is no longer empty, so Git tracks it.</p><pre>touch {src,docker,prometheus,grafana,evals,scripts,storage,.github/workflows,.vscode}/.gitkeep</pre><p>As you add real files to a folder later (say, your first workflow module inside src/), the .gitkeep becomes unnecessary — you can safely delete it, since the folder is now tracked because it has real content.</p><h3>Verifying the structure</h3><p>Once it’s scaffolded, you’ll want to actually <em>see</em> it — cleanly, without Git’s internal .git/ folder cluttering the output. The tree command with the right flags does exactly that:</p><pre>tree -a -I &#39;.git&#39;</pre><ul><li>-a shows hidden files too (so .env, .gitignore, .gitkeep etc. actually show up)</li><li>-I &#39;.git&#39; excludes the .git folder from the listing, since it&#39;s internal bookkeeping, not part of your project structure</li></ul><p>Run that from your project root any time you want a sanity check that your 7 layers are all in place and being tracked correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4AEUyI6wp20Un4ECu0XPA.png" /></figure><h3>What’s next</h3><p>At this point you have a project that <em>looks</em> production-grade before you’ve written a single line of agent logic — and that’s the point. Structure isn’t a formality; it’s what makes every layer that comes after (configuration management, containerized deployment, observability, evaluation, CI/CD) possible without a rewrite.</p><p>In the next article, we’ll go one level deeper into <strong>project setup</strong>: wiring up pyproject.toml properly, structuring src/ for a real LangGraph-based Web Assistant agent, and setting up the Makefile commands that will drive everything else in this series.</p><p>If you’re building AI agents and want them to survive contact with production, getting this skeleton right first will save you weeks later.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fce283d5a67a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>