Skip to main content

ReasonAtom

Struct ReasonAtom 

Source
pub struct ReasonAtom { /* private fields */ }
Expand description

Atom that calls the LLM model for reasoning

This atom:

  1. Emits reason.started event
  2. Retrieves agent and session configuration from stores
  3. Resolves model using priority: controls.model_id > session.model_id > agent.default_model_id
  4. Builds configuration with capabilities applied
  5. Loads messages from the store
  6. Patches dangling tool calls
  7. Resolves image_file content parts to actual image data (if ImageResolver provided)
  8. Calls the LLM with the messages
  9. Stores the assistant response
  10. Emits reason.completed event
  11. Returns the result with tool calls (if any)

Implementations§

Source§

impl ReasonAtom

Source

pub fn with_native_async( self, coordinator: Arc<Mutex<NativeAsyncCoordinator>>, ) -> Self

Source

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

Source

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.

Source

pub fn with_compaction_checkpoint_store( self, store: Arc<dyn CompactionCheckpointStore>, ) -> Self

Source

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);
Source

pub fn with_file_resolver(self, resolver: Arc<dyn FileResolver>) -> Self

Source

pub fn with_stream_heartbeater( self, heartbeater: Arc<dyn StreamHeartbeater>, ) -> Self

Set the stream heartbeater for liveness signalling during LLM streaming.

Source

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.

Source

pub fn with_provider_retry_config(self, config: LlmRetryConfig) -> Self

Set the bounded provider recovery policy.

Source

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.

Source

pub fn with_partial_stream_store( self, store: Arc<dyn PartialStreamStore>, ) -> Self

Set the partial-stream store for ContinuePartial recovery (EVE-532).

Source

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.

Source

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

Source

pub fn name(&self) -> &'static str

Stable phase name used by logs and durable activity adapters.

Source

pub async fn execute(&self, input: ReasonInput) -> Result<ReasonResult>

Execute a reason phase using host-injected portable contracts.

Source§

impl ReasonAtom

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more