Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
engine.cpp File Reference

AgentEngine implementation — the agentic loop. More...

#include <entropic/core/engine.h>
#include <entropic/core/delegation.h>
#include <entropic/core/sandbox.h>
#include <entropic/types/logging.h>
#include <entropic/types/tool_result.h>
#include <nlohmann/json.hpp>
#include <algorithm>
#include <array>
#include <chrono>
#include <sstream>
Include dependency graph for engine.cpp:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

static void entropic::fire_hook_info (const HookInterface &hooks, entropic_hook_point_t point, const char *json)
 Fire an informational hook if the interface is wired.
 
static void entropic::fire_loop_start_hook (const HookInterface &hooks, const LoopContext &ctx)
 Build + fire the ON_LOOP_START info hook.
 
static void entropic::fire_loop_end_hook (const HookInterface &hooks, const LoopContext &ctx)
 Build + fire the ON_LOOP_END info hook.
 
static void entropic::fire_loop_iteration_hook (const HookInterface &hooks, const LoopContext &ctx)
 Build + fire the ON_LOOP_ITERATION info hook.
 
static void entropic::fire_context_assemble_hook (const HookInterface &hooks, const LoopContext &ctx)
 Build + fire the ON_CONTEXT_ASSEMBLE info hook.
 
static void entropic::remove_anchor_messages (LoopContext &ctx, const std::string &key)
 Remove messages with a specific anchor key.
 
static double entropic::now_seconds ()
 Get current time as seconds since epoch.
 
static ToolCall entropic::build_tool_call_from_json (const nlohmann::json &obj, const std::string &tc_str)
 Parse tool calls from raw model output.
 
static std::vector< ToolCallentropic::decode_tool_calls_json (const std::string &tc_str)
 Decode a JSON tool-calls array string into ToolCall vector.
 
static const std::array< const char *, 256 > & entropic::json_escape_table ()
 256-entry table mapping bytes to JSON escape sequences.
 
static std::string entropic::json_escape_engine (const std::string &s)
 JSON-escape a string (no surrounding quotes).
 
static std::string entropic::build_tool_manifest (const std::vector< Message > &messages)
 Build tool call manifest from conversation messages.
 
static std::string entropic::format_tool_evidence_entry (const Message &msg, size_t chars_per_result)
 Format one tool-result message for the evidence block.
 
static std::string entropic::build_tool_evidence (const std::vector< Message > &messages, size_t max_results, size_t chars_per_result)
 Build un-pruned tool-result evidence for the validator.
 
static std::string entropic::enrich_manifest_with_history (const std::string &base, const ToolExecutionInterface &tool_exec)
 Append executor history (if any) to the tool manifest.
 
static std::string entropic::extract_system_prompt (const std::vector< Message > &messages)
 Extract the first system message content from messages.
 
static std::string entropic::build_tool_results_json (const std::vector< Message > &messages)
 Build a JSON array of tool results from context messages.
 
static void entropic::run_child_loop_trampoline (LoopContext &ctx, void *user_data)
 Trampoline for DelegationManager to call engine loop.
 
static void entropic::push_delegation_rejected (LoopContext &ctx)
 Append a delegation rejection message to the loop context.
 
static void entropic::push_delegation_cycle_rejected (LoopContext &ctx, const std::string &target)
 Append a structured cycle-rejection message to the loop context so the model can recover.
 
static void entropic::push_delegation_result (LoopContext &ctx, const std::string &target, const DelegationResult &result)
 Append a delegation result message to the loop context.
 
static void entropic::push_delegation_repeat_blocked (LoopContext &ctx, const std::string &target, int n)
 Append a "stop retrying same target" reject message (gh#64).
 
static std::string entropic::build_coverage_gap_message (const std::string &tier, const DelegationResult &result)
 Build the [COVERAGE GAP] message body that goes back to lead when a relay-tier child returns coverage_gap=true (#10, v2.1.4).
 
static void entropic::push_resume_failure (LoopContext &ctx, const std::string &reason, const std::string &delegation_id)
 Lazy session-scoped SandboxManager accessor (gh#33, v2.1.6).
 
static std::string entropic::concat_user_echo (const std::vector< Message > &messages)
 Concatenate user-role message text for session-log echo.
 

Variables

static auto logger = entropic::log::get("core.engine")
 

Detailed Description

AgentEngine implementation — the agentic loop.

Version
1.8.6

Definition in file engine.cpp.

Variable Documentation

◆ logger

auto logger = entropic::log::get("core.engine")
static

Definition at line 21 of file engine.cpp.