Run Until Async • AI Agent SDK

run_until_async: Async version of run_until().

run_until_async

Async

Method

</div>

This is a method of the Agent class in the agent module.

Async version of run_until().

Run agent iteratively until output meets quality criteria.

Signature

python
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 str

The prompt to send to the agent

ParamField str

Evaluation criteria for the Judge

ParamField float

Score threshold for success (default: 8.0)

ParamField int

Maximum iterations before stopping (default: 5)

ParamField str

“optimize” (stop on success) or “review” (run all iterations)

ParamField Optional

Optional callback called after each iteration

ParamField bool

Enable verbose logging

Returns

ResponseField 'EvaluationLoopResult'

EvaluationLoopResult with iteration history and final score

Uses

  • EvaluationLoop
  • loop.run_async

Source

View on GitHub

praisonaiagents/agent/agent.py at line 5777


Related Documentation