Sitemap
Linesh Thakre

Linesh Thakre

Building a GCP Cost Estimator with Python and Agent Development Kit (ADK)

5 min readDec 15, 2025

--

How to Create an Intelligent Cloud Cost Calculator with Flask, Python Agents, and Modern Drag-and-Drop Web UI

Get Linesh Thakre’s stories in your inbox

Join Medium for free to get updates from this writer.

Estimate Google Cloud Platform costs in seconds with this powerful, open-source tool

Press enter or click to view image in full size

Introduction

Press enter or click to view image in full size

Cloud cost management is one of the biggest challenges organizations face when moving to Google Cloud Platform. Without proper planning, costs can spiral out of control. In this article, I’ll show you how to build a comprehensive GCP cost estimator using Python’s Agent Development Kit (ADK) pattern, combined with a modern Flask web interface.

Press enter or click to view image in full size

What Makes This Different

Unlike simple calculators that only handle one or two services, our tool:

  • ✅ Supports 9 different GCP services
  • ✅ Provides detailed cost breakdowns
  • ✅ Offers both CLI and web interface
  • ✅ Features drag-and-drop architecture builder NEW!
  • ✅ Uses modular, extensible architecture
  • ✅ Built with production-ready Python code
Press enter or click to view image in full size

What We’ll Build

Press enter or click to view image in full size

We’re creating a complete cost estimation system with four interfaces:

1. Python Calculator Modules

Direct programmatic access to cost calculations:

from calculators import compute

result = compute.calculate('n1-standard-2', 'us-central1', 50, 2)
print(f"Monthly cost: ${result['total_monthly_cost']:.2f}")

2. Drag-and-Drop Architecture Builder ⭐ NEW!

Visual interface for building multi-service architectures:

Press enter or click to view image in full size
Press enter or click to view image in full size

3. AI Agent Interface

Conversational cost estimation using Google’s Generative AI:

from agent import GCPCostEstimatorAgent

agent = GCPCostEstimatorAgent()
response = agent.estimate("What's the cost for 2 VMs and a database?")

4. Simple Web Calculator

Single-service calculator with clean form interface

Press enter or click to view image in full size

System Architecture

Press enter or click to view image in full size

Our system follows a clean, layered architecture:

Press enter or click to view image in full size

Architecture Layers

  1. Presentation Layer (Web UI) — Flask-based web application with responsive HTML/CSS/JavaScript
  2. API Layer (REST Endpoints) — Flask REST API with service routing and JSON responses
  3. Business Logic (Calculators) — 9 independent calculator modules, each handling one GCP service
  4. Data Layer (Configuration) — Centralized pricing data with regional multipliers
Press enter or click to view image in full size

Code Workflow

Press enter or click to view image in full size

Here’s how a cost calculation flows through the system:

Press enter or click to view image in full size
Press enter or click to view image in full size

Drag-and-Drop Architecture Builder

Press enter or click to view image in full size

The star feature of our tool is the visual architecture builder that lets you design complete cloud infrastructures.

Interface Layout

The builder uses a 3-column layout:

Press enter or click to view image in full size

How to Use

  1. Open the Builder — Navigate to http://localhost:5000
  2. Drag Services — Grab a service card from the left palette
  3. Configure — Fill in service parameters in the modal
  4. Build Architecture — Add more services as needed
  5. Review Total — See total cost and breakdown on the right
Press enter or click to view image in full size

Real-World Example: Web Application Stack

Press enter or click to view image in full size
Press enter or click to view image in full size

Cost Breakdown

Press enter or click to view image in full size
Press enter or click to view image in full size

Key Features

Press enter or click to view image in full size

✅ Modular Design

Each GCP service is a separate, independent module. Adding new services only requires creating a calculator module and updating the UI configuration.

✅ Multiple Interfaces

Use the tool programmatically via Python, through an AI agent, or with the beautiful web UI — whatever fits your workflow.

✅ Detailed Breakdowns

Every calculation includes total monthly cost, component breakdown, and the configuration used.

✅ Export Capabilities

Save your architectures as JSON for documentation, team sharing, or later review.

Press enter or click to view image in full size

Performance & Accuracy

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Conclusion

Press enter or click to view image in full size

We’ve built a comprehensive GCP cost estimator that:

  • ✅ Supports 9 essential GCP services
  • ✅ Provides four different interfaces (CLI, Agent, Simple Web, Drag-Drop)
  • ✅ Uses clean, modular architecture
  • ✅ Delivers instant cost estimates
  • ✅ Includes detailed breakdowns
  • ✅ Features drag-and-drop visual builder
  • ✅ Ready for production use

Key Takeaways

  1. Modular design makes it easy to extend with new services
  2. Multiple interfaces serve different use cases and workflows
  3. Python ADK pattern enables intelligent agent capabilities
  4. Flask provides a simple, powerful web framework
  5. Drag-and-drop UI makes architecture planning intuitive
  6. Clean code ensures long-term maintainability
Press enter or click to view image in full size

Resources

Press enter or click to view image in full size
Press enter or click to view image in full size
  1. Result Generation: JSON response created
  2. Display Results: Beautiful cost card shown to user

--

--