pub struct QueryEngine { /* private fields */ }Expand description
The query engine orchestrates the agent loop.
Central coordinator that drives the LLM → tools → LLM cycle.
Manages conversation history, context compaction, tool execution,
error recovery, and hook dispatch. Create via QueryEngine::new.
Implementations§
Source§impl QueryEngine
impl QueryEngine
pub fn new( llm: Arc<dyn Provider>, tools: ToolRegistry, permissions: PermissionChecker, state: AppState, config: QueryEngineConfig, ) -> Self
Sourcepub fn load_hooks(&mut self, hook_defs: &[HookDefinition])
pub fn load_hooks(&mut self, hook_defs: &[HookDefinition])
Load hooks from configuration into the registry.
Sourcepub fn install_signal_handler(&self)
pub fn install_signal_handler(&self)
Install a Ctrl+C handler that triggers the cancellation token. Call this once at startup. Subsequent Ctrl+C signals during a turn will cancel the active operation instead of killing the process.
Sourcepub async fn run_turn(&mut self, user_input: &str) -> Result<()>
pub async fn run_turn(&mut self, user_input: &str) -> Result<()>
Run a single turn: process user input through the full agent loop.
Sourcepub async fn run_turn_with_sink(
&mut self,
user_input: &str,
sink: &dyn StreamSink,
) -> Result<()>
pub async fn run_turn_with_sink( &mut self, user_input: &str, sink: &dyn StreamSink, ) -> Result<()>
Run a turn with a stream sink for real-time UI updates.
Sourcepub fn cancel_token(&self) -> CancellationToken
pub fn cancel_token(&self) -> CancellationToken
Get a cloneable cancel token for use in background tasks.
Auto Trait Implementations§
impl Freeze for QueryEngine
impl !RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl Sync for QueryEngine
impl Unpin for QueryEngine
impl UnsafeUnpin for QueryEngine
impl !UnwindSafe for QueryEngine
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