Skip to main content

Logic & Action Blocks

These are the machines on your assembly line: eight block types that sort, route, transform, and act on data by following exact rules — and none of them ever uses credits. Wherever a job doesn't need real judgment, one of these does it for free.

Most of them share the same rule builder: you pick a value (usually a {{variable}}), an operation (equals, contains, greater than…), and what to compare it to — like setting up a rule in your email app ("if the subject contains 'invoice'…").

Browse the library — click a block to see its real setup panel:

Logic — no creditsActions — no credits
Filter
Input
Trigger items
RulesMatch all
{{item.status}}equalsopen
{{item.priority}}equalshigh
Output name
filtered_items
No creditsOutput → a file the next step can read

Condition — the fork in the road

Asks one yes/no question and takes one of two paths.

SettingExample
Rules{{trigger.amount}} greater than 1000
If true →"Notify the sales lead"
If false →"Save for the weekly digest"

Filter — the sieve

Takes a list of items and keeps only the ones that match your rules. If nothing survives, that branch of the run simply ends — quietly and at no cost.

SettingExample
InputThe list from the trigger or an earlier step
Rules{{item.status}} equals open and {{item.priority}} equals high

Example: an app trigger delivers 40 updated tickets; the filter keeps the 3 that are open and high priority, and only those continue.

Switch — the mail sorter

Like a condition with more than two slots: the first matching rule wins and sends the run down its path; a fallback path catches everything else. The classic use: right after an All events app trigger, sorting each event type onto its own path.

SettingExample
Rule 1{{item.subscriptionType}} equals deal.creation → "New deal path"
Rule 2{{item.subscriptionType}} equals contact.creation → "New contact path"
Fallback →"Everything else"

Tool — press one button on a machine

Runs one of your connected tools once — send an email, post a Slack message, call a web address — without an agent deciding anything. You pick the tool and fill its fields, using {{variables}} for the dynamic parts.

SettingExample
ToolSend email (Outlook)
FieldsTo: ben@company.com · Subject: New deal: {{trigger.dealname}}
info

If a {{variable}} in a field comes out empty at run time, the step warns you loudly in the run results — you'll never silently send a blank email.

Database — the filing clerk

Reads, adds, updates, or deletes rows in one of your own Nirvai Databases. Updates and deletes always require match rules — a block is never allowed to touch every row by accident.

SettingExample
DatabaseCRM › Leads
ActionInsert
Fieldsname: {{trigger.name}} · source: HubSpot

Reads can match, choose columns, and limit rows (up to 500 per read).

Code — the pocket calculator

Runs a short Python snippet for transformations that rules can't express — reshaping data, computing totals, formatting text. Read your inputs, do the math, and assign the result to output:

total = sum(item["amount"] for item in items)
output = [{"deal_count": len(items), "total_amount": total}]

For Each — do it for every item in the box

Repeats its inner blocks once per item in a list, several items at a time. Inside, {{item...}} refers to the item currently being processed.

Example: for each deal that survived the filter → look up the owner in a database → send them one email via a tool block.

Loop — repeat until done

Repeats its inner blocks a number of times, or while/until a rule holds — for things like paging through results, where each pass depends on the one before. {{loop.iteration}} tells the blocks inside which pass is running. A safety cap (100 passes) guarantees a loop can never run forever; hitting the cap ends the loop normally and says so in the results.

info

For Each and Loop accept only free blocks inside them — that's what guarantees a thousand-item loop still costs zero credits. Need AI on each item? Do the mechanical looping for free, then hand the collected result to a single agent step after the loop.


Choosing the right block

You want to...Use
Take one of two pathsCondition
Take one of many pathsSwitch
Drop items that don't matterFilter
Send / post / fetch something onceTool
Save or look up your own recordsDatabase
Math or reshaping rules can't doCode
Repeat per item in a listFor Each
Repeat until something is trueLoop
Understand, write, or judgeAn AI step — the one that costs credits

What's next

Learn how {{variables}} move data into these blocks in Data Between Steps.