BayesFlow: A Probability Inference Framework for Meta-Agent Assisted Workflow Generation
Bo Yuan, Yun Zhou, Zhichao Xu, Kiran Ramnath, Aosong Feng, Balasubramaniam Srinivasan
TL;DR
BayesFlow reframes automatic workflow design as Bayesian posterior sampling over step-level code chunks, introducing Bayesian Workflow Generation (BWG) and a training-free BayesFlow instance. It combines parallel look-ahead rollouts with a sequential in-loop refiner to construct diverse, high-quality workflows while providing theoretical convergence guarantees in the no-refiner case and controlled exploration when refinement is used. Empirical results across six datasets and two executor families show BayesFlow achieving up to 9 percentage-point gains over state-of-the-art baselines and notable improvements in token efficiency and workflow-level inference-time scaling. The work offers a principled, scalable alternative to optimization-based methods, with practical impact for accelerating robust, automatic design of agentic LLM workflows.
Abstract
Automatic workflow generation is the process of automatically synthesizing sequences of LLM calls, tool invocations, and post-processing steps for complex end-to-end tasks. Most prior methods cast this task as an optimization problem with limited theoretical grounding. We propose to cast workflow generation as Bayesian inference over a posterior distribution on workflows, and introduce \textbf{Bayesian Workflow Generation (BWG)}, a sampling framework that builds workflows step-by-step using parallel look-ahead rollouts for importance weighting and a sequential in-loop refiner for pool-wide improvements. We prove that, without the refiner, the weighted empirical distribution converges to the target posterior. We instantiate BWG as \textbf{BayesFlow}, a training-free algorithm for workflow construction. Across six benchmark datasets, BayesFlow improves accuracy by up to 9 percentage points over SOTA workflow generation baselines and by up to 65 percentage points over zero-shot prompting, establishing BWG as a principled upgrade to search-based workflow design. Code will be available on https://github.com/BoYuanVisionary/BayesFlow.
