<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Md Roman Nihal</title>
    <description>The latest articles on DEV Community by Md Roman Nihal (@md_romannihal_590f79d4aa).</description>
    <link>https://dev.to/md_romannihal_590f79d4aa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3652933%2Fe0ebf110-879e-4725-96fc-9639d8d7a6c4.jpg</url>
      <title>DEV Community: Md Roman Nihal</title>
      <link>https://dev.to/md_romannihal_590f79d4aa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/md_romannihal_590f79d4aa"/>
    <language>en</language>
    <item>
      <title>How I Stopped My AI from Booking 60 Students into a 25-Seat Room</title>
      <dc:creator>Md Roman Nihal</dc:creator>
      <pubDate>Tue, 09 Dec 2025 06:10:27 +0000</pubDate>
      <link>https://dev.to/md_romannihal_590f79d4aa/how-i-stopped-my-ai-from-booking-60-students-into-a-25-seat-room-5del</link>
      <guid>https://dev.to/md_romannihal_590f79d4aa/how-i-stopped-my-ai-from-booking-60-students-into-a-25-seat-room-5del</guid>
      <description>&lt;p&gt;&lt;strong&gt;Subtitle:&lt;/strong&gt; &lt;em&gt;Real-world lessons from building a Multi-Agent System for the Google AI Agents Intensive.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I’ve been working with Machine Learning and Deep Learning for a while, but "AI Agents" always felt a bit abstract. I signed up for the &lt;strong&gt;5-Day AI Agents Intensive&lt;/strong&gt; with Google and Kaggle to see if they were actually useful or just another buzzword.&lt;/p&gt;

&lt;p&gt;For my capstone, I decided to tackle a problem I know is genuinely hard: &lt;strong&gt;University Timetabling&lt;/strong&gt;. It’s a classic constraint-satisfaction problem. You have courses, professors, rooms, and time slots. Everything has to fit perfectly.&lt;/p&gt;

&lt;p&gt;I thought, I'll just feed the data to Gemini and let it figure it out.&lt;/p&gt;

&lt;p&gt;I was wrong. Here is exactly how I failed, and how I finally got it working.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attempt 1: The Monolithic Agent
&lt;/h2&gt;

&lt;p&gt;My first approach was to dump all my JSON data (courses, rooms, professor preferences) into the system prompt of a single agent and simply tell it to schedule everything.&lt;/p&gt;

&lt;p&gt;The result was a mess. The agent didn't just fail; it hallucinated.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It invented time slots that didn't exist.&lt;/li&gt;
&lt;li&gt;It successfully booked &lt;code&gt;CS_101&lt;/code&gt; (which needs 60 seats) into &lt;code&gt;Lab_201&lt;/code&gt; (which has 25 seats).&lt;/li&gt;
&lt;li&gt;It claimed there were conflicts when the schedule was empty.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I realized pretty quickly that &lt;strong&gt;LLMs are reasoning engines, not magic wands.&lt;/strong&gt; You can't just throw a massive logic puzzle at them in a single turn and expect a perfect output.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Sequential Loops (Version 2)
&lt;/h2&gt;

&lt;p&gt;I had to stop thinking like a prompt engineer and start thinking like a software engineer. The problem wasn't the model; it was the &lt;strong&gt;control flow&lt;/strong&gt;. Trying to solve 50 conflicts simultaneously is hard for a human, let alone an LLM.&lt;/p&gt;

&lt;p&gt;I decided to re-architect the system using the &lt;strong&gt;Google Agent Development Kit (ADK)&lt;/strong&gt; to implement a &lt;strong&gt;Loop Agent&lt;/strong&gt; pattern.&lt;/p&gt;

&lt;p&gt;Instead of saying "Schedule these 50 courses", I built a sequential pipeline that processes the problem step-by-step:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fznnv8r6fhi2ho0mak411.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fznnv8r6fhi2ho0mak411.png" alt=" " width="712" height="789"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Bidding Agent:&lt;/strong&gt; Interviews departments to get a "wish list" of schedules.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Processing Loop:&lt;/strong&gt; Pops one course request from the stack.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Validation:&lt;/strong&gt; Tries to book it using strict Python tools.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Negotiation:&lt;/strong&gt; If it fails (conflict), it negotiates an alternative &lt;em&gt;just for that one course&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Repeat.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By forcing the agent to focus on one constraint at a time, the hallucinations stopped. The system actually started reasoning. When it couldn't book &lt;code&gt;CS_101&lt;/code&gt;, it correctly reported: &lt;em&gt;"No room exists with both 60 seats and computers"&lt;/em&gt;, rather than just forcing a bad booking.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Actually Learned
&lt;/h2&gt;

&lt;p&gt;Going through this process—building, breaking, and rebuilding—taught me three specific things about Agentic AI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Tools are Guardrails:&lt;/strong&gt; I wrote Python functions like &lt;code&gt;book_room()&lt;/code&gt; to act as the interface to my database. These tools threw errors if the agent tried to do something illegal (like double-booking). This forced the LLM to stay grounded in reality.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;State Management is Hard:&lt;/strong&gt; The trickiest part wasn't the AI; it was managing the session state. Passing the list of "unbooked courses" cleanly from one agent to the next in the loop was the key engineering challenge.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Architecture &amp;gt; Intelligence:&lt;/strong&gt; A team of simple, specialized agents (even using a lighter model like Gemini 2.5 Flash Lite) outperforms one massive, complex agent every time.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;"Agora" (my project) isn't perfect, but it works. It takes raw requirements and autonomously negotiates a valid schedule.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔗 Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kaggle Notebook:&lt;/strong&gt; &lt;a href="https://www.kaggle.com/code/romannihal/ai-agent-hackathon-v2" rel="noopener noreferrer"&gt;https://www.kaggle.com/code/romannihal/ai-agent-hackathon-v2&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>googleaichallenge</category>
      <category>ai</category>
      <category>agents</category>
      <category>devchallenge</category>
    </item>
  </channel>
</rss>
