Notification

Bring your best ideas to life with Google Workspace with Gemini. Get tips & real-life use cases for using gen AI at work.

Tips to create agents with conditional steps

Google Workspace Flows productivity guide

You can have certain steps in your automatic workflows happen only if certain conditions are met.

On this page

How conditional steps work

Conditional steps set off certain steps into substeps that the agent does only in certain scenarios. Workspace Flows has 2 steps that can check conditions:

  • Decide–uses Gemini to evaluate if conditions you describe are true or false
  • Check if–compares values

You can describe conditions when you create an agent with AI, or you can manually add conditional steps to an agent. Then add steps to the substeps that the flow should do when the conditions are met. You can also add steps after the substeps that the flow should do for all runs.

Conditional flow limitations:

  • You can’t use variables from a substeps in steps in the main flow. For example, if the substeps have an Ask Gemini step draft a reply, you can’t add the draft to a tracking document as part of the main flow.
  • An agent can’t have nested conditional steps. But an agent can have more than one conditional step, they just run in order.

AI-powered conditions with Decide

The Decide step is only available if you have access to Gemini. If you don’t have Gemini, use Check if instead.

How "Decide" works

  • You tell Gemini what conditions to check for.
  • Gemini responds with whether the conditions are true or false.
  • A Decide step is always paired with a Check if step that is prefilled to check if the Decide result is true. You can change it to do the steps if the result is false instead.
  • The agent does the steps in the substeps after Check if only if its conditions match. It does any other steps in the main agent after that.

Set up a "Decide" step

  1. Go to https://flows.workspace.google.com and create an agent.
  2. If you’re building manually or Gemini didn’t add it for you, add a Decide step. A Check if step is automatically added with it.
  3. In the Decide step, describe the conditions that you want Gemini to evaluate. Tips:
    1. Start from a common use case. Click one of the options below the field, such as Is urgent, to get a start on your description.
    2. Add variables to reference information from previous steps that Gemini should consider. For example, add the email message body variable to have Gemini check if it has a negative tone.
  4. To have the substeps run only when the conditions in the Decide step aren’t met:
    1. Click the Check if step.
    2. Change the matching condition from is true to is false.
  5. Below the Check if step, add or edit the steps you want the agent to do. Note: you can’t add another Check if step as part of the substeps.
  6. (Optional) To have the agent do more steps after the conditional steps complete, add steps at the top level. You can’t use variables from the substeps in these steps.

    Tip: To have the agent do steps for the opposite condition, add another Check if step with the matching set to the opposite of the first. For example, if you set up a substeps to run when the decision is true, you could set up another substeps to do when the decision is false.

  7. (Optional) To try your agent, click Test run. A test run runs your agent once, taking real actions so you can see the outcome. Select the starting conditions, then click Start. Learn more about test runs.

  8. When your agent is ready, click Turn on.

Condition matching with Check if

How "Check if" works

  • You enter one or more conditions that must be met to do the steps in the substeps.
  • You choose if all of the conditions must be met (select AND), or only one (select OR).
  • The agent does the steps in the substeps after Check if only if its conditions match. It does any other steps in the main agent after that.

Set up a "Check if" step

  1. Go to https://flows.workspace.google.com and create an agent.
  2. If you’re building manually or Gemini didn’t add it for you, add a Check if step.
  3. Fill in or edit the first condition statement. Each condition statement consists of 3 parts:
    1. The value to check. This is a variable that represents data from an earlier step.
    2. The matching operator, such as is and is not.
    3. The value to compare to. You can add a different variable or enter text.
  4. (Optional) To add another condition, click AND if both conditions need to be met, or OR if only one does. Then fill in the condition statement and repeat until all your conditions are set. You can select either AND or OR, you can’t mix them.
  5. Below the Check if step, add or edit the steps you want the agent to do. Note: you can’t add another Check if step as part of the substeps.
  6. (Optional) To have the agent do more steps after the conditional steps complete, add steps at the top level. You can’t use variables from the substeps in these steps.
  7. (Optional) To try your agent, click Test run. A test run runs your agent once, taking real actions so you can see the outcome. Select the starting conditions, then click Start. Learn more about test runs.
  8. When your agent is ready, click Turn on.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
3304346838893338197
true
Search Help Center
false
true
true
true
false
false
false
false