Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::LoopContext Struct Reference

Mutable state carried through the agentic loop. More...

#include <entropic/core/engine_types.h>

Collaboration diagram for entropic::LoopContext:

Public Attributes

std::vector< Messagemessages
 Conversation history.
 
std::vector< ToolCallpending_tool_calls
 Pending tool calls (v1.8.5)
 
AgentState state = AgentState::IDLE
 Current state.
 
LoopMetrics metrics
 Timing and counts.
 
int consecutive_errors = 0
 Error streak counter.
 
int consecutive_duplicate_attempts = 0
 Stuck-model detector.
 
int effective_tool_calls = 0
 Non-blocked calls this iteration.
 
bool has_pending_tool_results = false
 Tool results awaiting presentation.
 
std::string locked_tier
 Tier locked for this loop ("" = none)
 
std::string task_id
 External task ID (MCP integration)
 
std::string conversation_id
 Conversation ID for storage (v1.8.8)
 
std::string source = "human"
 Message source.
 
std::vector< std::string > all_tools
 Full tool list as raw JSON strings.
 
std::string base_system
 Base system prompt (pre-tier formatting)
 
std::unordered_map< std::string, std::string > metadata
 Runtime metadata.
 
int delegation_depth = 0
 0 = root, 1+ = child
 
std::vector< std::string > delegation_ancestor_tiers
 Tier stack from root to this loop (P1-9, 2.0.6-rc16)
 
std::string parent_conversation_id
 Parent conv ID (delegation)
 
std::vector< std::string > child_conversation_ids
 Spawned child IDs.
 
std::string active_phase = "default"
 Active inference phase.
 
std::unordered_map< std::string, std::string > recent_tool_calls
 Duplicate detection cache (v1.8.5)
 
std::optional< PendingDelegationpending_delegation
 Stored by dir_delegate (v1.8.6)
 
std::optional< PendingPipelinepending_pipeline
 Stored by dir_pipeline (v1.8.6)
 
int effective_max_iterations = -1
 Per-identity override (-1 = LoopConfig, P3-18)
 
int effective_max_tool_calls_per_turn = -1
 Per-identity override (-1 = LoopConfig, P3-18)
 
std::string pending_validation_feedback
 One-shot reminder text consumed by the next per-turn system prompt assembly.
 
std::string pending_anti_spiral_warning
 One-shot anti-spiral reminder for the next per-turn system prompt.
 
std::string last_tool_name
 Name of the most recently dispatched tool.
 
int consecutive_same_tool_calls = 0
 Count of CONSECUTIVE successful calls to the same tool (last_tool_name).
 
std::string last_failed_delegation_target
 gh#64: target tier of the most recent FAILED delegation (DelegationResult.success == false).
 
int consecutive_failed_delegations = 0
 gh#64: count of consecutive failed delegations against last_failed_delegation_target.
 

Detailed Description

Mutable state carried through the agentic loop.

All mutable loop state lives here. The engine itself is stateless between run() calls (except context_anchors which persist).

Version
2.0.6-rc16

Definition at line 223 of file engine_types.h.

Member Data Documentation

◆ active_phase

std::string entropic::LoopContext::active_phase = "default"

Active inference phase.

Definition at line 243 of file engine_types.h.

◆ all_tools

std::vector<std::string> entropic::LoopContext::all_tools

Full tool list as raw JSON strings.

Definition at line 236 of file engine_types.h.

◆ base_system

std::string entropic::LoopContext::base_system

Base system prompt (pre-tier formatting)

Definition at line 237 of file engine_types.h.

◆ child_conversation_ids

std::vector<std::string> entropic::LoopContext::child_conversation_ids

Spawned child IDs.

Definition at line 242 of file engine_types.h.

◆ consecutive_duplicate_attempts

int entropic::LoopContext::consecutive_duplicate_attempts = 0

Stuck-model detector.

Definition at line 229 of file engine_types.h.

◆ consecutive_errors

int entropic::LoopContext::consecutive_errors = 0

Error streak counter.

Definition at line 228 of file engine_types.h.

◆ consecutive_failed_delegations

int entropic::LoopContext::consecutive_failed_delegations = 0

gh#64: count of consecutive failed delegations against last_failed_delegation_target.

Reset on success or target switch (intentionally NOT reset on a non-delegation tool call — if a lead reads files between two attempts at the same failing target, we still want to enforce the cap). Compared against LoopConfig::max_consecutive_failed_delegations.

Definition at line 288 of file engine_types.h.

◆ consecutive_same_tool_calls

int entropic::LoopContext::consecutive_same_tool_calls = 0

Count of CONSECUTIVE successful calls to the same tool (last_tool_name).

Reset to 0 when a different tool runs. Compared against LoopConfig::max_consecutive_same_tool. (Demo ask #5, v2.1.0)

Definition at line 275 of file engine_types.h.

◆ conversation_id

std::string entropic::LoopContext::conversation_id

Conversation ID for storage (v1.8.8)

Definition at line 234 of file engine_types.h.

◆ delegation_ancestor_tiers

std::vector<std::string> entropic::LoopContext::delegation_ancestor_tiers

Tier stack from root to this loop (P1-9, 2.0.6-rc16)

Definition at line 240 of file engine_types.h.

◆ delegation_depth

int entropic::LoopContext::delegation_depth = 0

0 = root, 1+ = child

Definition at line 239 of file engine_types.h.

◆ effective_max_iterations

int entropic::LoopContext::effective_max_iterations = -1

Per-identity override (-1 = LoopConfig, P3-18)

Definition at line 247 of file engine_types.h.

◆ effective_max_tool_calls_per_turn

int entropic::LoopContext::effective_max_tool_calls_per_turn = -1

Per-identity override (-1 = LoopConfig, P3-18)

Definition at line 248 of file engine_types.h.

◆ effective_tool_calls

int entropic::LoopContext::effective_tool_calls = 0

Non-blocked calls this iteration.

Definition at line 230 of file engine_types.h.

◆ has_pending_tool_results

bool entropic::LoopContext::has_pending_tool_results = false

Tool results awaiting presentation.

Definition at line 231 of file engine_types.h.

◆ last_failed_delegation_target

std::string entropic::LoopContext::last_failed_delegation_target

gh#64: target tier of the most recent FAILED delegation (DelegationResult.success == false).

Empty when last delegation succeeded, no delegation has run, or a non-delegation tool ran.

Definition at line 280 of file engine_types.h.

◆ last_tool_name

std::string entropic::LoopContext::last_tool_name

Name of the most recently dispatched tool.

Used to detect runs of the same tool for the anti-spiral primitive. Reset to "" when a different tool runs. (Demo ask #5, v2.1.0)

Definition at line 269 of file engine_types.h.

◆ locked_tier

std::string entropic::LoopContext::locked_tier

Tier locked for this loop ("" = none)

Definition at line 232 of file engine_types.h.

◆ messages

std::vector<Message> entropic::LoopContext::messages

Conversation history.

Definition at line 224 of file engine_types.h.

◆ metadata

std::unordered_map<std::string, std::string> entropic::LoopContext::metadata

Runtime metadata.

Definition at line 238 of file engine_types.h.

◆ metrics

LoopMetrics entropic::LoopContext::metrics

Timing and counts.

Definition at line 227 of file engine_types.h.

◆ parent_conversation_id

std::string entropic::LoopContext::parent_conversation_id

Parent conv ID (delegation)

Definition at line 241 of file engine_types.h.

◆ pending_anti_spiral_warning

std::string entropic::LoopContext::pending_anti_spiral_warning

One-shot anti-spiral reminder for the next per-turn system prompt.

Populated by ToolExecutor when consecutive_same_tool_calls reaches LoopConfig .max_consecutive_same_tool; ResponseGenerator emits as a "[engine] anti-spiral: <tool> called N times consecutively; pivot or complete next turn." line; engine clears post-emit. (Demo ask #5, v2.1.0)

Definition at line 263 of file engine_types.h.

◆ pending_delegation

std::optional<PendingDelegation> entropic::LoopContext::pending_delegation

Stored by dir_delegate (v1.8.6)

Definition at line 245 of file engine_types.h.

◆ pending_pipeline

std::optional<PendingPipeline> entropic::LoopContext::pending_pipeline

Stored by dir_pipeline (v1.8.6)

Definition at line 246 of file engine_types.h.

◆ pending_tool_calls

std::vector<ToolCall> entropic::LoopContext::pending_tool_calls

Pending tool calls (v1.8.5)

Definition at line 225 of file engine_types.h.

◆ pending_validation_feedback

std::string entropic::LoopContext::pending_validation_feedback

One-shot reminder text consumed by the next per-turn system prompt assembly.

Engine populates after a rejected validation; ResponseGenerator emits as a "[engine] previous turn rejected: …" line and the engine clears it post-emit. (Demo ask #2, v2.1.0)

Definition at line 254 of file engine_types.h.

◆ recent_tool_calls

std::unordered_map<std::string, std::string> entropic::LoopContext::recent_tool_calls

Duplicate detection cache (v1.8.5)

Definition at line 244 of file engine_types.h.

◆ source

std::string entropic::LoopContext::source = "human"

Message source.

Definition at line 235 of file engine_types.h.

◆ state

AgentState entropic::LoopContext::state = AgentState::IDLE

Current state.

Definition at line 226 of file engine_types.h.

◆ task_id

std::string entropic::LoopContext::task_id

External task ID (MCP integration)

Definition at line 233 of file engine_types.h.


The documentation for this struct was generated from the following file: