# Module LittleGhost::Agent::ToolLoop::ClassMethods

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Agent/ToolLoop/ClassMethods.html

Exposes tool-loop detection declarations on agent classes. These methods
become inheritable DSL entries when the capability is included.

## Instance methods

<a id="method-i-detect_tool_loops"></a>
### `#detect_tool_loops`

```ruby
#detect_tool_loops(warning_at: 3, terminate_at: 5, except: [])
```

Enables repeated tool-call detection.

`warning_at` defaults to 3 identical calls and `terminate_at` defaults to 5.
`except` accepts tool classes, instances, names, or symbols.

Raises ArgumentError unless `warning_at` is at least 2 and `terminate_at` is
greater than `warning_at`.
