Skip to main content
Welcome back. In this lesson we focus on Cloud Workflows on Google Cloud: what it is, when to use it, and how it differs from Cloud Composer and Cloud Functions. Previously we covered Cloud Composer, a managed Apache Airflow service for data pipelines. Cloud Workflows solves related but different problems: it’s a serverless orchestration service designed for sequencing API calls and microservice interactions rather than heavy-duty data engineering.

What is Cloud Workflows?

Cloud Workflows is a serverless, event-driven orchestration service that sequences API and microservice calls as a single, maintainable execution. It’s ideal for application-level orchestration, business processes, and API sequencing where you want minimal operational overhead. Key capabilities
  • Event-driven, serverless execution: run workflows in response to HTTP requests, Pub/Sub events, Cloud Scheduler, and other triggers.
  • Automatic scaling: scales from zero to meet demand — no capacity planning.
  • Pay-per-invocation billing: you pay for workflow executions and steps.
  • Multiple triggers: HTTP, Pub/Sub, Cloud Scheduler, and integrations with other Google Cloud services.
  • Isolated, stateless executions: each run is independent; step-to-step data belongs to the execution.
  • Fast startup: low latency for user-facing orchestrations.
A concise exam-style answer: Cloud Workflows is serverless orchestration because it is event-driven, auto-scales from zero, supports multiple triggers, bills per execution, and requires no server or VM management.
A slide titled "Cloud Workflows" showing six colorful boxes with key features. The boxes list: event-driven serverless compute; automatic scaling (0 to millions); pay-per-invocation model; multiple trigger types; stateless execution; and sub-second response times.

When to use Cloud Workflows

  • Orchestrate ordered API calls that pass intermediate data between steps.
  • Implement multi-step business processes (e.g., order processing) with conditional logic, retries, and error handling.
  • Coordinate microservices without building or managing orchestration infrastructure.
  • Replace brittle function chains with readable, maintainable orchestration logic.

Why not just use a single Cloud Function?

  • Cloud Functions are stateless and have execution-time limits; chaining complex logic across many steps quickly becomes hard to maintain.
  • Workflows provides explicit sequencing, in-execution data passing, retry policies, and structured branching — all in one place.
  • Use Cloud Functions for single-purpose handlers and short-running tasks; use Workflows to coordinate those functions as part of a larger process.

Composer vs Workflows — short comparison

Use Cloud Composer (Apache Airflow) when:
  • You need complex, scheduled, data-oriented pipelines.
  • DAG-centric orchestration and heavy data-engineering integrations are required.
Use Cloud Workflows when:
  • You need lightweight, serverless orchestration of APIs and microservices.
  • You prefer pay-per-execution pricing and minimal operational overhead.

Cloud Functions vs Workflows — clear differences

DimensionCloud FunctionsCloud Workflows
PurposeSingle-purpose serverless compute responding to eventsOrchestrates and sequences calls to services/APIs
State & SequencingStateless per invocation; chaining requires external coordinationPasses data between steps in a single execution
Best forSmall handlers, webhooks, event-driven logicMulti-step processes with conditionals, retries, branching
BillingBilled for execution time and resource usage of each functionBilled per workflow invocation and step execution (https://cloud.google.com/workflows/pricing)
Typical use caseEvent transforms, background jobsOrder processing, API orchestration, microservice coordination

Short scenario (example)

Placing an online order orchestration:
  1. Workflow receives an order event.
  2. Call payment API and wait for confirmation.
  3. If payment succeeds, call inventory API.
  4. If inventory is available, call shipment API and notify the customer.
  5. If any step fails, perform retries or compensation actions (e.g., refund).
Cloud Workflows expresses this in readable steps with branching and retry policies, avoiding brittle chains of stateless functions.

Minimal example — YAML workflow

Below is a simple illustrative YAML workflow that sequences two HTTP calls and handles a conditional response. This sample shows the high-level structure (steps, calls, and branching).
main:
  steps:
    - init:
        assign:
          - orderId: ${"ORD-12345"}
    - callPayment:
        call: http.post
        args:
          url: https://payments.example.com/charge
          body:
            orderId: ${orderId}
            amount: 100
    - checkPayment:
        switch:
          - condition: ${callPayment.status == 200}
            next: checkInventory
          - next: paymentFailed
    - checkInventory:
        call: http.post
        args:
          url: https://inventory.example.com/check
          body:
            orderId: ${orderId}
    - paymentFailed:
        return: "Payment failed; initiating compensation"
    - done:
        return: "Order processed"
Refer to the official Cloud Workflows documentation for full syntax, retry strategies, and authentication patterns.

Quick troubleshooting and tips

  • Use step-level retries and exponential backoff for transient failures.
  • Keep sensitive data out of logs; use Secret Manager and proper IAM roles.
  • Visualize execution traces in the Cloud Console to debug step-by-step failures.
  • Test each API call independently before composing them into a workflow.

Comparison table (Composer, Workflows, Functions)

ServiceBest forTriggersState handlingExample use
Cloud Composer (Airflow)Complex data pipelines, DAGs, scheduled jobsScheduler, sensors, external triggersDAG-level state managed by AirflowETL pipelines, data engineering workflows
Cloud WorkflowsAPI & microservice orchestration, business logicHTTP, Pub/Sub, Scheduler, service callsPasses data between steps within executionOrder processing, API sequencing
Cloud FunctionsEvent-driven single-task computePub/Sub, HTTP, Storage, FirestoreStateless per invocationWebhooks, lightweight data transforms
Summary Cloud Workflows provides serverless, scalable orchestration for APIs and microservices. Choose the right tool:
  • Composer for complex, scheduled data pipelines;
  • Workflows for application-level orchestration and API sequencing;
  • Cloud Functions for single-purpose, event-driven compute.
We’ll follow up with hands-on comparisons and examples to help decide between Cloud Functions and Cloud Workflows in real scenarios.

Watch Video