pub struct AgentActivities {
pub llm: Arc<dyn LLMProvider>,
pub tools: ToolRegistry,
}Expand description
Shared state for the activity worker. One instance per worker process.
Arc<dyn LLMProvider> and the ToolRegistry are both cheap to clone and
safe to share across concurrent activity executions.
Fields§
§llm: Arc<dyn LLMProvider>§tools: ToolRegistryImplementations§
Source§impl AgentActivities
impl AgentActivities
pub fn new(llm: Arc<dyn LLMProvider>, tools: ToolRegistry) -> Self
Source§impl AgentActivities
impl AgentActivities
Sourcepub async fn __llm_chat(
self: Arc<Self>,
_ctx: ActivityContext,
input: LlmChatInput,
) -> Result<LlmResponse, ActivityError>
pub async fn __llm_chat( self: Arc<Self>, _ctx: ActivityContext, input: LlmChatInput, ) -> Result<LlmResponse, ActivityError>
One LLM “reasoning step”: given the running conversation and the catalog of tools, ask the model what to do next.
Returns either a final answer or a list of tool calls to execute.
Sourcepub async fn __execute_tool(
self: Arc<Self>,
_ctx: ActivityContext,
call: ToolCall,
) -> Result<ToolResult, ActivityError>
pub async fn __execute_tool( self: Arc<Self>, _ctx: ActivityContext, call: ToolCall, ) -> Result<ToolResult, ActivityError>
Execute a single tool call.
Tool-side failures are returned as Ok(ToolResult { error: Some(..) })
— they are observed by the LLM, not retried by Temporal. Only
infrastructure errors (missing tool registration, serde failure)
surface as Err.
Source§impl AgentActivities
impl AgentActivities
pub const llm_chat: LlmChat = agent_activities::LlmChat
pub const execute_tool: ExecuteTool = agent_activities::ExecuteTool
Trait Implementations§
Source§impl Clone for AgentActivities
impl Clone for AgentActivities
Source§fn clone(&self) -> AgentActivities
fn clone(&self) -> AgentActivities
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentActivities
impl !RefUnwindSafe for AgentActivities
impl Send for AgentActivities
impl Sync for AgentActivities
impl Unpin for AgentActivities
impl UnsafeUnpin for AgentActivities
impl !UnwindSafe for AgentActivities
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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