Module reasoning_loop

Module reasoning_loop 

Source
Expand description

§Async ReasoningLoop Engine

High-performance async reasoning engine with Tokio-based concurrency, memory integration, and streaming support.

§Design Principles

  1. Async-First: All I/O operations are non-blocking
  2. Channel-Based Concurrency: ThinkTools execute via broadcast channels
  3. Streaming Output: Real-time step-by-step reasoning visibility
  4. Memory Integration: Optional reasonkit-mem for context enrichment
  5. Profile System: quick/balanced/deep/paranoid execution modes

§Performance Characteristics

  • Concurrent ThinkTool execution reduces latency by (N-1)/N for N independent tools
  • Zero-copy streaming via tokio broadcast channels
  • Bounded channel backpressure prevents memory exhaustion
  • Connection pooling for LLM API calls

Structs§

Decision
Final decision from reasoning loop
ExecutionContext
Context for ThinkTool execution
MemoryChunk
A chunk retrieved from memory
MemoryContext
Context retrieved from memory
ReasoningConfig
Configuration for the ReasoningLoop
ReasoningLoop
High-performance async reasoning engine
ReasoningLoopBuilder
Builder for ReasoningLoop with fluent API
ReasoningSession
Stateful reasoning session with accumulated context
ReasoningStep
A single step in the reasoning process
StreamHandle
Handle for receiving streaming events
ThinkToolResult
Result from a ThinkTool execution
TokenUsage
Token usage statistics

Enums§

Profile
Reasoning profiles that determine ThinkTool chains and confidence targets
ReasoningError
Errors that can occur during reasoning loop execution
ReasoningEvent
Events emitted during reasoning loop execution
StepKind
Kind of reasoning step

Traits§

MemoryProvider
Trait for memory providers (enables mock testing and multiple backends)
ThinkToolExecutor
Trait for ThinkTool execution (enables custom implementations)

Type Aliases§

Result
Result type for reasoning operations