Building a GCP Cost Estimator with Python and Agent Development Kit (ADK)
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
Introduction
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.
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
What We’ll Build
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:
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
System Architecture
Our system follows a clean, layered architecture:
Architecture Layers
- Presentation Layer (Web UI) — Flask-based web application with responsive HTML/CSS/JavaScript
- API Layer (REST Endpoints) — Flask REST API with service routing and JSON responses
- Business Logic (Calculators) — 9 independent calculator modules, each handling one GCP service
- Data Layer (Configuration) — Centralized pricing data with regional multipliers
Code Workflow
Here’s how a cost calculation flows through the system:
Drag-and-Drop Architecture Builder
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:
How to Use
- Open the Builder — Navigate to
http://localhost:5000 - Drag Services — Grab a service card from the left palette
- Configure — Fill in service parameters in the modal
- Build Architecture — Add more services as needed
- Review Total — See total cost and breakdown on the right
Real-World Example: Web Application Stack
Cost Breakdown
Key Features
✅ 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.
Performance & Accuracy
Conclusion
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
- Modular design makes it easy to extend with new services
- Multiple interfaces serve different use cases and workflows
- Python ADK pattern enables intelligent agent capabilities
- Flask provides a simple, powerful web framework
- Drag-and-drop UI makes architecture planning intuitive
- Clean code ensures long-term maintainability
Resources
- GCP Pricing: https://cloud.google.com/pricing
- Flask Documentation: https://flask.palletsprojects.com/
- Python Dataclasses: https://docs.python.org/3/library/dataclasses.html
- Google Generative AI: https://ai.google.dev/
- Result Generation: JSON response created
- Display Results: Beautiful cost card shown to user







