Overview
How Ask Sage Agent Builder workflows are structured and generated.
AutoFlow generates workflows for Ask Sage's Agent Builder — a visual node-and-edge workflow engine. Each workflow is a JSON document containing nodes (processing steps), edges (connections between nodes), and metadata.
Example Workflow
A classification workflow connects nodes like this:
Workflow Structure
{
"nodes": [
{
"id": "intake",
"type": "llm",
"position": { "x": 0, "y": 0 },
"config": {
"system_prompt": "You are a classifier...",
"prompt_template": "Classify: {{input.message}}",
"temperature": 0.0,
"model": "gpt-4o-mini",
"max_output_tokens": 500,
"persona": 1,
"is_terminal": false,
"live_search": 0,
"file_variables": []
},
"label": "Classify Input"
}
],
"edges": [
{
"id": "edge_intake_to_router",
"source": "intake",
"target": "router",
"sourceHandle": "out",
"targetHandle": "in"
}
],
"agent_config": {
"input_variables": [
{ "name": "message", "type": "string" }
]
},
"metadata": {
"name": "Email Classifier",
"tier": 1,
"pattern": "classification",
"description": "Classifies incoming emails by category",
"category": "intelligence",
"tags": ["email", "classification", "routing"]
}
}Key Concepts
Nodes
Each node is a processing step with a type, config, and position. AutoFlow supports 7 node types covering LLM calls, loops, conditionals, decision trees, save/transform variables, and flat responses. Files are not a node type — they enter the workflow via input.<varname> fed directly to an LLM node's file_variables config.
Edges
Edges connect nodes via sourceHandle and targetHandle ports:
- Standard flow:
"out"→"in" - Conditionals (if_else):
"if"/"else"(canonical) or"true"/"false"(legacy alias) →"in" - Loops:
"iteration"(per item) and"complete"(after all) →"in". Legacy aliases"loop"and"aggregated"are still accepted. - Decision trees: Positional handles
"cat_0","cat_1","cat_2", ... (one percategories[]entry) — NOT category names →"in"
Variables
Nodes reference each other's outputs via double-brace syntax:
{{input.message}}— agent_config input variable{{node_id.response}}— LLM output (uses raw node id){{node_id.category}},{{node_id.confidence}}— Decision Tree{{variable_name}}— bare reference for Save Variable / Transform Variables outputs{{loop.item}}(in loop body),{{loop.results}}(after complete)
Workflow Envelope
Real Ask Sage v1 exports have nodes, edges, and agent_config at the top level. Agent Builder import requires agent_config. AutoFlow adds an optional metadata block (used for catalog discovery only — Agent Builder ignores it) and an optional slug field on each node (human-readable convenience — Agent Builder ignores it).
Metadata
Workflow metadata includes name, description, tier (0-2), pattern type, category, tags, use cases, complexity level, author, and version.