MCPcopy Create free account
hub / github.com/bcefghj/competitive-intelligence-multi-agent / analyze

Function analyze

python/src/api/server.py:85–115  ·  view source on GitHub ↗

Run the full pipeline synchronously and return the final state.

(req: AnalyzeRequest)

Source from the content-addressed store, hash-verified

83
84@app.post("/analyze", response_model=AnalyzeResponse)
85async def analyze(req: AnalyzeRequest):
86 """Run the full pipeline synchronously and return the final state."""
87 initial_state: PipelineState = {
88 "competitor": req.competitor,
89 "monitor_urls": req.urls or [],
90 "previous_hashes": {},
91 "changes_detected": [],
92 "research_results": [],
93 "comparison_matrix": {},
94 "battlecard": {},
95 "alerts_sent": [],
96 "quality_score": 0.0,
97 "reflexion_count": 0,
98 "error": None,
99 }
100
101 try:
102 final = await pipeline.ainvoke(initial_state)
103 except Exception as exc:
104 logger.exception("Pipeline failed")
105 raise HTTPException(status_code=500, detail=str(exc))
106
107 return AnalyzeResponse(
108 competitor=final["competitor"],
109 changes_detected=final.get("changes_detected", []),
110 research_results=final.get("research_results", []),
111 comparison_matrix=final.get("comparison_matrix"),
112 battlecard=final.get("battlecard"),
113 alerts_sent=final.get("alerts_sent", []),
114 quality_score=final.get("quality_score", 0.0),
115 )
116
117
118@app.post("/analyze/stream")

Callers

nothing calls this directly

Calls 1

AnalyzeResponseClass · 0.85

Tested by

no test coverage detected