FlowsBook a callSign inCreate free accountSign up
AI employees and automation

Using variables so one AI employee design serves many cities

Variables hold the few values that change from one city or team to the next. How to set them, where {{vars.name}} works, and when a city list or a table fits better.

Part of the guide AI employees

By the xMap team · · 5 min read

A variable is a named value, such as city, team_email or min_rating, set once for a whole flow and written as {{vars.city}} wherever a text setting needs it. Build the AI employee once with variables in every place that differs between markets, then make a copy for each city and change only the variables. Every copy keeps the same blocks, scoring and wording, so an improvement made in one is easy to repeat in the rest and nobody has to hunt through twenty settings to move a flow from Paris to Osaka.

This article is for operations leads and analysts who run the same kind of AI employee in several cities, regions or teams. It covers what variables are, where they work, a worked setup, how to test a copy, the alternatives for when the city list keeps changing, and the slips that cause wrong results.

What a variable is in xMap Flows

Variables live in the flow's ... menu, under Variables. Each has a name and a value. In any text setting of any block, {{vars.name}} is replaced by the value when the flow runs. Names are short, lowercase words joined by underscores. A variable that is not set stays as written, which makes a forgotten one easy to spot in a test run.

Text settings are the instructions and prompts of AI blocks, search words, a location typed into Job postings, the subject and body of an Email and its address list, and the inputs of app blocks such as a Slack channel name or a sheet's tab. Settings picked from a list, such as a city picked in the Area of interest or a type of place, are not text; set those in each copy.

Which values to turn into variables

  • The market's name: {{vars.city}} in the email subject, the instructions to xMap LLM and any search words.
  • Who receives it: {{vars.team_email}} in the Email block, {{vars.channel}} in a Slack block.
  • Local wording: {{vars.language}} in the instructions, so the AI writes its reasons in French for Paris and Japanese for Osaka.
  • Thresholds that differ: a score cut-off or a focus such as {{vars.focus}} ('family-run shops' in one market, 'new openings' in another) read by the AI.
  • Local context: a short note on the market, such as 'in Bogota most of our customers are in the north of the city', which the AI uses when it scores.

Keep the number small. Four to six variables is typical; past ten, the copies stop being alike and you are really running different flows.

A worked setup

The following is a made-up example. A company that sells kitchen equipment to restaurants runs a weekly prospect finder in Paris, Osaka, Bogota and Vancouver.

  1. Build the Paris version first and get it right: a Schedule on Mondays, an Area of interest set to Paris, Nearby places for restaurants opened in the last 12 months, Only new, an xMap LLM scoring step, and Email.
  2. Open Variables and add city = Paris, team_email = the Paris team's address, language = French, focus = independent restaurants with a full kitchen.
  3. Replace every Paris-specific word in text settings with its variable: the email subject becomes 'New restaurants in {{vars.city}} this week'; the instructions say 'write the reason in {{vars.language}}' and 'prefer {{vars.focus}}'.
  4. Run a test. The email and the reasons should read exactly as before.
  5. Duplicate the flow from its menu. In the copy, change the Area of interest to Osaka and the variables to Osaka, the Osaka team's address and Japanese. Rename the copy and its AI employee so the team can tell them apart.
  6. Repeat for Bogota and Vancouver.

Four AI employees now run the same design, each speaking its market's language to its own team. When the Paris team improves the scoring instructions, the change is copied into the others as words, with only the variables left to differ.

Testing a copy before it goes live

Test with, in the flow's ... menu, runs a test with values you type, including variables, without changing the saved ones. Use it to check a copy reads well with another market's values before you edit them for good, or to see how the instructions behave with an unusual language. A test run sends nothing.

When copies are the wrong answer

Copies with variables suit a handful of markets that each need their own team, language or wording. Other cases fit other tools:

  • Several cities, one team, one email. Put all the cities in one Area of interest. Each is searched, and every result carries its area, so the email can group by city.
  • A city list that keeps changing. Keep the cities in a table in My data and start the flow with New rows: adding a row runs the flow for it.
  • Each rep's own area within one city. Use Split by territory instead of a copy per rep.

Slips to avoid

  • Misspelling a name. {{vars.City}} and {{vars.city}} are read the same, but {{vars.citty}} is not, and stays in the email as written.
  • Forgetting the picked settings. A copy whose variables say Osaka but whose Area of interest still says Paris sends Paris restaurants with Japanese reasons. Check the Area of interest and types in each copy.
  • Putting secrets in variables. Keys and passwords belong in connections, where they are sealed, not in a variable anyone who opens the flow can read.
  • Letting copies drift. If one copy's instructions are rewritten and the others are not, the markets stop being comparable. Make shared changes in all copies the same day.

Questions

Where do I set variables?

In the flow's ... menu, under Variables. Each has a name and a value, and {{vars.name}} in any text setting is replaced by the value when the flow runs.

Can a variable change the city the Area of interest searches?

Cities there are picked from a list, so set them in each copy. When the list of cities changes often, keep it in a table in My data and start the flow with New rows instead.

Can I test different variable values without saving them?

Yes. Test with, in the flow's ... menu, lets you type variable values for one test run; nothing is sent and the saved values stay as they are.

How many copies can I run?

As many as your team needs. Each copy is its own AI employee with its own budget, so watch the monthly estimate before deploying many at once.

Templates that do this

Read next

More on ai employees and automation · Every article · Templates

Put it to work

An AI employee in xMap Flows does this on live data, on its own timetable. Start from a template or describe it in plain words.