The supervisor agent decides which worker to invoke based on its response. Each worker's response is fed back to the supervisor for re-evaluation.
Details
The supervisor node sets state$next_worker via a routing tool that the
supervisor calls. The routing condition reads this field to dispatch to the
correct worker, or end the graph if the supervisor calls route("FINISH").
See also
Other convenience:
pipeline_graph(),
react_graph()
Examples
if (FALSE) { # \dontrun{
sup <- agent("boss", ellmer::chat_openai(model = "gpt-4o"))
w1 <- agent("coder", ellmer::chat_openai(model = "gpt-4o"))
w2 <- agent("tester", ellmer::chat_openai(model = "gpt-4o"))
graph <- supervisor_graph(sup, list(coder = w1, tester = w2))
} # }