<?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: Ashish Waghode</title>
    <description>The latest articles on DEV Community by Ashish Waghode (@ashishbot120).</description>
    <link>https://dev.to/ashishbot120</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4025838%2F17fcc5af-8677-4843-bfc9-b90a7f3bad96.png</url>
      <title>DEV Community: Ashish Waghode</title>
      <link>https://dev.to/ashishbot120</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashishbot120"/>
    <language>en</language>
    <item>
      <title>I Made 4 AI Agents Argue With Each Other (Hexagonal Architecture Edition)</title>
      <dc:creator>Ashish Waghode</dc:creator>
      <pubDate>Fri, 24 Jul 2026 12:58:58 +0000</pubDate>
      <link>https://dev.to/ashishbot120/i-made-4-ai-agents-argue-with-each-other-hexagonal-architecture-edition-1in7</link>
      <guid>https://dev.to/ashishbot120/i-made-4-ai-agents-argue-with-each-other-hexagonal-architecture-edition-1in7</guid>
      <description>&lt;p&gt;Live demo:&lt;a href="https://council-of-agents-pi.vercel.app" rel="noopener noreferrer"&gt;https://council-of-agents-pi.vercel.app&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://github.com/ashishbot120/Council_of_Agents" rel="noopener noreferrer"&gt;https://github.com/ashishbot120/Council_of_Agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
The problem with asking an AI for architectural advice&lt;br&gt;
Ask a standard LLM "Should we adopt microservices?" and it will hand you a shockingly confident answer. No visible trade-offs, no edge cases considered, and zero insight into why it reached that conclusion.&lt;br&gt;
But that’s not how real engineering decisions are made.&lt;br&gt;
Real architectural choices require debate. I wanted to build something closer to actual team dynamics: multiple distinct AI perspectives arguing their side of the trade-off matrix, followed by a synthesizer that actually weighs the arguments instead of blindly picking a side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The idea&lt;/strong&gt;&lt;br&gt;
Council of Agents: four personas Optimist, Critic, Analyst, Devil's Advocate independently answer the same question. A fifth agent, the Chairman, reads all four and synthesizes one final decision.&lt;br&gt;
Real run, question: "Monorepo or multiple repos for a startup team?"&lt;/p&gt;

&lt;p&gt;Optimist (85%): monorepo unified tooling, faster onboarding&lt;br&gt;
Critic (87%): multiple repos build complexity at scale&lt;br&gt;
Analyst (80%): monorepo initially, revisit as team grows&lt;br&gt;
Devil's Advocate (85%): multiple repos avoid single point of failure&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4fc1hgiq9bwuqqe8mkc6.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4fc1hgiq9bwuqqe8mkc6.png" alt="demo-agents.png" width="800" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Chairman's synthesis: adopt a monorepo, but enforce strict modular boundaries and access controls to address the concerns the dissenters raised.&lt;br&gt;
That's more useful than any single agent's answer it absorbed the pushback into a caveat instead of ignoring it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Hexagonal (Ports &amp;amp; Adapters)&lt;/strong&gt;&lt;br&gt;
The hypothesis: if I design around interfaces instead of concrete SDKs, how cheap does it become to swap providers and survive real-world chaos?&lt;/p&gt;

&lt;p&gt;domain/            &amp;lt;- pure business logic, zero framework/SDK imports&lt;br&gt;
  entities.py         Agent, Proposal, Council, Decision&lt;br&gt;
  services/&lt;br&gt;
    deliberation_engine.py   fires all 4 agents concurrently, tolerates&lt;br&gt;
                              partial failure&lt;br&gt;
    consensus_strategy.py    swappable algorithms (Chairman, MajorityVote)&lt;/p&gt;

&lt;p&gt;application/&lt;br&gt;
  ports/              LLMProviderPort — contracts, not implementations&lt;br&gt;
  use_cases/          orchestrates domain + ports&lt;/p&gt;

&lt;p&gt;adapters/&lt;br&gt;
  outbound/llm/       OpenRouterAdapter, GroqAdapter&lt;br&gt;
  inbound/rest/       FastAPI routes&lt;/p&gt;

&lt;p&gt;infrastructure/&lt;br&gt;
  container.py        the ONE file that wires ports to adapters&lt;/p&gt;

&lt;p&gt;The rule that makes this actually hexagonal: domain/ and application/ never import a concrete adapter. DeliberationEngine calls llm_provider.get_response(role, query) with no idea which provider is behind it.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbi88zqztszgkn7afyl8b.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbi88zqztszgkn7afyl8b.png" alt="demo-deliberating.png" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Proof it's not just theory: switching the whole system from OpenRouter to Groq took one environment variable — zero lines changed outside container.py. You can even override the provider per-request:&lt;/p&gt;

&lt;p&gt;json&lt;br&gt;
POST /council/query&lt;br&gt;
{ "text": "Should we adopt microservices?", "provider": "groq" }&lt;/p&gt;

&lt;p&gt;Adding a third provider: ~50 lines&lt;br&gt;
Write OllamaAdapter implementing get_response(role, query) -&amp;gt; Proposal&lt;br&gt;
Register it in container.py&lt;br&gt;
Done — nothing in domain/, application/, or the REST layer gets touched&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9af9xu9x73zcah5wrkuf.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9af9xu9x73zcah5wrkuf.png" alt="demo-decision-openrouter.png" width="800" height="348"&gt;&lt;/a&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftouu4sn41vahj159j17j.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftouu4sn41vahj159j17j.png" alt="demo-decision-groq.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Four real production incidents&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A model got deprecated mid-project. deepseek/deepseek-r1:free vanished between picking it and testing it. Fix: model names live in one dictionary, so swapping is a one-line change, not a hunt.&lt;/li&gt;
&lt;li&gt;Two "different" free models shared one rate limit. Different slugs, same underlying host running them concurrently meant they collided on one shared bucket. Fix: pin each agent to a genuinely different upstream provider; model-name diversity ≠ provider diversity.&lt;/li&gt;
&lt;li&gt;A reasoning model returned nothing. It spent its whole token budget "thinking" and never wrote an answer json.loads("") blew up. Overcorrecting with a tight token cap caused truncated JSON instead. Fix: budget for both invisible reasoning tokens and the visible answer (max_tokens=1200), and prefer plain instruct models for structured output.&lt;/li&gt;
&lt;li&gt;A trailing slash broke CORS in production. CORS_ORIGINS=&lt;a href="https://my-app.vercel.app/" rel="noopener noreferrer"&gt;https://my-app.vercel.app/&lt;/a&gt; browsers send Origin without the trailing slash, and CORSMiddleware does an exact match. One character, total failure, no hint in the code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of these took the system down every agent call is independently caught, and the engine returns a decision from whoever did respond. That's _get_proposal_safely(), written on day one because "an external call can fail" was a first-class assumption, not an afterthought.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this is useful for&lt;/strong&gt;&lt;br&gt;
A live, non-toy example of Ports &amp;amp; Adapters&lt;br&gt;
A decision-support pattern for tradeoff-heavy questions (architecture, hiring, build-vs-buy)&lt;br&gt;
A resilience case study for anyone building on unreliable third-party APIs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's next&lt;/strong&gt;&lt;br&gt;
Postgres adapter for persistence (same port, zero domain changes)&lt;br&gt;
More consensus strategies (weighted voting, rebuttal rounds)&lt;br&gt;
Streaming individual agent responses&lt;br&gt;
A local Ollama adapter for a fully free path&lt;br&gt;
An eval harness comparing consensus strategies over time&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contributions welcome&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is very much a living project, not a finished one. If you want to add a consensus strategy, wire up a new provider adapter, or just poke holes in the architecture — PRs and issues are welcome. Good first ones to try: a local Ollama adapter, a Postgres decision repository, or a new persona.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>ai</category>
      <category>python</category>
      <category>fastapi</category>
    </item>
    <item>
      <title>Adaptive Traffic Optimization</title>
      <dc:creator>Ashish Waghode</dc:creator>
      <pubDate>Sun, 12 Jul 2026 08:53:20 +0000</pubDate>
      <link>https://dev.to/ashishbot120/adaptive-traffic-optimization-nn1</link>
      <guid>https://dev.to/ashishbot120/adaptive-traffic-optimization-nn1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem Statement&lt;/strong&gt;: Standard fixed-time traffic controllers operate on rigid, pre-programmed cycles without real-time situational awareness, leading to inefficient green-time allocation and increased congestion at unbalanced intersections.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp3fn8na4c1df67ynh787.jpeg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp3fn8na4c1df67ynh787.jpeg" alt=" " width="800" height="675"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Objective&lt;/strong&gt;: This project develops an adaptive traffic signal control system that utilizes real-time vehicle counts per approach. By leveraging a dynamic agent [or reinforcement learning agent, if applicable], the system optimizes phase sequencing to maximize throughput and minimize cumulative commuter delay.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;:I developed a closed-loop, adaptive traffic management system that replaces static signal cycles with real-time, data-driven decisions through four key components:&lt;/p&gt;

&lt;p&gt;Real-Time Perception: Deployed a YOLOv8 and OpenCV pipeline across four directional video feeds to detect, classify, and count queued vehicles within defined regions of interest.&lt;/p&gt;

&lt;p&gt;Intelligent Decision-Making: Implemented and compared two Reinforcement Learning agents a baseline Tabular Q-Learning model and a PyTorch based Deep Q-Network (DQN) trained on a custom reward function designed to minimize cumulative intersection wait times.&lt;/p&gt;

&lt;p&gt;Visual Validation: Built a custom Pygame environment to simulate intersection physics and signal states, enabling real-time visual auditing of the RL agents' behaviors.&lt;/p&gt;

&lt;p&gt;Centralized Control Plane: Wrapped the architecture in a FastAPI web application featuring asynchronous MJPEG streams of the detection feeds, live telemetry endpoints, and a frontend dashboard to monitor vehicle metrics and training performance graphs.&lt;/p&gt;

&lt;p&gt;Future Improvements:Support more intersection types generalize the fixed 4-direction setup (N/S/E/W) into a configurable N-way system, so the same agent can handle 3-way junctions, 6-way intersections, or roundabouts just by changing a config instead of the code.&lt;/p&gt;

&lt;p&gt;Phase-based signals instead of picking one direction at a time, group compatible directions into phases (e.g., opposing traffic together) like real signal controllers do.&lt;/p&gt;

&lt;p&gt;Multi-intersection coordination extend from a single junction to a network of connected signals (multi-agent RL) for corridor-level "green wave" optimization.&lt;/p&gt;

&lt;p&gt;Richer inputs factor in queue trends over time, pedestrian/cyclist detection, time-of-day patterns, and emergency vehicle preemption.&lt;/p&gt;

&lt;p&gt;Better benchmarking compare fixed-timer vs. Q-learning vs. DQN on wait time and throughput to actually quantify the improvement.&lt;/p&gt;

&lt;p&gt;Realistic simulation swap the pygame simulator for SUMO to test against real world traffic patterns before live deployment.&lt;/p&gt;

&lt;p&gt;This is a proof of concept, so there's plenty of room to build on whether it's extending the RL agent, adding support for more intersection types, or improving the simulation. Check out the repo, open an issue, or send a PR: Traffic-Optimize on GitHub &lt;br&gt;
(&lt;a href="https://github.com/ashishbot120/Traffic-Optimize" rel="noopener noreferrer"&gt;https://github.com/ashishbot120/Traffic-Optimize&lt;/a&gt;).&lt;/p&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>fastapi</category>
      <category>computervision</category>
    </item>
  </channel>
</rss>
