Skip to main content
Send a weekly operational report pulled from Postgres, narrated by an LLM, and delivered by Gmail. AgentRuntime does not run cron internally — an external scheduler fires an inbound webhook or API call on your timetable.

What you’ll build

Outcome: Every Monday morning, finance or ops receives a Gmail message with KPIs and plain-language commentary sourced from your database.

Prerequisites

  • project_contributor access
  • Postgres connection with read-only user for reporting queries
  • Google connection with Gmail enabled
  • LLM provider in Providers
  • External scheduler (GitHub Actions, Cloud Scheduler, cron) that can POST to your webhook URL weekly

Connectors to install

Example report query

Adjust to your schema — this example aggregates orders:

Build the workflow

1

Create workflow

Name it weekly-ops-report in Workflow Studio.
2

Query Postgres

mcp_callpostgres_query with your weekly SQL. Use a read-only DB user.
3

LLM narrative

llm_call turns row JSON into an executive summary with highlights and anomalies.
4

Send via Gmail

mcp_callsend_email to distribution list with subject line including the week ending date.
5

Schedule

Configure external cron to POST {} or {"report_week": "2026-W23"} to your inbound webhook each Monday 08:00 UTC.
6

Optional approval

Insert human_task between LLM and Gmail for regulated reports — see Approve then send.

Query step

LLM step

Gmail step

Full workflow graph (copy-paste)

Bind your postgres and gmail MCP instances. Adjust the SQL and recipient list before publishing.
Trigger weekly via inbound webhook or POST /v1/workflows/{id}/command with { "command": "start", "params": { "report_week": "2026-W23" } }.

Schedule with GitHub Actions (example)

Store the webhook URL and signing headers per Inbound webhooks.

Variations

  • Export raw CSV with postgres_query → attach via a future file step, or write to Google Sheets with insert_multiple_rows.
  • Swap Gmail for Resend for transactional sending from a verified domain.
  • Chain multiple queries (revenue, support tickets, churn) before one LLM step.