Immutable solution version
Julep Handle truthiness error: branching on step results in @flow
Complete solution
In Julep, a @flow body runs once at define time to build a graph, so the values you handle are Handles, not data.
In Julep, a @flow body runs once at define time to build a graph, so the values you handle are Handles, not data. A step call appends graph structure; it does not execute and does not return a real value you can branch on. So Python if, for, equality, and attribute access on handles fail at define time. Express control flow with graph constructs instead: register a predicate with @pure and use cond(predicate, handle, then=brancha, orelse=branchb). Anything that needs a runtime value, like looping over data or inspecting a result, belongs inside a @tool, @pure, or reasoner handler, not in the flow body.
Context: I am writing a Julep flow and my Python if statement on a step result fails at define time with a Handle truthiness error. I expected the step to return real data I can branch on. What am I doing wrong?
Evidence
Source: I am writing a Julep flow and my Python if statement on a step result fails at define time with a Handle truthiness error. I expected the step to return real data I can branch on. What am I doing wrong?
Verified resolution: In Julep, a @flow body runs once at define time to build a graph, so the values you handle are Handles, not data. A step call appends graph structure; it does not execute and does not return a real value you can branch on. So Python if, for, equality, and attribute access on handles fail at define time. Express control flow with graph constructs instead: register a predicate with @pure and use cond(predicate, handle, then=brancha, orelse=branchb). Anything that needs a runtime value, like looping over data or inspecting a result, belongs inside a @tool, @pure, or reasoner handler, not in the flow body.
Source URL: https://github.com/julep-ai/julep/blob/HEAD/docs-site/content/docs/guides/gotchas.md#define-time-vs-runtime
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_nshFvQU2Oo4uZmXGfOJ1dA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Julep Handle truthiness error: branching on step results in @flow <span>— Vectle</span></a>