- Use Cloud Functions for single-purpose, short-lived event handlers.
- Use Cloud Workflows when you need to coordinate multiple steps, persist state across steps, or run long-running processes.
Key differences: execution model, duration, and control flow

Duration and state: when time and persistence matter
- Cloud Functions: best for tasks that complete quickly. For persistent data, rely on external stores (Cloud Storage, Firestore, Cloud SQL).
- Cloud Workflows: maintain execution context across steps; outputs flow into subsequent steps without needing an external store for intermediate state.
Complexity and orchestration
- Cloud Functions: keep functions focused and stateless. Suitable for simple event handlers or small microservices.
- Cloud Workflows: model complex business processes (branching, parallel steps, waits for approvals, external API calls) declaratively in a workflow definition.
Error handling and retries
- Cloud Functions: rely on trigger-level retries or custom retry logic inside the function.
- Cloud Workflows: define retry policies, backoff, and alternate paths in the workflow. Useful for resilient, multi-step integrations.
Pricing considerations
Both are usage-based but charge on different metrics. Evaluate expected invocation counts, compute duration (Functions), and number of state transitions/callouts (Workflows) to estimate costs for your scenario. See Cloud Functions pricing and Cloud Workflows pricing for current details.Typical use cases and examples
Example scenarios:
- Cloud Function: calculate an estimated fare and assign a nearby driver when a ride request arrives — one trigger, one responsibility, short execution.
- Cloud Workflow: a driver onboarding process that collects documents, verifies IDs, waits for human approval, and activates accounts — many steps, branching paths, and waits.
Exam-style question
What would you choose for a long-running process involving multiple GCP APIs where state must be maintained? Answer: Cloud Workflows — they are designed to orchestrate steps, persist execution state between steps, and provide rich error handling and retry strategies.Simple decision rule: ask yourself “Do I need just a single event response?” If yes, Cloud Functions are usually the right fit. If no — if you need orchestration, retries, multiple API calls, or long-running stateful sequences — choose Cloud Workflows.
Decision guidance
- Choose Cloud Functions when: you need a fast, single-purpose event response, minimal orchestration, and stateless execution.
- Choose Cloud Workflows when: you need to coordinate multiple steps, preserve state across steps, implement complex branching or retry policies, or support long-running processes.

- Cloud Functions documentation
- Cloud Workflows documentation
- Choosing between serverless compute and orchestration patterns