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:
Condition — the fork in the road
Asks one yes/no question and takes one of two paths.
| Setting | Example |
|---|---|
| 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.
| Setting | Example |
|---|---|
| Input | The 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.
| Setting | Example |
|---|---|
| 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.
| Setting | Example |
|---|---|
| Tool | Send email (Outlook) |
| Fields | To: ben@company.com · Subject: New deal: {{trigger.dealname}} |
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.
| Setting | Example |
|---|---|
| Database | CRM › Leads |
| Action | Insert |
| Fields | name: {{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.
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 paths | Condition |
| Take one of many paths | Switch |
| Drop items that don't matter | Filter |
| Send / post / fetch something once | Tool |
| Save or look up your own records | Database |
| Math or reshaping rules can't do | Code |
| Repeat per item in a list | For Each |
| Repeat until something is true | Loop |
| Understand, write, or judge | An AI step — the one that costs credits |
What's next
Learn how {{variables}} move data into these blocks in Data Between Steps.