runFresh

suspend fun <Input, Output> GraphAIAgent<Input, Output>.runFresh(input: Input): Output

Copies this agent and runs the copy on input.

GraphAIAgent is a single-use object: calling GraphAIAgent.run on an instance that has already been started throws "Agent was already started". Use runFresh wherever the same agent configuration must serve more than one run — evaluation loops, training loops, retries. The copy preserves all configuration (prompts, tools, installed features such as consumption tracking), so metrics and tracing continue to work correctly across runs.