A single worker agent produces output; a higher-tier advisor agent evaluates
it and either approves or requests a revision. The worker revises until
approved or max_revisions is reached.
Arguments
- worker
An
Agentobject that produces the draft (typically a lower-cost model such as Haiku).- advisor
An
Agentobject that evaluates the draft (typically a higher-capability model such as Opus).- max_revisions
Integer. Maximum number of revision cycles (default 3L).
- state_schema
A WorkflowState or
NULL(uses default). The default schema provides:messages(append),latest_draft(overwrite),advisor_feedback(overwrite),advisor_verdict(overwrite),revision_n(overwrite).
Value
A compiled GraphRunner.
Examples
if (FALSE) { # \dontrun{
runner <- advisor_workflow(
worker = agent("writer", ellmer::chat_anthropic(model = "claude-haiku-4-5-20251001")),
advisor = agent("advisor", ellmer::chat_anthropic(model = "claude-opus-4-6"))
)
result <- runner$invoke(list(messages = list("Write a concise explanation of R6 classes.")))
result$get("latest_draft")
} # }