|
Entropic 2.14.3
Local-first agentic inference engine
|
AgentEngine implementation — the agentic loop. More...
#include <entropic/core/engine.h>#include <entropic/core/delegation.h>#include <entropic/core/delegate_hook_payload.h>#include <entropic/core/sandbox.h>#include <entropic/mcp/utf8_sanitize.h>#include <entropic/types/logging.h>#include <entropic/types/run_scope.h>#include <entropic/types/tool_result.h>#include <nlohmann/json.hpp>#include <algorithm>#include <array>#include <chrono>#include <sstream>
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 std::string | entropic::last_substantive_assistant (const LoopContext &ctx) |
| The last assistant message with something in it (gh#169). | |
| static std::string | entropic::annotate_hard_stop (const std::string &carried, const std::string &reason, const std::string &stop_noun) |
| Build an engine-forced stop's final assistant content. | |
| 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< ToolCall > | entropic::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 void | entropic::push_delegation_isolation_unsafe (LoopContext &ctx, const std::string &target, const std::vector< std::string > &tools) |
| Append the "isolation cannot be honoured" reject message (gh#160). | |
| 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::fold_delegation_summary (LoopContext &ctx, const std::string &summary) |
| gh#119 (v2.9.17): fold child summary into the lead's empty delegate turn. | |
| 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. | |
| static std::string | entropic::join_csv (const std::vector< std::string > &v) |
| Join a vector of strings with comma separators. | |
Variables | |
| static auto | logger = entropic::log::get("core.engine") |
| int* cancel |
Consumer's cancel flag, nullable.
Definition at line 4074 of file engine.cpp.
| AgentEngine* engine |
Fallback interrupt target.
Definition at line 4075 of file engine.cpp.
| StreamThinkFilter* filter |
Consumer-facing filter.
Definition at line 4073 of file engine.cpp.
|
static |
Definition at line 24 of file engine.cpp.