Run Until Async • AI Agent SDK
run_until_async: Async version of run_until().
run_until_async
Async
Method
</div>
Async version of run_until().
Run agent iteratively until output meets quality criteria.
Signature
async def run_until_async(prompt: str, criteria: str, threshold: float, max_iterations: int, mode: str, on_iteration: Optional[Callable[[Any], None]], verbose: bool) -> 'EvaluationLoopResult'Parameters
ParamField
strThe prompt to send to the agent
ParamField
strEvaluation criteria for the Judge
ParamField
floatScore threshold for success (default: 8.0)
ParamField
intMaximum iterations before stopping (default: 5)
ParamField
str“optimize” (stop on success) or “review” (run all iterations)
ParamField
OptionalOptional callback called after each iteration
ParamField
boolEnable verbose logging
Returns
ResponseField
'EvaluationLoopResult'EvaluationLoopResult with iteration history and final score
Uses
EvaluationLooploop.run_async
Source
View on GitHubpraisonaiagents/agent/agent.py at line 5777