Exception: Parse::Agent::RecursionLimitExceeded

Inherits:
AgentError
  • Object
show all
Defined in:
lib/parse/agent/errors.rb

Overview

Raised at construction when an agent built with ‘parent:` would exceed the inherited recursion depth budget. Defends against delegate_to_subagent (or any tool that constructs a Parse::Agent inside its handler) recursing without bound.

The budget is decremented on every inherited construction; the zero-floor agent can still execute its own tools, but constructing another sub-agent with ‘parent: zero_floor_agent` raises this error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, depth: nil) ⇒ RecursionLimitExceeded

Returns a new instance of RecursionLimitExceeded.



116
117
118
119
120
121
# File 'lib/parse/agent/errors.rb', line 116

def initialize(message = nil, depth: nil)
  @depth = depth
  super(message || "Parse::Agent recursion depth exhausted (depth=#{depth.inspect}). " \
                    "A sub-agent attempted to construct another sub-agent past the " \
                    "configured recursion_depth: cap.")
end

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



114
115
116
# File 'lib/parse/agent/errors.rb', line 114

def depth
  @depth
end