Building EcoLens: How We Used the AWS Open-Source Strands Agents SDK to Solve Urban Waste Segregation and Clean Air in India
Over 70% of urban waste in India reaches landfills due to confusion at the kitchen bin. Here is how we used the AWS open-source Strands Agents SDK to architect an autonomous AI co-pilot with real-time vision waste segregation, budget-conscious ₹ swaps, and live CPCB air quality tracking
Building EcoLens: How We Used the AWS Open-Source Strands Agents SDK to Solve Urban Waste Segregation and Clean Air in India
By Suvi Negi — AI System Architect & Full-Stack Developer
🌍 The Problem: Why Urban Sustainability Fails at the Kitchen Bin
Walk down any street in an Indian metropolitan city, and you will see the same scene: municipal sanitation workers manually sifting through mountains of mixed garbage.
In India, over 70% of recyclable municipal solid waste ends up directly in landfills. Why? Not because citizens don't care, but because source segregation is frustratingly ambiguous. Is an oily pizza box dry or wet waste? Can you recycle a blister pack? Should the corner snip of a milk packet be cut off or left attached?
At the same time, two other barriers prevent sustainable living:
- The "Green Premium": Eco-friendly products are often marketed as luxury lifestyle goods (e.g., ₹500 bamboo cups or ₹1,500 electric toothbrushes), alienating everyday middle-class households.
- Passive Air Alerts: Weather apps display numbers like "AQI 280" with zero actionable health guidance for a father walking his child to school or a student cycling to college.
To fix this, we built EcoLens—an autonomous personal eco-assistant that combines real-time computer vision, hyper-localized Indian pricing, live atmospheric math, and habit gamification.
Here is how we architected EcoLens using the AWS open-source Strands Agents SDK.
🏗️ System Architecture: The AWS Strands Agents Core
When designing an assistant that needs to handle camera streams, converse naturally, and execute deterministic calculations, traditional rigid rule-engines fail. We needed an autonomous agent loop that could dynamically decide when to inspect a photo, when to query an AQI API, and when to look up cost-effective swaps.
We chose the AWS open-source Strands Agents SDK (
strands-agents ) as the reasoning core of our backend:- Client Layer (Next.js 14): WebRTC camera viewfinder streaming live video frames + responsive dark forest-green glassmorphic dashboard.
- Server Layer (FastAPI): Asynchronous REST endpoints handling vision payloads and chat sessions.
- Reasoning Core (AWS Strands Agent): Manages multi-turn conversational context, automated retry recovery (
ModelRetryStrategy), and autonomous dynamic dispatch across four domain tools.
💻 Under the Hood: Implementing Strands Agents
The AWS Strands Agents SDK provides an elegant, Pythonic interface for building tool-enabled agents with built-in retry mechanisms and conversational history.
In our
backend/agent.py , we initialize the Strands agent with our domain-specific tools:With ModelRetryStrategy , our agent automatically recovers from transient network glitches or rate limits, guaranteeing a smooth experience for users scanning items in real time.
🔍 The 4 Specialized Agent Tools
Instead of relying on LLM hallucinations for environmental facts, we built four deterministic tools that the Strands agent invokes autonomously:
1. Multimodal Waste Classification ( classify_waste )
When a user points their webcam or uploads an image, the image is passed into
classify_waste . The tool analyzes the material and assigns it to one of five bins:- Dry Waste: Clean plastics, cardboard, paper, metals.
- Wet Waste: Organic food scraps, vegetable peels, garden waste.
- Sanitary Waste: Diapers, hygiene products (requires separate wrapping).
- Hazardous Waste: Paints, chemicals, expired medicines, batteries.
- E-Waste: Broken cables, chargers, electronics.
Crucially, it provides actionable municipal prep rules. For example, when scanning a milk packet:
"Rinse the pouch clean and dry it. When cutting open, keep the snip corner attached to the packet—loose plastic corners slip through sorting machines and choke municipal recycling shredders!"
2. Budget-First Swaps in ₹ ( get_eco_swaps )
Most sustainability apps recommend ₹600 imported products. EcoLens specifically targets the Indian household budget:
- Budget Swap: A 4-pack of bamboo toothbrushes for ₹120 (affordable for anyone).
- Premium Swap: An electric toothbrush with replaceable heads for ₹1,299.
- Impact Metrics: Directly calculates
% plastic saved(e.g., 95%) andestimated kg CO2 saved(e.g., 0.35 kg).
3. Live Atmospheric Math with Indian CPCB Breakpoints ( get_aqi )
Global apps report US-AQI, which uses different standards than India's Central Pollution Control Board (CPCB).
EcoLens queries live PM2.5 and PM10 particulate readings from the Open-Meteo Air Quality API and calculates the official Indian AQI using linear sub-index interpolation:
I=Ihi−IloBhi−Blo×(C−Blo)+IloI = \frac{I_{hi} - I_{lo}}{B_{hi} - B_{lo}} \times (C - B_{lo}) + I_{lo}I=Bhi−BloIhi−Ilo×(C−Blo)+Ilo
The final AQI is selected as the higher of the PM2.5 and PM10 sub-indices. We cache these results in-memory for 10 minutes to maintain lightning-fast response times, with an offline fallback dataset ensuring zero downtime.
4. Activity-Tailored Exposure Guidance ( air_advice )
A raw AQI number doesn't tell a commuter what to do. EcoLens cross-references the AQI with the user's intended activity (e.g., cycling, running, morning walk, or school commute), recommending specific actions (N95 mask usage, indoor alternatives, or time-of-day shifting).
🌱 Habit Formation: The EcoGame Sanctuary
Knowledge alone doesn't change behavior—incentives do.
We integrated an EcoGame into the Next.js frontend:
- Botanical Sanctuary: Users grow virtual native and medicinal plants (Tulsi, Sunflower, Marigold, Lotus, Hibiscus) across 5 growth stages.
- Green Pomodoro Timer: A 15m/25m/50m focus timer that waters plants as users focus on their work.
- Daily Sustainable Checklist: Atomic task tracking where users earn Eco-Points and coins for everyday actions like carrying a cotton tote or composting wet waste.
🚀 Scaling on AWS: Production Architecture
While EcoLens was prototyped locally under the hackathon's open-source track, its containerized architecture is built for seamless AWS deployment:
- Amazon App Runner / AWS ECS (Fargate): Zero-config serverless container deployment for the FastAPI backend and Next.js frontend.
- Amazon S3: Secure object storage for municipal waste image dataset audits.
- Amazon CloudWatch: End-to-end telemetry monitoring tool execution latencies and agent tokens.
🎯 Conclusion: Smarter Tools, Cleaner Cities
Solving India's waste and air challenges doesn't require forcing citizens into expensive lifestyle changes. It requires removing friction at the exact moment of decision—whether standing over a waste bin or checking if it's safe to run outside.
By leveraging the AWS open-source Strands Agents SDK, we were able to build a resilient, multi-modal, and truly helpful AI assistant in record time.
Python
from strands import Agentfrom strands.event_loop._retry import ModelRetryStrategyfrom tools import classify_waste, get_eco_swaps, get_aqi, air_adviceSYSTEM_PROMPT = ("You are EcoLens, a friendly, encouraging personal eco-assistant 🌍. ""Guide users toward a sustainable future without guilt-tripping. ""Always offer practical, budget-aware alternatives in Indian Rupees (₹). ""Use your tools for swaps, waste disposal, and air-quality advice.")ALL_TOOLS = [classify_waste, get_eco_swaps, get_aqi, air_advice]def build_agent(provider="gemini"):model = _create_model(provider)agent = Agent(model=model,system_prompt=SYSTEM_PROMPT,tools=ALL_TOOLS,retry_strategy=ModelRetryStrategy(max_retries=3))return agent
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article