You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Builder: an If after a list (calendar, inbox…) and after an Ask step's reply #264
@Lexirieru Ancung (FE) tried a job that can't be built today: read the calendar; if there is anything on it, email me a morning note about it; if not, stop. In the Builder, If is locked after "Read the calendar".
Why
An If compares one number or one text (eq, ne, lt, lte, gt, gte in builder.ts). The FE offers only fields that aren't lists (comparable in apps/fe/src/modules/builder/data/draft.ts).
"Read the calendar" gives events, a list, so there is nothing to compare. "Read the inbox", "Find free time", "Read a Notion database", "Read a Google Sheet" and "List Zoom meetings" are the same.
An Ask step's reply can't be read by an If either.
events.length doesn't work. Mastra validates each predicate path against the step's output schema before the run (validatePath in @mastra/core/dist/validate-*.js: "Predicate path … does not exist in the known schema"), and an array schema has no length. Read in the installed package, not run (the engine's unit tests don't start on Windows, see the path issue).
Proposed
A count on every tool that returns a list. It's a number beside the list: events + count for the calendar, emails + count for the inbox, and the same for slots, rows, values and meetings. The If then compares "Number of events > 0".
The contents still reach the email: a list can already go into an Ask step's prompt ({Calendar events}), and the Mind writes the note from it.
So the job above becomes: Read the calendar → If Number of events > 0 → Ask "write a morning note about {Calendar events}" → Email me; otherwise it stops.
An If that can read an Ask step's reply (its text). This is for conditions about the contents ("is there an email from my boss?", "is any meeting with a client?"): the Mind answers yes or no, and the If compares that text. It needs the agent node's output schema to carry text where the If's validation can see it. Is that already so?
FE (mine, as soon as the engine has them)
Number fields (count, kind number) in builder/data/tools.ts, shown as "Number of events", "Number of emails", and so on.
An Ask step listed in an If's "Look at" as "{name}'s answer", with a hint to make it reply yes or no.
Meanwhile the FE will say why the If is locked, instead of "Add a check or a website first", which read like a bug.
Engine part merged in #265: count on every list tool, so "Number of events > 0" works (tested end to end and under load). An If on an Ask reply works only as an exact text match (details in #265). @AncungAulia the FE fields are listed in the #265 comment.
Done: engine count (#265) and the FE fields (#268). An If on an Ask reply is left out on purpose: the engine compares exact text only ("Yes" ≠ "yes", #265). It can be a new issue after the hackathon if we want it.
Activity
Merge pull request #265 from Hellonear-AI/feat/engine-if-count-and-an…
Lexirieru commentedon Nov 11, 2026
Engine part merged in #265:
counton every list tool, so "Number of events > 0" works (tested end to end and under load). An If on an Ask reply works only as an exact text match (details in #265). @AncungAulia the FE fields are listed in the #265 comment.Merge pull request #268 from Hellonear-AI/feat/fe-if-count
Lexirieru commentedon Nov 12, 2026
Done: engine
count(#265) and the FE fields (#268). An If on an Ask reply is left out on purpose: the engine compares exact text only ("Yes" ≠ "yes", #265). It can be a new issue after the hackathon if we want it.