tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > ADK with Google Drive - File Management

ADK with Google Drive - File Management

Author: Venkata Sudhakar

Google Drive acts as the document backbone for ShopMax India - storing invoices, contracts, product images, and audit reports. An ADK agent with Drive access can upload generated files, search for existing documents by name or type, move files between folders, and share them with the right people - all through natural language commands.

The Drive API v3 uses the drive.file scope for files the app creates, or drive for broader access. Key operations are files.list for searching, files.create for uploading, files.update for moving between folders, and permissions.create for sharing. Folder IDs replace directory paths - every folder in Drive has a unique ID used as the parent in file operations.

The below example shows an ADK agent with tools to search Drive, upload a file, and share it with a team member.


It gives the following output,

Uploaded: invoice_april.pdf
  File ID : 1DriveFileId_XYZ
  Folder  : ShopMax Invoices
  Link    : https://drive.google.com/file/d/1DriveFileId_XYZ/view

Shared with [email protected] (reader access).
Notification email sent.

For automated invoice archiving, trigger this agent via a Cloud Run job whenever a new PDF is generated by the billing system. Use the Drive API files.watch method with a Pub/Sub channel to get push notifications when new files are added to a watched folder - enabling the agent to react in real time rather than polling. Combine with the Sheets agent to log every uploaded invoice to a master invoice register spreadsheet.


 
  


  
bl  br