What would it take for my AI agent to be aware of GCP inventory in my GCP project?

I need my AI agent (written in ADK if at all it matters) to be real-time aware of my GCP inventory. What would it take to get the GCP inventory in 1st place , asset inventory API for example and the 2nd part of my question is , is it recommended to store this inventory in a relational database? Remember again the end goal is to have the latest snapshot of the inventory at any point , no eventual consistency :slightly_smiling_face:

Note:- We are in the AI agent era. It would be nice to have a separate section / location whatever you may call it , dedicated to AI agents

Hi dheerajpanyam,

Welcome to Google Cloud Community!

To make your agent aware of your GCP inventory, you’ll want to use Google Cloud Asset Inventory API, which provides a centralized view of all your GCP resources. Here’s how to approach it:

  • Enable the API: Make sure the Cloud Asset Inventory API is enabled in your GCP project.
  • Use searchAllResources or listAssets:
    • searchAllResources: Great for querying resources across projects, folders, or organizations.
    • listAssets: Returns a snapshot of assets at a given timestamp.
  • Set up Asset Feeds:
    • Use feeds.create to subscribe to real-time updates on asset changes.
    • These feeds can push updates to Pub/Sub, which your agent can listen to for near-instant awareness.
  • Automate with Cloud Scheduler:
    • Schedule periodic exports to BigQuery or Cloud Storage using exportAssets.
    • This helps maintain historical snapshots if needed.

For your goal of real-time snapshot access and if your agent needs strong consistency and structured querying, a relational database like PostgreSQL or Cloud SQL is a solid choice. You can ingest asset snapshots via scheduled exports or Pub/Sub listeners and keep the latest state updated in real time.

You may consider creating a dedicated microservice or module within your agent framework that:

  • Subscribes to asset feeds via Pub/Sub
  • Ingests updates into your chosen DB
  • Exposes a clean API for querying current inventory
  • Optionally, uses caching for ultra-fast access

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Thank you so much for the detailed explanation @ruthseki