The platform for continuously improving AI agents.
TRANSPORT_UNAVAILABLE = 75
def execution_exit_code(status, *, errors=(), stop_reason=None, transport_failed=False):
if transport_failed:
return TRANSPORT_UNAVAILABLE
if status == "stuck":
return 1
if status == "error":
return 0 if errors and errors[-1] == "MaxIterationsReached" else 1
if status == "finished":
# Only the platform's retained finish can settle the task.
return 0
if status == "paused" and stop_reason in {"amendment", "platform_stop", "wait"}:
return 0
return 1