pub trait DurableContext: WasmCompatSend + WasmCompatSync {
// Required methods
fn execute_llm_call(
&self,
request: CompletionRequest,
options: ActivityOptions,
) -> impl Future<Output = Result<CompletionResponse, DurableError>> + WasmCompatSend;
fn execute_tool(
&self,
tool_name: &str,
input: Value,
ctx: &ToolContext,
options: ActivityOptions,
) -> impl Future<Output = Result<ToolOutput, DurableError>> + WasmCompatSend;
fn wait_for_signal<T: DeserializeOwned + WasmCompatSend>(
&self,
signal_name: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<T>, DurableError>> + WasmCompatSend;
fn should_continue_as_new(&self) -> bool;
fn continue_as_new(
&self,
state: Value,
) -> impl Future<Output = Result<(), DurableError>> + WasmCompatSend;
fn sleep(
&self,
duration: Duration,
) -> impl Future<Output = ()> + WasmCompatSend;
fn now(&self) -> DateTime<Utc>;
}Expand description
Wraps side effects for durable execution engines (Temporal, Restate, Inngest).
When present, the agentic loop calls through this instead of directly calling provider/tools, enabling journaling, replay, and crash recovery.
Required Methods§
Sourcefn execute_llm_call(
&self,
request: CompletionRequest,
options: ActivityOptions,
) -> impl Future<Output = Result<CompletionResponse, DurableError>> + WasmCompatSend
fn execute_llm_call( &self, request: CompletionRequest, options: ActivityOptions, ) -> impl Future<Output = Result<CompletionResponse, DurableError>> + WasmCompatSend
Execute an LLM call as a durable activity.
Sourcefn execute_tool(
&self,
tool_name: &str,
input: Value,
ctx: &ToolContext,
options: ActivityOptions,
) -> impl Future<Output = Result<ToolOutput, DurableError>> + WasmCompatSend
fn execute_tool( &self, tool_name: &str, input: Value, ctx: &ToolContext, options: ActivityOptions, ) -> impl Future<Output = Result<ToolOutput, DurableError>> + WasmCompatSend
Execute a tool call as a durable activity.
Sourcefn wait_for_signal<T: DeserializeOwned + WasmCompatSend>(
&self,
signal_name: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<T>, DurableError>> + WasmCompatSend
fn wait_for_signal<T: DeserializeOwned + WasmCompatSend>( &self, signal_name: &str, timeout: Duration, ) -> impl Future<Output = Result<Option<T>, DurableError>> + WasmCompatSend
Wait for an external signal with a timeout.
Sourcefn should_continue_as_new(&self) -> bool
fn should_continue_as_new(&self) -> bool
Whether the workflow should continue-as-new to avoid history bloat.
Sourcefn continue_as_new(
&self,
state: Value,
) -> impl Future<Output = Result<(), DurableError>> + WasmCompatSend
fn continue_as_new( &self, state: Value, ) -> impl Future<Output = Result<(), DurableError>> + WasmCompatSend
Continue the workflow as a new execution with the given state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.