MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / api_generate

Function api_generate

demo/ai_scientists/web/app.py:591–609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

589
590@app.route("/api/generate", methods=["POST"])
591def 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>")

Callers

nothing calls this directly

Calls 4

_create_run_yamlFunction · 0.85
RunStateClass · 0.85
getMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected