Skip to content

agentic‐workflow‐5

jun-he edited this page Oct 28, 2025 · 1 revision
{
  "properties": {
    "owner": "tester",
    "run_strategy": "sequential"
  },
  "workflow": {
    "id": "sample-agentic-wf-5",
    "name": "Evaluator-optimizer workflow",
    "description": "Agentic workflow of evaluator-optimizer using while loop feature",
    "params": {
      "prompt":  {
        "value": "Write a description about Netflix Maestro with exactly 23 words.",
        "type":  "STRING"
      },
      "apiKey":  {
        "value": "API_KEY",
        "type":  "STRING"
      }
    },
    "steps": [
      {"while": {
        "id": "llmWhile",
        "params": {
          "loop_params": {
            "value": {
              "feedback": {
                "value": "",
                "type": "STRING"
              },
              "result": {
                "value": "",
                "type": "STRING"
              }
            },
            "type": "MAP"
          }
        },
        "condition": "feedback != 'PASS'",
        "steps": [
          {
            "step": {
              "id": "generator",
              "type": "notebook",
              "transition": {"successors": {"evaluator": "true"}},
              "params": {
                "prompt": {
                  "expression": "if (loop_index==0) return prompt; else return 'please improve the generated info: ' + result + ' based on the feedback: ' + feedback;",
                  "type": "STRING"
                },
                "kubernetes": {
                  "value": {
                    "image": {
                      "value": "maestro-worker:local",
                      "type": "STRING"
                    },
                    "env": {
                      "value": {
                        "API_KEY": "${apiKey}"
                      },
                      "type": "STRING_MAP"
                    }
                  },
                  "type": "MAP"
                },
                "notebook": {
                  "value": {
                    "input_path": {
                      "value": "https://raw.githubusercontent.com/oss-maestro/maestro-notebook-templates/refs/heads/main/examples/llm_call.ipynb",
                      "type": "STRING"
                    }
                  },
                  "type": "MAP"
                },
                "output": {
                  "value": "default",
                  "type": "STRING"
                }
              }
            }
          },
          {
            "step": {
              "id": "evaluator",
              "type": "notebook",
              "transition": {"successors": {"output": "true"}},
              "params": {
                "system_prompt": {
                  "value": "Evaluate this following code implementation for result correctness. You should be evaluating only and not attempting to solve the task. Only output 'PASS' if all criteria are met and you have no further suggestions for improvements. Output your evaluation concisely.",
                  "type": "STRING"
                },
                "prompt": {
                  "value": "For a given task: '${prompt}', please evaluate the generated info: '${generator__output}'",
                  "type": "STRING"
                },
                "kubernetes": {
                  "value": {
                    "image": {
                      "value": "maestro-worker:local",
                      "type": "STRING"
                    },
                    "env": {
                      "value": {
                        "API_KEY": "${apiKey}"
                      },
                      "type": "STRING_MAP"
                    }
                  },
                  "type": "MAP"
                },
                "notebook": {
                  "value": {
                    "input_path": {
                      "value": "https://raw.githubusercontent.com/oss-maestro/maestro-notebook-templates/refs/heads/main/examples/llm_call.ipynb",
                      "type": "STRING"
                    }
                  },
                  "type": "MAP"
                },
                "output": {
                  "value": "default",
                  "type": "STRING"
                }
              }
            }
          },
          {"step": {"id": "output", "type": "NoOp", "transition": {},
            "params": {
              "result": {
                "value": "${generator__output}",
                "type": "STRING"
              },
              "feedback": {
                "value": "${evaluator__output}",
                "type": "STRING"
              }
            }}}
        ]
      }}
    ]
  }
}

Clone this wiki locally