Upcoming Update to Condition Step Data Format
September 13th, 2024 by Zoran Slamkov
We are introducing a new version of the Condition step type to enhance condition handling in your AI agents.
Affected Property: diagrams[id].nodes
What's Changing:
- A new
condition-v3
node type with an updated data structure will be added for greater flexibility and expressiveness.
New Format Preview:
type CodeText = (string | { variableID: string } | { entityID: string })[];
interface MarkupSpan {
text: Markup;
attributes?: Record<string, unknown>;
}
type Markup = (string | { variableID: string } | { entityID: string } | MarkupSpan)[];
type ConditionV3Node = {
type: "condition-v3";
data: {
portsV2: {
byKey: Record<string, {
type: string;
id: string;
target: string | null;
}>;
};
condition: {
type: "prompt";
} | {
type: "logic";
items: {
value: {
type: "script";
code: CodeText;
} | {
type: "value-variable";
matchAll: boolean;
assertions: {
key: string;
lhs: {
variableID: string | null;
};
rhs: Markup;
operation:
| "is"
| "is_not"
| "greater_than"
| "greater_or_equal"
| "less_than"
| "less_or_equal"
| "contains"
| "not_contains"
| "starts_with"
| "ends_with"
| "is_empty"
| "is_not_empty";
}[];
};
id: string;
label?: string | null;
}[];
};
name?: string;
noMatch?: {
repromptID: string | null;
path?: boolean | null;
pathLabel?: string | null;
} | null;
};
nodeID: string;
coords?: [number, number];
};
What This Means for You:
- The
condition-v3
node will support both script-based and variable-based conditions, allowing for more complex logic. - Only new condition steps created after the update will utilize the condition-v3 format, unlocking additional features.
Action Required:
- Plan to modify any custom integrations that interact with
diagrams[id].nodes
to accommodate the new node type.
We will provide more details and release notes when the update becomes available.