Construct and compile the CI pipeline graph.
()
| 162 | # --------------------------------------------------------------------------- |
| 163 | |
| 164 | def build_pipeline() -> StateGraph: |
| 165 | """Construct and compile the CI pipeline graph.""" |
| 166 | graph = StateGraph(PipelineState) |
| 167 | |
| 168 | graph.add_node("monitor", monitor_agent) |
| 169 | graph.add_node("alert", alert_agent) |
| 170 | graph.add_node("research", research_agent) |
| 171 | graph.add_node("compare", compare_agent) |
| 172 | graph.add_node("battlecard", battlecard_agent) |
| 173 | graph.add_node("quality_check", quality_check) |
| 174 | |
| 175 | graph.set_entry_point("monitor") |
| 176 | |
| 177 | graph.add_edge("monitor", "alert") |
| 178 | graph.add_edge("monitor", "research") |
| 179 | |
| 180 | graph.add_edge("alert", END) |
| 181 | graph.add_edge("research", "compare") |
| 182 | graph.add_edge("compare", "battlecard") |
| 183 | graph.add_edge("battlecard", "quality_check") |
| 184 | |
| 185 | graph.add_conditional_edges("quality_check", _should_retry) |
| 186 | |
| 187 | return graph.compile() |
| 188 | |
| 189 | |
| 190 | pipeline = build_pipeline() |