Skip to main content

run_fighter_loop

Function run_fighter_loop 

Source
pub async fn run_fighter_loop(
    params: FighterLoopParams,
) -> PunchResult<FighterLoopResult>
Expand description

Run the fighter loop: the core agent execution engine.

This function:

  1. Loads message history from the bout and repairs it
  2. Recalls relevant memories
  3. Builds the system prompt with context
  4. Applies context budget management before each LLM call
  5. Calls the LLM with available tools
  6. If the LLM requests tool use, executes tools and loops
  7. Handles empty responses, MaxTokens continuation, and errors
  8. Enforces loop guards against runaway iterations