Creates a hub-and-spoke graph: a manager agent directs work to worker agents
one at a time. The manager's response is expected to contain the name of the
next worker (or "DONE" to stop).
Arguments
- manager
An
Agentobject acting as the supervisor.- workers
Named list of
Agentobjects.- max_rounds
Integer. Maximum number of manager turns (default 10).
- state_schema
A WorkflowState or
NULL(uses default).
Value
A compiled GraphRunner.
Examples
if (FALSE) { # \dontrun{
runner <- supervisor_workflow(
manager = agent("manager", ellmer::chat_anthropic(),
instructions = "Delegate to 'writer' or reply 'DONE'."),
workers = list(writer = agent("writer", ellmer::chat_anthropic()))
)
result <- runner$invoke(list(messages = list("Write a short story.")))
} # }