73 const std::string& tool_calls_json);
116 int dispatch_batch_generate(
117 const std::string& msgs_json,
118 const std::string& params_json,
134 std::pair<std::string, std::string> prepare_prompts(
145 const std::string& partial);
153 static std::string serialize_messages(
154 const std::vector<Message>& messages);
162 std::string build_params_json(
const std::string& tier);
188 std::vector<Message> inject_engine_state_reminder(
189 const std::vector<Message>& messages,
192 InferenceInterface inference_;
196 HookInterface hooks_;
202 void* stream_observer_data_ =
nullptr;
208 void (*state_observer_)(int,
void*) =
nullptr;
209 void* state_observer_data_ =
nullptr;
218 void set_hooks(
const HookInterface& hooks) { hooks_ = hooks; }
234 stream_observer_ = observer;
235 stream_observer_data_ = user_data;
259 void (*observer)(
int,
void*),
void* user_data) {
260 state_observer_ = observer;
261 state_observer_data_ = user_data;
Handles model response generation, tier routing, pause/injection.
GenerateResult generate_response(LoopContext &ctx)
Generate model response, routing tier first if needed.
void set_stream_observer(TokenCallback observer, void *user_data)
Set the global stream observer.
bool is_response_complete(const std::string &content, const std::string &tool_calls_json)
Check if the last response indicates completion.
void set_hooks(const HookInterface &hooks)
Set the hook dispatch interface.
void set_state_observer(void(*observer)(int, void *), void *user_data)
Set the persistent state-transition observer.
void * stream_observer_data() const
Get the observer's user_data pointer.
TokenCallback stream_observer() const
Get the registered stream observer callback.
Types for the agentic loop engine.
Hook dispatch interface injected into engine subsystems.
Function pointer types for core-to-inference communication.
Activate model on GPU (WARM → ACTIVE).
void(*)(const char *, size_t, void *) TokenCallback
Token callback type matching the C API signature.
Streaming filter that strips <think>...</think> blocks.
Callback function pointer types for engine events.
Result of a generate_response call.
std::string tool_calls_json
Tool calls as JSON (empty if none)
std::string finish_reason
"stop", "length", "interrupted"
std::string content
Cleaned response content.
Atomic flags for interrupt/pause signaling.
Configuration for the agentic loop.
Mutable state carried through the agentic loop.