{
  "name": "运营分析示例",
  "description": "演示 module_method 整理输入、Agent 生成结构化分析报告并由 end 输出的完整流程。",
  "inputSchema": [
    {
      "name": "period",
      "type": {
        "@type": "JsonSchema",
        "schema": {
          "type": "string"
        }
      },
      "description": "分析周期"
    }
  ],
  "outputSchema": {
    "@type": "JsonSchema",
    "schema": {
      "type": "object",
      "properties": {
        "analysis": {
          "type": "object"
        }
      },
      "required": [
        "analysis"
      ],
      "additionalProperties": false
    }
  },
  "nodes": [
    {
      "type": "start",
      "id": "start",
      "name": "开始"
    },
    {
      "type": "module_method",
      "id": "collect_analysis_input",
      "name": "获取并整理分析输入",
      "method": "buildAnalysisInput",
      "params": {
        "period": "{{input.period}}"
      },
      "timeoutSecs": 30,
      "retryPolicy": {
        "maxAttempts": 3,
        "initialDelayMs": 1000,
        "maxDelayMs": 5000,
        "backoffMultiplier": 2
      },
      "module": {
        "resourceLocator": "baijimu/example-operations/MODULE/operations-data"
      }
    },
    {
      "type": "agent",
      "id": "analyze_operations",
      "name": "生成分析、建议和报告",
      "message": "请基于 {{context.collect_analysis_input}} 完成分析，给出建议并生成可供后续节点消费的报告。",
      "result": {
        "type": {
          "@type": "JsonSchema",
          "schema": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string"
              },
              "recommendations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "report": {
                "type": "string"
              }
            },
            "required": [
              "summary",
              "recommendations",
              "report"
            ],
            "additionalProperties": false
          }
        }
      },
      "executionPolicy": {
        "completionTimeoutSecs": 600
      },
      "agent": {
        "resourceLocator": "baijimu/example-operations/AGENT/operations-analyst"
      },
      "retryPolicy": {
        "maxAttempts": 3,
        "initialDelayMs": 1000,
        "maxDelayMs": 5000,
        "backoffMultiplier": 2
      }
    },
    {
      "type": "end",
      "id": "end",
      "name": "结束",
      "output": {
        "analysis": "{{context.analyze_operations}}"
      }
    }
  ],
  "edges": [
    {
      "from": "start",
      "to": "collect_analysis_input"
    },
    {
      "from": "collect_analysis_input",
      "to": "analyze_operations"
    },
    {
      "from": "analyze_operations",
      "to": "end"
    }
  ],
  "tags": [
    "example",
    "agent"
  ],
  "finally": {
    "nodes": [
      {
        "type": "start",
        "id": "cleanup_start"
      },
      {
        "type": "join",
        "id": "cleanup_outcome",
        "joinPolicy": {
          "mode": "all"
        },
        "output": "{{workflow.outcome.status}}"
      },
      {
        "type": "end",
        "id": "cleanup_end"
      }
    ],
    "edges": [
      {
        "from": "cleanup_start",
        "to": "cleanup_outcome"
      },
      {
        "from": "cleanup_outcome",
        "to": "cleanup_end"
      }
    ],
    "timeoutSecs": 300
  }
}
