pub struct AgentWorkflow { /* private fields */ }Expand description
Durable AI agent workflow.
Each invocation runs a ReAct loop until the model emits a final answer or
max_turns is reached. Every LLM call and every tool call is a separate
Temporal activity; crashes resume from the last completed activity without
re-paying for prior LLM turns.
Implementations§
Source§impl AgentWorkflow
impl AgentWorkflow
Sourcepub async fn __run(
ctx: &mut WorkflowContext<Self>,
input: AgentInput,
) -> WorkflowResult<AgentOutput>
pub async fn __run( ctx: &mut WorkflowContext<Self>, input: AgentInput, ) -> WorkflowResult<AgentOutput>
Entry point. Initializes state from input, then loops until the LLM
emits a final answer or max_turns is reached.
Sourcepub fn __add_user_message(
&mut self,
_ctx: &mut SyncWorkflowContext<Self>,
msg: String,
)
pub fn __add_user_message( &mut self, _ctx: &mut SyncWorkflowContext<Self>, msg: String, )
Inject a new user message mid-conversation.
Buffered until the start of the next loop iteration so we never mutate history concurrently with an in-flight LLM activity.
Sourcepub fn __get_state(&self, _ctx: &WorkflowContextView) -> AgentState
pub fn __get_state(&self, _ctx: &WorkflowContextView) -> AgentState
Read the full live state.
Sourcepub fn __turn_count(&self, _ctx: &WorkflowContextView) -> u32
pub fn __turn_count(&self, _ctx: &WorkflowContextView) -> u32
Cheap turn counter for monitoring.
Source§impl AgentWorkflow
impl AgentWorkflow
pub const run: Run = agent_workflow::Run
pub const add_user_message: AddUserMessage = agent_workflow::AddUserMessage
pub const get_state: GetState = agent_workflow::GetState
pub const turn_count: TurnCount = agent_workflow::TurnCount
Trait Implementations§
Source§impl Default for AgentWorkflow
impl Default for AgentWorkflow
Source§fn default() -> AgentWorkflow
fn default() -> AgentWorkflow
Returns the “default value” for a type. Read more
Source§impl HasWorkflowDefinition for AgentWorkflow
impl HasWorkflowDefinition for AgentWorkflow
Source§type Run = Run
type Run = Run
The
WorkflowDefinition type that SignalDefinition, QueryDefinition, and
UpdateDefinition are associated with.Source§impl WorkflowDefinition for AgentWorkflow
impl WorkflowDefinition for AgentWorkflow
Auto Trait Implementations§
impl Freeze for AgentWorkflow
impl RefUnwindSafe for AgentWorkflow
impl Send for AgentWorkflow
impl Sync for AgentWorkflow
impl Unpin for AgentWorkflow
impl UnsafeUnpin for AgentWorkflow
impl UnwindSafe for AgentWorkflow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage