DEV Community

Cover image for SustainAgent – A Multi-Agent System for Energy Insights (Google Kaggle 5-Day AI Agents Intensive Capstone)
Dravinesh
Dravinesh

Posted on

SustainAgent – A Multi-Agent System for Energy Insights (Google Kaggle 5-Day AI Agents Intensive Capstone)

Over the last few days, I completed the Google × Kaggle 5-Day AI Agents Intensive Course, and as part of the final capstone, I built SustainAgent — a simple but practical multi-agent system designed to analyze large-scale energy consumption data, detect unusual behavior, and generate meaningful weekly reports.

This project was my first attempt at structuring a system around the Agent Development Kit (ADK) concepts such as memory, sessions, agent roles, and tool-like components. Even though I didn't use the full ADK (because of execution constraints), I implemented a working multi-agent architecture inside a Kaggle notebook using Python.

What is SustainAgent?

SustainAgent is a multi-agent pipeline with three core responsibilities:

  1. DataRetriever Agent

Loads the dataset, validates important fields (like timestamps and energy values), and logs basic structure.

  1. Analyzer Agent

Performs:

  • Weekly aggregation
  • Consumption statistics
  • Trend comparison (last 7 days vs previous 7 days)
  • Anomaly detection using Isolation Forest
  1. Reporter Agent

Generates a final weekly report in Markdown and PDF, and bundles supporting artifacts like plots and CSV summaries.

Everything runs using a custom SafeSession class that stores events and memory safely in JSON, simulating the session management taught in Day 3 of the course.

Dataset Used

I used the Daily Household Energy Dataset, which contains:

3.5 million+ rows of smart-meter energy usage

Columns such as day, energy_mean, energy_sum, energy_std, etc.

Data spanning different dates across households

The sheer size made this a perfect dataset for:

  • trend analysis
  • anomaly detection
  • memory-based agent workflows
  • real operational testing inside a Kaggle notebook

Architecture Overview

Here’s how the system flows internally:

DataRetriever → Analyzer → Reporter → Output Artifacts

SafeSession

DataRetriever

  • Reads the CSV
  • Extracts date & value columns
  • Logs events like “DatasetLoaded”, “Rows: 3,510,433”

Analyzer

Computes:

  • Mean
  • Median
  • STD
  • Min/Max

Weekly grouping

  • Trend comparison
  • Isolation Forest anomaly detection

Reporter

  • Creates human-readable markdown report
  • Exports a polished PDF
  • Saves plots + summary CSVs
  • Logs report creation events

Session / Memory

A custom SafeSession class ensures all logs, timestamps, and metrics are stored in a JSON-friendly format without serialization errors. This mirrors ADK-style memory and event tracking.

Key Results

These values may differ slightly depending on execution, but during my run:

Weekly Insights

Weekly summaries saved as:
/kaggle/working/artifacts/weekly_summary.csv

Trend (Last 7 vs Previous 7 days)

On my most recent run, the trend showed:
Decreasing consumption
(Previous runs showed increasing, depending on date ranges.)

Anomalies

Using IsolationForest (contamination=0.05), we found:
~175,000 anomalous records

These represent sudden spikes, dips, or unusual usage patterns.

Generated Artifacts

  • sustain_report.md
  • sustain_report.pdf
  • timeseries.png
  • weekly_mean.png
  • weekly_summary.csv
  • anomalies.csv

These can be used directly for dashboards, stakeholder insights, or model refinement.

Screenshots

What I Learned?

This capstone helped me understand:

-How agents are structured

Even without the exact ADK, the logic of roles, sessions, and events became clearer.

-Why memory matters

Storing event logs and intermediate summaries makes agents reliable and interpretable.

-How to deal with real datasets

Handling 3.5M rows pushed me to optimize memory, fix NaN-related errors, and clean serialization logic.

-The importance of evaluation

Weekly trends, anomaly patterns, and consumption behaviors are extremely useful for real-world energy analytics.

-Stronger intuition for multi-agent pipelines

Breaking a system into separate roles helped reduce complexity and debugging time.

-Technologies Used

  • Python
  • Panda & NumPy
  • Matplotlib
  • IsolationForest (Scikit-learn)
  • FPDF
  • Custom SafeSession for JSON-safe memory
  • Kaggle Notebook runtime

Project Source

Kaggle Notebook (Public):
https://www.kaggle.com/code/dravinesh/sustainagent

This includes the full implementation, logs, plots, and downloadable artifacts.

Conclusion

SustainAgent was a great learning experience because it took the theory from the Google × Kaggle course and turned it into a practical, end-to-end working system. The project pushed me into thinking in terms of agents, sessions, reliability, and report generation, instead of only writing one big script.

This was a valuable exercise in building clean, modular AI workflows — and I’m excited to evolve SustainAgent into a more advanced system with tool calling, Gemini integration, and real-time agent interactions in the future.

Thanks for reading!
Feel free to check out the notebook or suggest improvements.

Top comments (0)