| WorkflowAgent | R Documentation |
A lightweight, Agent-compatible wrapper around a 'Workflow'. Created via
Workflow$as_agent().
'WorkflowAgent' exposes the same interface that 'LeadAgent' expects from
any agent (name, instruction, agent_id,
$invoke()), so it can be:
Registered with LeadAgent$register_agents().
Used as a Station handler inside another 'Workflow'.
Do not instantiate 'WorkflowAgent' directly - use Workflow$as_agent().
nameAgent name (visible to 'LeadAgent' for task matching).
instructionSystem instruction describing the agent's role.
agent_idUnique identifier (UUID).
workflowThe underlying 'Workflow' object.
messagesConversation history as a list of
list(role, content) entries.
new()Create a new 'WorkflowAgent'. Prefer Workflow$as_agent().
WorkflowAgent$new(name, instruction, workflow)
name'[character(1)]' Agent name.
instruction'[character(1)]' Instruction / system prompt.
workflowA 'Workflow' object.
invoke()Run the underlying workflow with 'prompt' as input.
Not compatible with a wrapped 'Workflow' whose hitl_mode is
'"pause"': a 'WorkflowAgent' is invoked synchronously from a 'Workflow'
Station or a 'LeadAgent' step, both of which expect a single character
result back, not a 'mini007_pending' object to resume later. Use
hitl_mode = "console" (the default), or drive the wrapped
workflow directly with $workflow$run() / $resume() if you
need pause/resume HITL.
WorkflowAgent$invoke(prompt, stream = FALSE, on_event = NULL)
prompt'[character(1)]' The user prompt / input payload.
stream‘[logical(1)]' Whether to stream the wrapped workflow’s
progress (see Workflow$run()).
on_event'[function | NULL]' Callback receiving each
'mini007_event' emitted by the wrapped workflow and its Agents.
Supplying it implies stream = TRUE.
'[character(1)]' The final output of the workflow.
as_tool()Wraps the workflow in an ellmer tool, so that an agent can run it.
See Agent$as_tool(): the tool's ‘request' is the workflow’s
input, and it returns the workflow's output.
WorkflowAgent$as_tool(description = NULL, name = NULL, fresh = FALSE)
description'[character(1) | NULL]' What the workflow does. Defaults to a description made from the name and instruction.
name'[character(1) | NULL]' The tool name. Defaults to the agent's name.
fresh'[logical(1)]' If 'TRUE', $messages is cleared
before each run.
An ellmer tool.
reset_conversation_history()Clear the conversation history stored in $messages.
WorkflowAgent$reset_conversation_history()
Invisibly returns 'self'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.