Skip to main content

MagenticManager

Trait MagenticManager 

Source
pub trait MagenticManager: Send + Sync {
    // Required methods
    fn plan<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 MagenticContext,
    ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn replan<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 MagenticContext,
    ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn create_progress_ledger<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 MagenticContext,
    ) -> Pin<Box<dyn Future<Output = Result<MagenticProgressLedger, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn prepare_final_answer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 MagenticContext,
    ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn max_stall_count(&self) -> usize { ... }
    fn max_reset_count(&self) -> Option<usize> { ... }
    fn max_round_count(&self) -> Option<usize> { ... }
    fn current_task_ledger(&self) -> Option<MagenticTaskLedger> { ... }
}
Expand description

The Magentic manager interface: planning, replanning, progress evaluation, and final-answer synthesis. Rust analogue of MagenticManagerBase.

Required Methods§

Source

fn plan<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 MagenticContext, ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gather facts and produce the initial plan (returns the combined ledger).

Source

fn replan<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 MagenticContext, ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Update facts and plan after a stall (returns the combined ledger).

Source

fn create_progress_ledger<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 MagenticContext, ) -> Pin<Box<dyn Future<Output = Result<MagenticProgressLedger, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Produce the structured progress ledger for the current round.

Source

fn prepare_final_answer<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 MagenticContext, ) -> Pin<Box<dyn Future<Output = Result<Message, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Synthesize the final answer addressed to the user.

Provided Methods§

Source

fn max_stall_count(&self) -> usize

The stall threshold that triggers a replan.

Source

fn max_reset_count(&self) -> Option<usize>

The maximum number of replans, if bounded.

Source

fn max_round_count(&self) -> Option<usize>

The maximum number of rounds, if bounded.

Source

fn current_task_ledger(&self) -> Option<MagenticTaskLedger>

The manager’s current decomposed task ledger (facts + plan), if it tracks one separately from the combined message Self::plan / Self::replan return.

Used only by plan review, to surface separate facts/plan text in MagenticPlanReviewRequest and to re-render the combined ledger after a direct human edit without an LLM call. Default None; StandardMagenticManager overrides it. Rust analogue of Python’s getattr(manager, "task_ledger", None) escape hatch in _send_plan_review_request / _handle_plan_review_response.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§