Expand description
Query engine: the core agent loop.
Implements the agentic cycle:
- Auto-compact if context nears the window limit
- Microcompact stale tool results
- Call LLM with streaming
- Accumulate response content blocks
- Handle errors (prompt-too-long, rate limits, max-output-tokens)
- Extract tool_use blocks
- Execute tools (concurrent/serial batching)
- Inject tool results into history
- Repeat from step 1 until no tool_use or max turns
Modules§
- source
- Query source tagging.
Structs§
- Null
Sink - A no-op stream sink for non-interactive mode.
- Query
Engine - The query engine orchestrates the agent loop.
- Query
Engine Config - Configuration for the query engine.
Traits§
- Stream
Sink - Callback for streaming events to the UI.
Functions§
- build_
system_ prompt - Build the system prompt from tool definitions, app state, and memory.