QueryEngine class

Core conversation engine.

Implements the agentic loop: user message → API call → tool extraction → permission check → tool execution → result injection → compaction check → repeat

Constructors

QueryEngine({required ApiProvider provider, required ToolRegistry toolRegistry, required String systemPrompt, QueryEngineConfig config = const QueryEngineConfig(), CompactionService? compactionService, SessionMemoryService? sessionMemory, ToolPermissionContext? permissionContext})

Properties

compactionService ↔ CompactionService?
Optional compaction service.
getter/setter pair
config → QueryEngineConfig
final
hashCode → int
The hash code for this object.
no setterinherited
permissionContext ↔ ToolPermissionContext?
Permission context for checking tool permissions.
getter/setter pair
provider → ApiProvider
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionMemory ↔ SessionMemoryService?
Optional session memory service.
getter/setter pair
systemPrompt → String
final
toolRegistry → ToolRegistry
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query({required List<Message> messages, OnTextDelta? onTextDelta, OnToolUse? onToolUse, OnToolResult? onToolResult, OnApiError? onError, OnPermissionRequest? onPermissionRequest, OnCompaction? onCompaction, void onStreamEvent(StreamEvent)?}) → Future<Message>
Run a full query with tool use loop (streaming).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited