tools.extend_tool_loop module

Extend the tool-calling loop at runtime.

Allows the bot to grant itself additional tool-calling rounds when it determines that the current limit is insufficient to complete a complex multi-step task.

async tools.extend_tool_loop.run(rounds=5, ctx=None)[source]

Grant additional tool-calling rounds.

Parameters:
  • rounds (int) – Number of extra rounds to add (capped per call and by absolute max).

  • ctx (ToolContext) – Injected context with access to the OpenRouter client.

Return type:

str