跳转至

HTTP API

推荐主线接口

  1. POST /v1/catalogs/import
  2. POST /v1/agentic/run-from-catalog
  3. POST /v1/templates/validate
  4. POST /v1/templates/quality-check
  5. POST /v1/templates/publish
  6. POST /v1/pipeline/simulate
  7. POST /v1/pipeline/evaluate

1. 导入 catalog

POST /v1/catalogs/import

请求:

{
  "mode": "legacy",
  "yaml_path": "/Users/shunyu/Downloads/ClosedLoopOptimization/mechanism_v1.yml"
}

响应重点: 1. catalog_id 2. binding_count 3. field_count 4. bundle

2. 基于 catalog 运行迁移

POST /v1/agentic/run-from-catalog

请求:

{
  "catalog_id": "legacy-scene-catalog",
  "nl_requirements": [
    "在安全边界内最小化能耗",
    "主蒸汽压力不低于30"
  ],
  "max_iterations": 3,
  "publish_on_pass": false
}

响应:AgenticRunReport

3. 草案校验

POST /v1/templates/validate

请求:MigrationDraft

响应重点: 1. valid 2. correctness_score 3. conflict_rate 4. guardrail_coverage 5. issues

4. 评分阈值检查

POST /v1/templates/quality-check

请求:

{
  "draft": {},
  "gate": {
    "structural_min": 0.98,
    "semantic_min": 0.98,
    "solvability_min": 0.95,
    "guardrail_min": 0.95,
    "regression_min": 0.90,
    "overall_min": 0.95
  }
}

响应重点: 1. passed 2. overall_score 3. issues

5. 发布模板

POST /v1/templates/publish

请求:

{
  "draft": {},
  "validate_before_publish": true,
  "enforce_quality_gate": true
}

6. 仿真

POST /v1/pipeline/simulate

请求:

{
  "template_id": "line-a-template",
  "scene_context": {
    "values": {"energy_cost": 120.0},
    "metadata": {}
  }
}

7. 评测

POST /v1/pipeline/evaluate

请求:

{
  "scenario_id": "line-a-regression",
  "template_id": "line-a-template",
  "samples": [
    {
      "context": {
        "values": {"energy_cost": 120.0},
        "metadata": {}
      },
      "expected_approved": true
    }
  ]
}

辅助接口

  1. POST /v1/agentic/parse-points
  2. POST /v1/agentic/generate-draft
  3. POST /v1/agentic/review-draft
  4. GET /v1/catalogs/{catalog_id}
  5. POST /v1/contexts/build
  6. GET /health