DEV Community

Cover image for From Prompts to Purpose: Building AI Agents That Actually Heal Cities
adrija
adrija

Posted on

From Prompts to Purpose: Building AI Agents That Actually Heal Cities

The Moment Everything Clicked

Five days ago, I thought AI agents were just chatbots with extra steps. Today, I'm watching three autonomous agents coordinate in real-time to predict environmental interventions for Delhi's air quality crisis. This isn't science fiction—it's what happens when you stop thinking about AI as a question-answering machine and start treating it as a collaborating intelligence.

The Kaggle 5-Day AI Agents Intensive didn't just teach me to build agents. It fundamentally rewired how I think about solving problems with AI.

Day 1: When "Intelligence" Learned to Take Action

The first breakthrough was deceptively simple: agents don't just respond—they act.

We started with a basic agent that could use Google Search. But that single tool transformed everything. Suddenly, my AI wasn't frozen in January 2025. It could check today's news, verify current data, and ground its responses in reality. The lightbulb moment? Intelligence without action is just expensive autocomplete.

The multi-agent patterns—Sequential, Parallel, and Loop—revealed something profound: complex problems need specialized minds working together, not one generalist trying to do everything. Just like you wouldn't ask a surgeon to also design the hospital, pilot the helicopter, and manage the pharmacy.

The insight that stuck: Multi-agent systems aren't about making AI more complex. They're about making it more capable through collaboration.

Day 2: The Tool Revelation

Day 2 demolished my understanding of what "tools" meant. I'd been thinking too small.

Custom Python functions as tools? I built a carbon calculator that could compute emissions across transportation, energy, and food with scientific precision. The agent didn't just have knowledge—it had specialized computational capabilities.

Agents as tools for other agents? Mind-bending. My DataCollector agent became a tool for my Coordinator agent. Suddenly, I wasn't building isolated programs—I was building an ecosystem where intelligences could delegate to each other.

External MCP servers? This opened the door to consuming services from anywhere, creating truly extensible systems.

But the real game-changer was understanding long-running operations. Some tasks can't complete in one shot. They need to pause, wait for external input, maintain state, and resume. This pattern—pausable, resumable workflows—is what separates toy demos from production systems.

The paradigm shift: Tools aren't just features you add to agents. They're how agents interface with reality and with each other.

Day 3: Memory—The Difference Between Clever and Wise

This day broke my brain in the best way.

I'd been conflating Session (short-term, single conversation) with Memory (long-term, cross-conversation knowledge). Understanding this distinction was like realizing RAM and hard drives serve different purposes.

Sessions handle the immediate context—what we're talking about right now. Memory builds knowledge over time—what you've always preferred, warned me about, or asked for.

The context compaction pattern was brilliant: as conversations grow, intelligently prune less important memories based on access frequency and recency. This prevents memory overflow while preserving valuable historical context. It's not just storage—it's intelligent forgetting.

What this unlocked: Agents that learn from experience rather than starting from scratch every conversation. That's when AI starts feeling less like a tool and more like a colleague.

Day 4: Observability and Evaluation—Making AI Trustworthy

You can't improve what you don't measure. You can't trust what you can't inspect.

Day 4 taught me that production AI needs two complementary approaches:

Observability (reactive): Logs, traces, and metrics that help you debug after something goes wrong. Every agent action gets structured logging. Every workflow gets a trace ID so you can reconstruct execution paths. Every performance metric gets tracked.

Evaluation (proactive): Agents that continuously assess their own performance and flag issues before users encounter them. My Pollution Predictor agent calculates quality scores based on completeness, confidence, and relevance. It knows when it's uncertain.

This combination transforms AI from a black box into a transparent, improvable system.

The professional insight: If you're not implementing observability and evaluation, you're building a prototype, not a product.

Day 5: The A2A Protocol and Production Deployment

The final pieces fell into place: interoperability and deployment.

The Agent-to-Agent (A2A) Protocol standardizes how agents communicate across frameworks, languages, and even organizations. When my DataCollector sends a "data_ready" message to my Predictor, it's using a protocol that any compliant agent can understand. This isn't vendor lock-in—it's an open ecosystem.

And deployment? Moving from "it works on my machine" to "it's running in production serving real users" using Vertex AI Agent Engine and Streamlit Cloud. Because an agent that only lives in your notebook is just an expensive science experiment.

The Capstone: EcoGuardian AI

Everything crystallized in my capstone project: EcoGuardian AI—an autonomous multi-agent system for urban environmental regeneration.

The Problem

Urban pollution costs the global economy over $100 billion annually. Cities drown in data from weather APIs, air quality sensors, and emissions monitors—but that data just sits there. Meanwhile, sustainability initiatives struggle to coordinate interventions across multiple domains. What's needed is a system that can autonomously sense, analyze, predict, and act.

The Solution: Collaborative Intelligence

I built three specialized agents:

1. DataCollector Agent (Parallel Pattern)
Simultaneously queries weather APIs, air quality services, and pollutant databases. Instead of waiting for sequential API calls, it uses asyncio.gather to fetch data in parallel—critical for time-sensitive environmental monitoring.

2. Pollution Predictor Agent (Sequential Pattern + Gemini 2.5 Flash)
The cognitive core. Receives structured environmental data and uses Google Gemini AI to predict optimal interventions. It doesn't just apply rules—it understands contextual nuances, compares historical patterns, and generates recommendations with confidence scores. And crucially, it evaluates its own predictions, tracking quality scores and adapting based on outcomes.

3. Action Deployer Agent (Loop Pattern)
Translates predictions into deployment plans: environmental impact calculations, cost estimates, optimal zones, success tracking. For continuous monitoring, it implements an iterative loop—repeatedly checking conditions and triggering interventions when thresholds are exceeded.

4. Coordinator Agent (A2A Protocol)
Orchestrates everything through standardized message-passing. When data collection completes, it sends "data_ready" to the Predictor. When predictions finish, it sends "predictions_ready" to the Deployer. This architecture makes the system flexible and extensible—agents can be added, removed, or upgraded without breaking the workflow.

The Tools

  • Custom Tool: Carbon Calculator with scientific emission factors
  • Built-in Tool: Google Search for climate news aggregation
  • OpenAPI Tool: OpenWeatherMap integration for real-time environmental data

The Intelligence

Memory management with context compaction ensures the system learns over time without overflow. Complete observability (logs, traces, metrics) makes every decision transparent. Agent self-evaluation creates feedback loops for continuous improvement.

The Impact

For Delhi (AQI: Very Poor), EcoGuardian predicts:

  • 5 AI-generated interventions
  • 22,250 kg CO2 reduction annually
  • Equivalent to planting 1,059 trees

For personal carbon tracking, it shows individuals their footprint (e.g., 148.6 kg CO2 weekly) and offset requirements (367 trees)—driving behavior change through personalized insights.

What I Actually Learned

This course didn't teach me to prompt engineer better. It taught me to architect intelligence.

Before: AI was a powerful pattern-matcher that could write code or answer questions.

After: AI is a building block for creating autonomous systems that sense, reason, and act in the real world—continuously adapting without human intervention.

The shift is from generating responses to orchestrating behavior. From one-shot completions to continuous operation. From helpful assistants to autonomous agents.

The Bigger Picture

We're at an inflection point. The question isn't "Can AI answer questions?" anymore. It's "Can AI coordinate specialized intelligences to solve complex, real-world problems autonomously?"

EcoGuardian proves the answer is yes. Not through one superintelligent agent trying to do everything, but through specialized agents collaborating through standardized protocols—each autonomous, each observable, each evaluating its own performance.

This is the future of AI: not smarter monoliths, but coordinated ecosystems of specialized intelligences working together to heal cities, manage supply chains, coordinate disaster response, and solve problems we haven't even imagined yet.

Call to Action

If you're still thinking about AI as "ChatGPT with extra features," you're missing the revolution. Multi-agent systems represent a fundamental shift in how we build intelligent software. The tools are here. The patterns are proven. The only question is: what will you build?

Me? I'm already imagining EcoGuardian v2.0—with reinforcement learning agents that optimize interventions based on real deployment outcomes, federated learning across cities to share best practices while preserving privacy, and integration with IoT sensor networks for hyperlocal monitoring.

The 5-Day AI Agents Intensive gave me the foundation. The rest is up to my imagination—and yours.


Built with: Agent Development Kit (ADK), Google Gemini 2.5 Flash, Streamlit, Python asyncio, OpenWeatherMap API

Deployed to: Streamlit Cloud (production-ready)

Source code and architecture diagrams available upon request

Top comments (0)