|
@@ -115,6 +115,16 @@ async def run_agent_task(runner: AgentRunner, prompt_name: str, kwargs: dict, ta
|
|
|
err_msg = f"{type(e).__name__}: {e}"
|
|
err_msg = f"{type(e).__name__}: {e}"
|
|
|
print(f"❌ [Exception Recovery] {task_name} crashed: {err_msg}")
|
|
print(f"❌ [Exception Recovery] {task_name} crashed: {err_msg}")
|
|
|
task_errors.append(f"{task_name} recovery crashed: {err_msg}")
|
|
task_errors.append(f"{task_name} recovery crashed: {err_msg}")
|
|
|
|
|
+
|
|
|
|
|
+ if out_file and Path(out_file).exists() and str(out_file).endswith(".json"):
|
|
|
|
|
+ try:
|
|
|
|
|
+ with open(out_file, "r", encoding="utf-8") as f:
|
|
|
|
|
+ json.loads(f.read())
|
|
|
|
|
+ print(f" ✅ [JSON Validated] {Path(out_file).name}")
|
|
|
|
|
+ except json.JSONDecodeError as e:
|
|
|
|
|
+ err_msg = f"Invalid JSON syntax in {Path(out_file).name}: {e}"
|
|
|
|
|
+ print(f"❌ [Validation Error] {task_name}: {err_msg}")
|
|
|
|
|
+ task_errors.append(f"{task_name} JSON Error: {e}")
|
|
|
|
|
|
|
|
return task_cost, task_errors
|
|
return task_cost, task_errors
|
|
|
|
|
|
|
@@ -266,6 +276,16 @@ async def run_anthropic_sdk_task(prompt_name: str, kwargs: dict, task_name: str,
|
|
|
print(f"❌ [Fail SDK Recovery] {task_name}: {e}")
|
|
print(f"❌ [Fail SDK Recovery] {task_name}: {e}")
|
|
|
task_errors.append(str(e))
|
|
task_errors.append(str(e))
|
|
|
|
|
|
|
|
|
|
+ if out_file and Path(out_file).exists() and str(out_file).endswith(".json"):
|
|
|
|
|
+ try:
|
|
|
|
|
+ with open(out_file, "r", encoding="utf-8") as f:
|
|
|
|
|
+ json.loads(f.read())
|
|
|
|
|
+ print(f" ✅ [JSON Validated] {Path(out_file).name}")
|
|
|
|
|
+ except json.JSONDecodeError as e:
|
|
|
|
|
+ err_msg = f"Invalid JSON syntax in {Path(out_file).name}: {e}"
|
|
|
|
|
+ print(f"❌ [Validation Error] {task_name}: {err_msg}")
|
|
|
|
|
+ task_errors.append(f"{task_name} JSON Error: {e}")
|
|
|
|
|
+
|
|
|
return task_cost, task_errors
|
|
return task_cost, task_errors
|
|
|
|
|
|
|
|
async def main():
|
|
async def main():
|