()
| 589 | |
| 590 | @app.route("/api/generate", methods=["POST"]) |
| 591 | def api_generate(): |
| 592 | body = request.get_json(force=True) |
| 593 | domain = (body.get("domain") or "").strip() |
| 594 | intent = (body.get("intent") or "").strip() |
| 595 | if not domain or not intent: |
| 596 | return jsonify({"error": "domain and intent are required"}), 400 |
| 597 | |
| 598 | run_id = uuid.uuid4().hex[:12] |
| 599 | yaml_path, task_name = _create_run_yaml(run_id, domain, intent) |
| 600 | |
| 601 | run = RunState( |
| 602 | run_id=run_id, domain=domain, intent=intent, |
| 603 | task_name=task_name, yaml_path=yaml_path, started_at=time.time(), |
| 604 | ) |
| 605 | RUNS[run_id] = run |
| 606 | |
| 607 | t = threading.Thread(target=_run_agent_background, args=(run,), daemon=True) |
| 608 | t.start() |
| 609 | return jsonify({"run_id": run_id, "task_name": task_name}) |
| 610 | |
| 611 | |
| 612 | @app.route("/api/status/<run_id>") |
nothing calls this directly
no test coverage detected