% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Workflow.R
\name{WorkflowAgent}
\alias{WorkflowAgent}
\title{WorkflowAgent}
\description{
A lightweight, Agent-compatible wrapper around a `Workflow`. Created via
\code{Workflow$as_agent()}.

`WorkflowAgent` exposes the same interface that `LeadAgent` expects from
any agent (\code{name}, \code{instruction}, \code{agent_id},
\code{$invoke()}), so it can be:
\itemize{
  \item Registered with \code{LeadAgent$register_agents()}.
  \item Used as a Station handler inside another `Workflow`.
}

Do not instantiate `WorkflowAgent` directly - use \code{Workflow$as_agent()}.
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{name}}{Agent name (visible to `LeadAgent` for task matching).}

\item{\code{instruction}}{System instruction describing the agent's role.}

\item{\code{agent_id}}{Unique identifier (UUID).}

\item{\code{workflow}}{The underlying `Workflow` object.}

\item{\code{messages}}{Conversation history as a list of
\code{list(role, content)} entries.}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-WorkflowAgent-new}{\code{WorkflowAgent$new()}}
\item \href{#method-WorkflowAgent-invoke}{\code{WorkflowAgent$invoke()}}
\item \href{#method-WorkflowAgent-reset_conversation_history}{\code{WorkflowAgent$reset_conversation_history()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-WorkflowAgent-new"></a>}}
\if{latex}{\out{\hypertarget{method-WorkflowAgent-new}{}}}
\subsection{Method \code{new()}}{
Create a new `WorkflowAgent`. Prefer \code{Workflow$as_agent()}.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{WorkflowAgent$new(name, instruction, workflow)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{name}}{`[character(1)]` Agent name.}

\item{\code{instruction}}{`[character(1)]` Instruction / system prompt.}

\item{\code{workflow}}{A `Workflow` object.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-WorkflowAgent-invoke"></a>}}
\if{latex}{\out{\hypertarget{method-WorkflowAgent-invoke}{}}}
\subsection{Method \code{invoke()}}{
Run the underlying workflow with `prompt` as input.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{WorkflowAgent$invoke(prompt)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{prompt}}{`[character(1)]` The user prompt / input payload.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
`[character(1)]` The final output of the workflow.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-WorkflowAgent-reset_conversation_history"></a>}}
\if{latex}{\out{\hypertarget{method-WorkflowAgent-reset_conversation_history}{}}}
\subsection{Method \code{reset_conversation_history()}}{
Clear the conversation history stored in \code{$messages}.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{WorkflowAgent$reset_conversation_history()}\if{html}{\out{</div>}}
}

\subsection{Returns}{
Invisibly returns `self`.
}
}
}
