pub struct ReasonAtom { /* private fields */ }Expand description
Atom that calls the LLM model for reasoning
This atom:
- Emits reason.started event
- Retrieves agent and session configuration from stores
- Resolves model using priority: controls.model_id > session.model_id > agent.default_model_id
- Builds configuration with capabilities applied
- Loads messages from the store
- Patches dangling tool calls
- Resolves image_file content parts to actual image data (if ImageResolver provided)
- Calls the LLM with the messages
- Stores the assistant response
- Emits reason.completed event
- Returns the result with tool calls (if any)
Implementations§
Source§impl ReasonAtom
impl ReasonAtom
pub fn with_native_async( self, coordinator: Arc<Mutex<NativeAsyncCoordinator>>, ) -> Self
Sourcepub fn new(
context_resolver: impl TurnContextResolver + 'static,
message_retriever: impl MessageRetriever + 'static,
capability_registry: CapabilityRegistry,
event_emitter: impl PhaseEffectSink + 'static,
) -> Self
pub fn new( context_resolver: impl TurnContextResolver + 'static, message_retriever: impl MessageRetriever + 'static, capability_registry: CapabilityRegistry, event_emitter: impl PhaseEffectSink + 'static, ) -> Self
Create a new ReasonAtom
Sourcepub fn with_schedule_store(self, store: Arc<dyn SessionScheduleStore>) -> Self
pub fn with_schedule_store(self, store: Arc<dyn SessionScheduleStore>) -> Self
Set the session schedule store used by usage_limit_auto_continue to
schedule a continuation after a provider usage limit resets.
pub fn with_compaction_checkpoint_store( self, store: Arc<dyn CompactionCheckpointStore>, ) -> Self
Sourcepub fn with_image_resolver(self, resolver: Arc<dyn ImageResolver>) -> Self
pub fn with_image_resolver(self, resolver: Arc<dyn ImageResolver>) -> Self
Set the image resolver for resolving image_file content parts
When set, image_file references in messages will be resolved to actual image data before being sent to the LLM. This is required for multimodal conversations that include image attachments.
§Example
let resolver = Arc::new(GrpcImageResolver::new(client));
let atom = ReasonAtom::new(/* ... */).with_image_resolver(resolver);pub fn with_file_resolver(self, resolver: Arc<dyn FileResolver>) -> Self
Sourcepub fn with_stream_heartbeater(
self,
heartbeater: Arc<dyn StreamHeartbeater>,
) -> Self
pub fn with_stream_heartbeater( self, heartbeater: Arc<dyn StreamHeartbeater>, ) -> Self
Set the stream heartbeater for liveness signalling during LLM streaming.
Sourcepub fn with_provider_stall_timeout(self, timeout: Duration) -> Self
pub fn with_provider_stall_timeout(self, timeout: Duration) -> Self
Set the provider stall timeout. If no token arrives within this window, the stream is aborted and the activity fails with a retryable error.
Sourcepub fn with_provider_retry_config(self, config: LlmRetryConfig) -> Self
pub fn with_provider_retry_config(self, config: LlmRetryConfig) -> Self
Set the bounded provider recovery policy.
Sourcepub fn with_durable_tool_result_store(
self,
store: Arc<dyn DurableToolResultStore>,
) -> Self
pub fn with_durable_tool_result_store( self, store: Arc<dyn DurableToolResultStore>, ) -> Self
Set the durable tool result store for transcript repair (EVE-533).
When provided, transcript repair consults this store to replay settled tool results or synthesize appropriate interrupted placeholders rather than always emitting a generic “cancelled” message.
Sourcepub fn with_partial_stream_store(
self,
store: Arc<dyn PartialStreamStore>,
) -> Self
pub fn with_partial_stream_store( self, store: Arc<dyn PartialStreamStore>, ) -> Self
Set the partial-stream store for ContinuePartial recovery (EVE-532).
Sourcepub fn with_reasoning_effort_handle(self, handle: ReasoningEffortHandle) -> Self
pub fn with_reasoning_effort_handle(self, handle: ReasoningEffortHandle) -> Self
Set the live reasoning-effort handle (EVE-595).
When set and holding a value, the effort it carries overrides the message-derived effort for every LLM step. Because the handle is shared and re-read on each step, a tool that mutates it mid-turn causes subsequent steps in the same turn to use the new effort.
Sourcepub fn with_utility_llm_service(
self,
service: Arc<dyn UtilityLlmService>,
) -> Self
pub fn with_utility_llm_service( self, service: Arc<dyn UtilityLlmService>, ) -> Self
Set the utility LLM service used by model-backed end-of-message output guardrails (EVE-573). When unset, those guardrails fail open.
Source§impl ReasonAtom
impl ReasonAtom
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Stable phase name used by logs and durable activity adapters.
Sourcepub async fn execute(&self, input: ReasonInput) -> Result<ReasonResult>
pub async fn execute(&self, input: ReasonInput) -> Result<ReasonResult>
Execute a reason phase using host-injected portable contracts.
Source§impl ReasonAtom
impl ReasonAtom
Sourcepub async fn execute_with_assembled_context(
&self,
input: ReasonInput,
assembled: AssembledTurnContext,
) -> Result<ReasonResult>
pub async fn execute_with_assembled_context( &self, input: ReasonInput, assembled: AssembledTurnContext, ) -> Result<ReasonResult>
Execute using a pre-assembled turn context.
Hosts that already assembled turn context for the current reason phase can pass it through here to avoid reloading messages and rebuilding the agent.