()
| 132 | |
| 133 | |
| 134 | def main(): |
| 135 | from harness.paths import ensure_runtime_dirs, init_run_env, peek_task_name |
| 136 | |
| 137 | load_dotenv(find_dotenv(), override=True) |
| 138 | ensure_runtime_dirs() |
| 139 | args = parse_args() |
| 140 | |
| 141 | # Decide the run id BEFORE YAML parse so workflows can reference |
| 142 | # ${AGENTSPEX_RUN_SANDBOX_DIR_ABS} at load time. |
| 143 | workflow_path = args.workflow_file or "" |
| 144 | task_name = peek_task_name(workflow_path) or ( |
| 145 | Path(workflow_path).stem if workflow_path else "task" |
| 146 | ) |
| 147 | init_run_env(task_name, resume=bool(getattr(args, "resume", False))) |
| 148 | |
| 149 | if args.mode == "loop": |
| 150 | from harness.agentic_loop.run_loop import main as loop_main |
| 151 | |
| 152 | return loop_main() |
| 153 | |
| 154 | yaml_config = load_yaml_config(workflow_path) |
| 155 | |
| 156 | apply_yaml_config_fallback(args, yaml_config) |
| 157 | |
| 158 | agent = AgentSPEX(mcp_url=args.mcp_url) |
| 159 | agent.run(args) |
| 160 | |
| 161 | |
| 162 | if __name__ == "__main__": |
no test coverage detected