tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > ADK Scheduled Agents with Cloud Scheduler

ADK Scheduled Agents with Cloud Scheduler

Author: Venkata Sudhakar

Not all agent work is triggered by user requests. Many high-value business processes are time-based: generate a morning sales summary, check stock levels every hour, send weekly supplier performance reports, or run end-of-day reconciliation. Cloud Scheduler combined with ADK agents replaces manual cron jobs with intelligent automated workflows that can reason about the data they process.

ShopMax India runs nine scheduled ADK agents in production. The most critical is the morning briefing agent that runs at 7am every day: it pulls the previous day sales data, compares against targets, identifies anomalies, and sends a formatted summary to the operations WhatsApp group. What used to take an analyst 45 minutes to compile is now delivered automatically before the team starts their workday.

The below example shows a Cloud Run service that accepts scheduled invocations from Cloud Scheduler and runs an ADK reporting agent.


It gives the following output,

Report generated at 2024-04-05 07:00:03

SHOPMAX INDIA - DAILY BRIEFING (April 4, 2024)

Revenue: Rs 28.5L vs Rs 30L target (94.9% achievement). Below target by Rs 1.5L.

Top Categories: Smartphones led at Rs 12L, followed by Headphones (Rs 4.9L)
and Laptops (Rs 4.2L). Smartphones strong; other categories need attention.

Concern: 31 cancellations (2.4% of orders) is above the 1.5% threshold.
Investigate if linked to a specific seller or pincode.

Action: Review cancellation root causes before 10am standup.

The below example shows the Cloud Scheduler configuration that triggers the daily report Cloud Run endpoint at 7am IST every morning.


It gives the following output,

Created job [shopmax-daily-report].

ID                      LOCATION      SCHEDULE    TIMEZONE         STATE
shopmax-daily-report    asia-south1   0 7 * * *   Asia/Kolkata     ENABLED

Manually triggered job shopmax-daily-report.
Job completed successfully in 4.2s.

The OIDC token in the Cloud Scheduler configuration ensures only the scheduler service account can call the Cloud Run endpoint - no unauthenticated access is possible. ShopMax India runs nine such scheduled agents at different intervals: hourly stock alerts, daily reports, weekly supplier scorecards, and monthly customer cohort analysis. Each agent uses the same pattern: a POST endpoint, a Cloud Scheduler job, and an ADK agent that reasons over the data rather than just formatting it.


 
  


  
bl  br