Skip to main content

run_until

Method
This is a method of the Agent class in the agent module.
Run agent iteratively until output meets quality criteria. This method implements the “Ralph Loop” pattern: run agent → judge output → improve based on feedback → repeat until threshold met. When goal is provided, delegates to the tool-using goal loop (:meth:run_goal) so the acceptance-criteria completion judge gates a real tool-iteration loop (rather than re-generating a whole answer).

Signature

Parameters

str
required
The prompt to send to the agent
str
default:"''"
Evaluation criteria for the Judge (e.g., “Response is thorough”)
float
default:"8.0"
Score threshold for success (default: 8.0, scale 1-10)
int
default:"5"
Maximum iterations before stopping (default: 5)
str
default:"'optimize'"
“optimize” (stop on success) or “review” (run all iterations)
Optional
Optional callback called after each iteration
bool
default:"False"
Enable verbose logging
Optional[str]
Optional goal text — enables the tool-using goal loop
Optional
Optional structured GoalCriteria for the goal loop
Optional[str]
Optional independent judge model for the goal loop

Returns

'EvaluationLoopResult'
when goal is provided this delegates to the tool-using goal loop and returns an :class:~praisonaiagents.agent.autonomy.AutonomyResult instead (success/output/completion_reason), which is a different shape from the default EvaluationLoopResult.

Usage

Uses

  • GoalCriteria
  • run_goal
  • EvaluationLoop
  • loop.run

Source

View on GitHub

praisonaiagents/agent/agent.py at line 4799