diff --git a/docs/App_Architecture_Diagrams.md b/docs/App_Architecture_Diagrams.md index 792d05c..6eb4308 100644 --- a/docs/App_Architecture_Diagrams.md +++ b/docs/App_Architecture_Diagrams.md @@ -1,637 +1,160 @@ -# πŸ“Š Architettura e Flussi dell'App upo-appAI +# πŸ“Š Architettura upo-appAI -## πŸ—οΈ Diagramma Architettura Generale +## πŸ—οΈ Architettura Generale ``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ 🌐 INTERFACCE UTENTE β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ’¬ Gradio Web Interface β”‚ β”‚ -β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ -β”‚ β”‚ β”‚ Chat β”‚ β”‚ Model β”‚ β”‚ Strategy (Strategy) β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ History β”‚ β”‚Dropdown β”‚ β”‚ - Conservative β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ - Aggressive β”‚ β”‚ β”‚ -β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ“± Telegram Bot Interface β”‚ β”‚ -β”‚ β”‚ (Mini App con integrazione Gradio) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β–Ό -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ 🎯 CHAT MANAGER β”‚ -β”‚ (Gestione Conversazioni) β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ - Mantiene storico messaggi (history) β”‚ β”‚ -β”‚ β”‚ - Gestisce input Pipeline (PipelineInputs) β”‚ β”‚ -β”‚ β”‚ - Salva/Carica chat (JSON) β”‚ β”‚ -β”‚ β”‚ - Interfaccia Gradio (gradio_build_interface) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β–Ό -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ”„ AGNO WORKFLOW PIPELINE β”‚ -β”‚ (Orchestrazione Asincrona) β”‚ -β”‚ β”‚ -β”‚ Step 1: πŸ” Query Check β†’ Verifica query crypto β”‚ -β”‚ Step 2: πŸ€” Condition Check β†’ Valida se procedere β”‚ -β”‚ Step 3: πŸ“Š Info Recovery β†’ Team di raccolta dati β”‚ -β”‚ Step 4: πŸ“ Report Generation β†’ Genera report finale β”‚ -β”‚ β”‚ -β”‚ Pipeline Events: QUERY_CHECK | QUERY_ANALYZER | β”‚ -β”‚ INFO_RECOVERY | REPORT_GENERATION | β”‚ -β”‚ TOOL_USED | RUN_FINISHED β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β–Ό -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ€– AGNO AGENT ECOSYSTEM β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ‘” TEAM LEADER (Agno Team) β”‚ β”‚ -β”‚ β”‚ - Coordina Market, News, Social Agents β”‚ β”‚ -β”‚ β”‚ - Tools: ReasoningTools, PlanMemoryTool, β”‚ β”‚ -β”‚ β”‚ CryptoSymbolsTools β”‚ β”‚ -β”‚ β”‚ - Model: Configurabile (team_leader_model) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ -β”‚ β–Ό β–Ό β–Ό β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ MARKET β”‚ β”‚ NEWS β”‚ β”‚ SOCIAL β”‚ β”‚ -β”‚ β”‚ AGENT β”‚ β”‚ AGENT β”‚ β”‚ AGENT β”‚ β”‚ -β”‚ β”‚ (Agno) β”‚ β”‚ (Agno) β”‚ β”‚ (Agno) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Tool: β”‚ β”‚ Tool: β”‚ β”‚ Tool: β”‚ β”‚ -β”‚ β”‚ MarketAPIs β”‚ β”‚ NewsAPIs β”‚ β”‚ SocialAPIs β”‚ β”‚ -β”‚ β”‚ Tool β”‚ β”‚ Tool β”‚ β”‚ Tool β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ οΏ½ QUERY CHECK AGENT (Agno Agent) β”‚ β”‚ -β”‚ β”‚ - Valida se la query Γ¨ relativa a crypto β”‚ β”‚ -β”‚ β”‚ - Output Schema: QueryOutputs (is_crypto: bool) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ“‹ REPORT GENERATOR AGENT (Agno Agent) β”‚ β”‚ -β”‚ β”‚ - Genera report finale basato su dati raccolti β”‚ β”‚ -β”‚ β”‚ - Applica strategia (Conservative/Aggressive) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +INTERFACCE UTENTE +β”œβ”€β”€ πŸ’¬ Gradio Web (Chat + Dropdown modelli/strategie) +└── πŸ“± Telegram Bot (Mini App) + β”‚ + β–Ό +CHAT MANAGER +β”œβ”€β”€ Storico messaggi +β”œβ”€β”€ Gestione PipelineInputs +└── Salva/Carica chat + β”‚ + β–Ό +AGNO WORKFLOW PIPELINE (4 Steps) +β”œβ”€β”€ 1. Query Check β†’ Verifica crypto +β”œβ”€β”€ 2. Condition β†’ Valida procedere +β”œβ”€β”€ 3. Info Recovery β†’ Team raccolta dati +└── 4. Report Generation β†’ Report finale + β”‚ + β–Ό +AGNO AGENT ECOSYSTEM +β”œβ”€β”€ πŸ‘” TEAM LEADER (coordina Market, News, Social) +β”‚ Tools: ReasoningTools, PlanMemoryTool, CryptoSymbolsTools +β”œβ”€β”€ πŸ“ˆ MARKET AGENT β†’ MarketAPIsTool +β”œβ”€β”€ πŸ“° NEWS AGENT β†’ NewsAPIsTool +β”œβ”€β”€ 🐦 SOCIAL AGENT β†’ SocialAPIsTool +β”œβ”€β”€ πŸ” QUERY CHECK AGENT β†’ QueryOutputs (is_crypto: bool) +└── πŸ“‹ REPORT GENERATOR AGENT β†’ Strategia applicata ``` -## πŸ”„ Flusso di Esecuzione Dettagliato +## πŸ”„ Flusso Esecuzione -``` -πŸ‘€ USER REQUEST - β”‚ - β”‚ "Analizza Bitcoin con strategia aggressiva" - β–Ό -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ οΏ½ CHAT MANAGER β”‚ -β”‚ β”‚ -β”‚ - Riceve messaggio utente β”‚ -β”‚ - Gestisce history della conversazione β”‚ -β”‚ - Prepara PipelineInputs con: β”‚ -β”‚ * user_query: "Analizza Bitcoin..." β”‚ -β”‚ * strategy: "aggressive" β”‚ -β”‚ * models: team_leader_model, team_model, etc. β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β–Ό -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ”„ AGNO WORKFLOW PIPELINE β”‚ -β”‚ β”‚ -β”‚ Run ID: [3845] Pipeline query: "Analizza Bitcoin..." β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ STEP 1: πŸ” QUERY CHECK (Query Check Agent) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Input: QueryInputs(user_query, strategy) β”‚ β”‚ -β”‚ β”‚ Agent: query_analyzer_model (Agno Agent) β”‚ β”‚ -β”‚ β”‚ Output: QueryOutputs(response, is_crypto: bool) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Result: {"is_crypto": true, "response": "..."} β”‚ β”‚ -β”‚ β”‚ Event: QUERY_CHECK completed β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ - β”‚ - β–Ό -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ STEP 2: πŸ€” CONDITION CHECK β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Valida: previous_step_content.is_crypto β”‚ β”‚ -β”‚ β”‚ If False β†’ StopOutput(stop=True) β”‚ β”‚ -β”‚ β”‚ If True β†’ Continua al prossimo step β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ - β”‚ - β–Ό -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ STEP 3: πŸ“Š INFO RECOVERY (Team) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ πŸ‘” Team Leader coordina: β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“ˆ Market Agent β†’ MarketAPIsTool β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“° News Agent β†’ NewsAPIsTool β”‚ β”‚ -β”‚ β”‚ └── 🐦 Social Agent β†’ SocialAPIsTool β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Tools disponibili al Team Leader: β”‚ β”‚ -β”‚ β”‚ - ReasoningTools (ragionamento) β”‚ β”‚ -β”‚ β”‚ - PlanMemoryTool (memoria del piano) β”‚ β”‚ -β”‚ β”‚ - CryptoSymbolsTools (simboli crypto) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Events: TOOL_USED per ogni chiamata tool β”‚ β”‚ -β”‚ β”‚ Event: INFO_RECOVERY completed β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ - β”‚ - β–Ό -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ STEP 4: πŸ“ REPORT GENERATION (Report Generator Agent) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Input: Tutti i dati raccolti da Info Recovery β”‚ β”‚ -β”‚ β”‚ Agent: report_generation_model (Agno Agent) β”‚ β”‚ -β”‚ β”‚ Strategia: Applicata dal prompt (aggressive) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Output: Report finale con raccomandazioni β”‚ β”‚ -β”‚ β”‚ Event: REPORT_GENERATION completed β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ - β”‚ - β–Ό -β”‚ Event: RUN_FINISHED β”‚ -β”‚ Return: Final report string (rimozione tag ) β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β–Ό -πŸ“‹ FINAL OUTPUT TO USER -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ“Š Analisi Bitcoin (BTC) β”‚ -β”‚ β”‚ -β”‚ οΏ½ Dati di Mercato: β”‚ -β”‚ - Prezzo: $63,516 (aggregato da 4 fonti) β”‚ -β”‚ - Volume 24h: $2.1M β”‚ -β”‚ - Confidence: 94% β”‚ -β”‚ β”‚ -β”‚ πŸ“° Sentiment News: Positivo (istituzionale in crescita) β”‚ -β”‚ 🐦 Sentiment Social: Bullish (Reddit/Twitter +15%) β”‚ -β”‚ β”‚ -β”‚ 🎯 Raccomandazione (Strategia Aggressiva): β”‚ -β”‚ STRONG BUY - Allocazione 15-20% del portfolio β”‚ -β”‚ β”‚ -β”‚ πŸ’­ Ragionamento: [dettagli dell'analisi...] β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +**Input:** "Analizza Bitcoin con strategia aggressiva" + +1. CHAT MANAGER riceve e prepara PipelineInputs +2. WORKFLOW PIPELINE esegue 4 step: + - Query Check: valida `is_crypto: true` + - Condition: se false, termina + - Info Recovery: Team raccoglie dati + - Report Generation: genera report +3. OUTPUT: Report con analisi + raccomandazioni + +## πŸ›οΈ Architettura API + +**Tools (Agno Toolkit):** +- MarketAPIsTool: Binance, YFinance, CoinBase, CryptoCompare +- NewsAPIsTool: NewsAPI, GoogleNews, DuckDuckGo, CryptoPanic +- SocialAPIsTool: Reddit, X, 4chan +- CryptoSymbolsTools: `resources/cryptos.csv` + +**WrapperHandler:** Failover automatico (3 tentativi/wrapper, 2s delay) + +## πŸ“Š Data Aggregation + +**ProductInfo:** +- Volume: media tra sources +- Price: weighted average (price Γ— volume) +- Confidence: spread + numero sources + +**Historical Price:** +- Align per timestamp +- Media: high, low, open, close, volume + +## 🎯 Configuration + +**configs.yaml:** +```yaml +port: 8000 +models: [Ollama, OpenAI, Anthropic, Google] +strategies: [Conservative, Aggressive] +agents: {team_model, team_leader_model, ...} +api: {retry_attempts: 3, retry_delay_seconds: 2} ``` -## πŸ›οΈ Architettura API e Tools +**.env (API Keys):** +- Market: CDP_API_KEY, CRYPTOCOMPARE_API_KEY, ... +- News: NEWS_API_KEY, CRYPTOPANIC_API_KEY, ... +- Social: REDDIT_CLIENT_ID, X_API_KEY, ... +- LLM: OPENAI_API_KEY, ANTHROPIC_API_KEY, ... +- Bot: TELEGRAM_BOT_TOKEN + +## πŸ—‚οΈ Struttura Progetto ``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ οΏ½ API TOOLS ARCHITECTURE β”‚ -β”‚ (Agno Toolkit Integration) β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ“Š MarketAPIsTool (Agno Toolkit) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Tools disponibili: β”‚ β”‚ -β”‚ β”‚ - get_product(asset_id) β”‚ β”‚ -β”‚ β”‚ - get_products(asset_ids) β”‚ β”‚ -β”‚ β”‚ - get_historical_prices(asset_id, limit) β”‚ β”‚ -β”‚ β”‚ - get_products_aggregated(asset_ids) β”‚ β”‚ -β”‚ β”‚ - get_historical_prices_aggregated(asset_id, limit) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ πŸ”„ WrapperHandler gestisce: β”‚ β”‚ -β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ -β”‚ β”‚ β”‚ Binance β”‚ β”‚ YFinance β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ Wrapper β”‚ β”‚ Wrapper β”‚ β”‚ β”‚ -β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ -β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ -β”‚ β”‚ β”‚ CoinBase β”‚ β”‚CryptoCompare β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ Wrapper β”‚ β”‚ Wrapper β”‚ β”‚ β”‚ -β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Retry Logic: 3 tentativi per wrapper, 2s delay β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ“° NewsAPIsTool (Agno Toolkit) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ πŸ”„ WrapperHandler gestisce: β”‚ β”‚ -β”‚ β”‚ - NewsAPI Wrapper β”‚ β”‚ -β”‚ β”‚ - GoogleNews Wrapper β”‚ β”‚ -β”‚ β”‚ - DuckDuckGo Wrapper β”‚ β”‚ -β”‚ β”‚ - CryptoPanic Wrapper β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ 🐦 SocialAPIsTool (Agno Toolkit) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ πŸ”„ WrapperHandler gestisce: β”‚ β”‚ -β”‚ β”‚ - Reddit Wrapper β”‚ β”‚ -β”‚ β”‚ - X (Twitter) Wrapper β”‚ β”‚ -β”‚ β”‚ - 4chan Wrapper β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ πŸ”£ CryptoSymbolsTools (Agno Toolkit) β”‚ β”‚ -β”‚ β”‚ - Gestisce simboli e nomi delle criptovalute β”‚ β”‚ -β”‚ β”‚ - Carica da resources/cryptos.csv β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -``` +src/app/ +β”œβ”€β”€ __main__.py +β”œβ”€β”€ configs.py +β”œβ”€β”€ agents/ +β”‚ β”œβ”€β”€ core.py +β”‚ β”œβ”€β”€ pipeline.py +β”‚ β”œβ”€β”€ plan_memory_tool.py +β”‚ └── prompts/ +β”œβ”€β”€ api/ +β”‚ β”œβ”€β”€ wrapper_handler.py +β”‚ β”œβ”€β”€ core/ (markets, news, social) +β”‚ β”œβ”€β”€ markets/ (Binance, CoinBase, CryptoCompare, YFinance) +β”‚ β”œβ”€β”€ news/ (NewsAPI, GoogleNews, DuckDuckGo, CryptoPanic) +β”‚ β”œβ”€β”€ social/ (Reddit, X, 4chan) +β”‚ └── tools/ (Agno Toolkits) +└── interface/ (chat.py, telegram_app.py) -## οΏ½ WrapperHandler Pattern - -``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ οΏ½ WRAPPER HANDLER β”‚ -β”‚ (Resilient API Call Management) β”‚ -β”‚ β”‚ -β”‚ Input: List[WrapperType] β”‚ -β”‚ try_per_wrapper: int = 3 β”‚ -β”‚ retry_delay: int = 2 β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ def try_call(func: Callable) -> OutputType: β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ for wrapper in wrappers: β”‚ β”‚ -β”‚ β”‚ for attempt in range(try_per_wrapper): β”‚ β”‚ -β”‚ β”‚ try: β”‚ β”‚ -β”‚ β”‚ result = func(wrapper) β”‚ β”‚ -β”‚ β”‚ return result # βœ… Success β”‚ β”‚ -β”‚ β”‚ except Exception as e: β”‚ β”‚ -β”‚ β”‚ log_error(e) β”‚ β”‚ -β”‚ β”‚ sleep(retry_delay) β”‚ β”‚ -β”‚ β”‚ continue # οΏ½ Retry β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ # Switch to next wrapper β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ raise Exception("All wrappers failed") # ❌ All fail β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ Esempio Flusso: β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” Fail β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” Fail β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚Binance │────────▢│YFinance │────────▢│CoinBase β”‚ βœ… β”‚ -β”‚ β”‚(3 tries)β”‚ β”‚(3 tries)β”‚ β”‚(Success)β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ Features: β”‚ -β”‚ βœ… Automatic failover tra providers β”‚ -β”‚ βœ… Retry logic configurabile β”‚ -β”‚ βœ… Logging dettagliato degli errori β”‚ -β”‚ βœ… Type-safe con Generics β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -``` - -## οΏ½ Data Aggregation Architecture - -``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ“Š PRODUCT INFO AGGREGATION β”‚ -β”‚ β”‚ -β”‚ Input: dict[provider_name, list[ProductInfo]] β”‚ -β”‚ β”‚ -β”‚ Provider A: BTC β†’ {price: 63500, volume: 1.2M} β”‚ -β”‚ Provider B: BTC β†’ {price: 63450, volume: N/A} β”‚ -β”‚ Provider C: BTC β†’ {price: 63600, volume: 2.1M} β”‚ -β”‚ Provider D: BTC β†’ {price: 63550, volume: 1.8M} β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Aggregation Logic: β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 1. Group by symbol (BTC, ETH, etc.) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 2. Aggregate Volume: β”‚ β”‚ -β”‚ β”‚ avg_volume = sum(volumes) / count(providers) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 3. Aggregate Price (weighted by volume): β”‚ β”‚ -β”‚ β”‚ weighted_price = sum(price * volume) / sum(volume) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 4. Calculate Confidence: β”‚ β”‚ -β”‚ β”‚ - Based on price spread β”‚ β”‚ -β”‚ β”‚ - Number of sources β”‚ β”‚ -β”‚ β”‚ - Volume consistency β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ Output: list[ProductInfo] β”‚ -β”‚ { β”‚ -β”‚ "id": "BTC_AGGREGATED", β”‚ -β”‚ "symbol": "BTC", β”‚ -β”‚ "price": 63516.67, # Weighted average β”‚ -β”‚ "volume_24h": 1.7M, # Average volume β”‚ -β”‚ "currency": "USD", β”‚ -β”‚ "confidence": 0.94 # High confidence (low spread) β”‚ -β”‚ } β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ“ˆ HISTORICAL PRICE AGGREGATION β”‚ -β”‚ β”‚ -β”‚ Input: dict[provider_name, list[Price]] β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Aggregation Logic: β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 1. Align by timestamp (YYYY-MM-DD HH:MM) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 2. For each timestamp, calculate mean of: β”‚ β”‚ -β”‚ β”‚ - high β”‚ β”‚ -β”‚ β”‚ - low β”‚ β”‚ -β”‚ β”‚ - open β”‚ β”‚ -β”‚ β”‚ - close β”‚ β”‚ -β”‚ β”‚ - volume β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ 3. Handle missing data gracefully β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ Output: list[Price] (aggregated by timestamp) β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -``` - -## 🎯 Configuration Architecture - -``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ βš™οΈ APP CONFIG (configs.yaml) β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ port: 7860 # Gradio server port β”‚ β”‚ -β”‚ β”‚ gradio_share: false # Public sharing β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ models: # LLM Models Configuration β”‚ β”‚ -β”‚ β”‚ - label: "Qwen 3 (4B)" β”‚ β”‚ -β”‚ β”‚ provider: "ollama" β”‚ β”‚ -β”‚ β”‚ model_id: "qwen3:4b" β”‚ β”‚ -β”‚ β”‚ - label: "Qwen 3 (1.7B)" β”‚ β”‚ -β”‚ β”‚ provider: "ollama" β”‚ β”‚ -β”‚ β”‚ model_id: "qwen3:1.7b" β”‚ β”‚ -β”‚ β”‚ - label: "GPT-4 Turbo" β”‚ β”‚ -β”‚ β”‚ provider: "openai" β”‚ β”‚ -β”‚ β”‚ model_id: "gpt-4-turbo" β”‚ β”‚ -β”‚ β”‚ api_key_env: "OPENAI_API_KEY" β”‚ β”‚ -β”‚ β”‚ # ... altri modelli (Anthropic, Google, etc.) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ strategies: # Investment Strategies β”‚ β”‚ -β”‚ β”‚ - label: "Conservative" β”‚ β”‚ -β”‚ β”‚ description: "Low risk, stable returns..." β”‚ β”‚ -β”‚ β”‚ - label: "Aggressive" β”‚ β”‚ -β”‚ β”‚ description: "High risk, high potential..." β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ agents: # Agent-specific configurations β”‚ β”‚ -β”‚ β”‚ team_model: "qwen3:4b" β”‚ β”‚ -β”‚ β”‚ team_leader_model: "qwen3:4b" β”‚ β”‚ -β”‚ β”‚ query_analyzer_model: "qwen3:1.7b" β”‚ β”‚ -β”‚ β”‚ report_generation_model: "qwen3:4b" β”‚ β”‚ -β”‚ β”‚ strategy: "Conservative" β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ api: # API Configuration β”‚ β”‚ -β”‚ β”‚ retry_attempts: 3 β”‚ β”‚ -β”‚ β”‚ retry_delay_seconds: 2 β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ” ENVIRONMENT VARIABLES (.env) β”‚ -β”‚ β”‚ -β”‚ # Market APIs β”‚ -β”‚ CDP_API_KEY_NAME=... # Coinbase β”‚ -β”‚ CDP_API_PRIVATE_KEY=... # Coinbase β”‚ -β”‚ CRYPTOCOMPARE_API_KEY=... # CryptoCompare β”‚ -β”‚ BINANCE_API_KEY=... # Binance (future) β”‚ -β”‚ β”‚ -β”‚ # News APIs β”‚ -β”‚ NEWS_API_KEY=... # NewsAPI β”‚ -β”‚ CRYPTOPANIC_API_KEY=... # CryptoPanic β”‚ -β”‚ β”‚ -β”‚ # Social APIs β”‚ -β”‚ REDDIT_CLIENT_ID=... # Reddit β”‚ -β”‚ REDDIT_CLIENT_SECRET=... # Reddit β”‚ -β”‚ X_BEARER_TOKEN=... # Twitter/X β”‚ -β”‚ β”‚ -β”‚ # LLM Providers β”‚ -β”‚ OPENAI_API_KEY=... # OpenAI β”‚ -β”‚ ANTHROPIC_API_KEY=... # Anthropic β”‚ -β”‚ GOOGLE_API_KEY=... # Google β”‚ -β”‚ β”‚ -β”‚ # Telegram Bot β”‚ -β”‚ TELEGRAM_BOT_TOKEN=... # Telegram Bot β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -``` - -## πŸ—‚οΈ Struttura del Progetto - -``` -upo-appAI/ -β”‚ -β”œβ”€β”€ πŸ“ src/app/ # Codice principale -β”‚ β”œβ”€β”€ __main__.py # Entry point (Gradio + Telegram) -β”‚ β”œβ”€β”€ configs.py # Gestione configurazioni -β”‚ β”‚ -β”‚ β”œβ”€β”€ πŸ“ agents/ # Sistema di agenti Agno -β”‚ β”‚ β”œβ”€β”€ core.py # PipelineInputs, QueryInputs/Outputs -β”‚ β”‚ β”œβ”€β”€ pipeline.py # Workflow Pipeline con Agno -β”‚ β”‚ β”œβ”€β”€ plan_memory_tool.py # Tool per memoria del piano -β”‚ β”‚ └── πŸ“ prompts/ # Prompt per gli agenti -β”‚ β”‚ β”œβ”€β”€ query_check.txt # Prompt Query Checker -β”‚ β”‚ β”œβ”€β”€ team_leader.txt # Prompt Team Leader -β”‚ β”‚ β”œβ”€β”€ team_market.txt # Prompt Market Agent -β”‚ β”‚ β”œβ”€β”€ team_news.txt # Prompt News Agent -β”‚ β”‚ β”œβ”€β”€ team_social.txt # Prompt Social Agent -β”‚ β”‚ └── report_generation.txt # Prompt Report Generator -β”‚ β”‚ -β”‚ β”œβ”€β”€ πŸ“ api/ # Layer API e Wrappers -β”‚ β”‚ β”œβ”€β”€ wrapper_handler.py # Pattern WrapperHandler generico -β”‚ β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“ core/ # Interfacce base e modelli -β”‚ β”‚ β”‚ β”œβ”€β”€ markets.py # MarketWrapper, ProductInfo, Price -β”‚ β”‚ β”‚ β”œβ”€β”€ news.py # NewsWrapper, NewsItem -β”‚ β”‚ β”‚ └── social.py # SocialWrapper, SocialPost -β”‚ β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“ markets/ # Implementazioni Market API -β”‚ β”‚ β”‚ β”œβ”€β”€ binance.py # BinanceWrapper -β”‚ β”‚ β”‚ β”œβ”€β”€ coinbase.py # CoinBaseWrapper -β”‚ β”‚ β”‚ β”œβ”€β”€ cryptocompare.py # CryptoCompareWrapper -β”‚ β”‚ β”‚ └── yfinance.py # YFinanceWrapper -β”‚ β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“ news/ # Implementazioni News API -β”‚ β”‚ β”‚ β”œβ”€β”€ newsapi.py # NewsAPIWrapper -β”‚ β”‚ β”‚ β”œβ”€β”€ googlenews.py # GoogleNewsWrapper -β”‚ β”‚ β”‚ β”œβ”€β”€ duckduckgo.py # DuckDuckGoWrapper -β”‚ β”‚ β”‚ └── cryptopanic_api.py # CryptoPanicWrapper -β”‚ β”‚ β”‚ -β”‚ β”‚ β”œβ”€β”€ πŸ“ social/ # Implementazioni Social API -β”‚ β”‚ β”‚ β”œβ”€β”€ reddit.py # RedditWrapper -β”‚ β”‚ β”‚ β”œβ”€β”€ x.py # XWrapper (Twitter) -β”‚ β”‚ β”‚ └── chan.py # 4ChanWrapper -β”‚ β”‚ β”‚ -β”‚ β”‚ └── πŸ“ tools/ # Agno Toolkits -β”‚ β”‚ β”œβ”€β”€ market_tool.py # MarketAPIsTool (Agno Toolkit) -β”‚ β”‚ β”œβ”€β”€ news_tool.py # NewsAPIsTool (Agno Toolkit) -β”‚ β”‚ β”œβ”€β”€ social_tool.py # SocialAPIsTool (Agno Toolkit) -β”‚ β”‚ └── symbols_tool.py # CryptoSymbolsTools (Agno Toolkit) -β”‚ β”‚ -β”‚ └── πŸ“ interface/ # Interfacce utente -β”‚ β”œβ”€β”€ chat.py # ChatManager (Gradio) -β”‚ └── telegram_app.py # TelegramApp (Bot) -β”‚ -β”œβ”€β”€ πŸ“ tests/ # Test suite completa -β”‚ β”œβ”€β”€ conftest.py # Configurazione pytest -β”‚ β”œβ”€β”€ πŸ“ agents/ # Test agenti -β”‚ β”œβ”€β”€ πŸ“ api/ # Test API wrappers -β”‚ β”œβ”€β”€ πŸ“ tools/ # Test tools -β”‚ └── πŸ“ utils/ # Test utilities -β”‚ -β”œβ”€β”€ πŸ“ demos/ # Script di esempio -β”‚ β”œβ”€β”€ agno_agent.py # Demo Agno Agent -β”‚ β”œβ”€β”€ agno_workflow.py # Demo Agno Workflow -β”‚ β”œβ”€β”€ coinbase_demo.py # Demo Coinbase API -β”‚ β”œβ”€β”€ cryptocompare_demo.py # Demo CryptoCompare API -β”‚ └── market_providers_api_demo.py # Demo aggregazione provider -β”‚ -β”œβ”€β”€ πŸ“ resources/ # Risorse statiche -β”‚ └── cryptos.csv # Database simboli crypto -β”‚ -β”œβ”€β”€ πŸ“ docs/ # Documentazione -β”‚ β”œβ”€β”€ App_Architecture_Diagrams.md # Questo file -β”‚ └── Progetto Esame.md # Specifiche progetto -β”‚ -β”œβ”€β”€ configs.yaml # Configurazione app (modelli, strategie) -β”œβ”€β”€ .env # Variabili d'ambiente (API keys) -β”œβ”€β”€ .env.example # Template per .env -β”œβ”€β”€ pyproject.toml # Dipendenze Python (uv/pip) -β”œβ”€β”€ Dockerfile # Container Docker -β”œβ”€β”€ docker-compose.yaml # Orchestrazione Docker -└── README.md # Documentazione principale +tests/ +demos/ +resources/cryptos.csv +docs/ +configs.yaml +.env ``` ## πŸ”‘ Componenti Chiave -### 1. **Agno Framework Integration** -L'applicazione utilizza il framework **Agno** per gestire: -- **Agent**: Singoli agenti con modelli LLM specifici -- **Team**: Coordinazione di piΓΉ agenti sotto un Team Leader -- **Workflow**: Pipeline asincrone con step condizionali -- **Toolkit**: Integrazione tools con retry logic -- **RunEvent**: Sistema di eventi per monitoraggio +1. **Agno Framework**: Agent, Team, Workflow, Toolkit, RunEvent +2. **WrapperHandler**: Failover, Retry logic, Type safety +3. **Data Aggregation**: Multiple sources, Confidence score +4. **Multi-Interface**: Gradio + Telegram +5. **Configuration**: configs.yaml + .env -### 2. **WrapperHandler Pattern** -Pattern generico per gestire multiple implementazioni API con: -- Failover automatico tra provider -- Retry logic configurabile -- Type safety con Generics -- Logging dettagliato +## πŸš€ Deployment -### 3. **Data Aggregation** -Sistema sofisticato di aggregazione che: -- Combina dati da multiple fonti -- Calcola confidence score -- Gestisce dati mancanti/inconsistenti -- Fornisce weighted averages - -### 4. **Multi-Interface Support** -Due interfacce integrate: -- **Gradio Web UI**: Chat interface con dropdown per modelli/strategie -- **Telegram Bot**: Bot con Mini App integrato - -### 5. **Configuration Management** -Sistema a due livelli: -- **configs.yaml**: Configurazioni applicazione (modelli, strategie, agenti) -- **.env**: Secrets e API keys (caricato con dotenv) - -## πŸš€ Deployment Flow - -``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ 🐳 DOCKER DEPLOYMENT β”‚ -β”‚ β”‚ -β”‚ 1. Load .env variables β”‚ -β”‚ 2. Build Docker image (Python 3.11) β”‚ -β”‚ 3. Install dependencies (pyproject.toml) β”‚ -β”‚ 4. Copy src/, configs.yaml, resources/ β”‚ -β”‚ 5. Expose port 7860 (Gradio) β”‚ -β”‚ 6. Run: python -m src.app β”‚ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ docker-compose up --build -d β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ Services: β”‚ β”‚ -β”‚ β”‚ - app: Main application (Gradio + Telegram) β”‚ β”‚ -β”‚ β”‚ - Networks: Bridge mode β”‚ β”‚ -β”‚ β”‚ - Volumes: .env mounted β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ πŸ’» LOCAL DEVELOPMENT (UV) β”‚ -β”‚ β”‚ -β”‚ 1. Install uv package manager β”‚ -β”‚ 2. uv venv (create virtual environment) β”‚ -β”‚ 3. uv pip install -e . (editable install) β”‚ -β”‚ 4. uv run src/app (run application) β”‚ -β”‚ β”‚ -β”‚ Benefits: β”‚ -β”‚ βœ… Fast dependency resolution β”‚ -β”‚ βœ… Automatic PYTHONPATH setup β”‚ -β”‚ βœ… Editable mode for development β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +**Docker:** +```bash +docker-compose up --build -d ``` -## 🎯 Workflow Execution Model +**Local (UV):** +```bash +uv venv +uv pip install -e . +uv run src/app +``` -L'applicazione utilizza un modello di esecuzione **Asincrono** basato su Agno Workflow: +## 🎯 Workflow Asincrono ```python -# Pipeline di esecuzione -async def interact_async(): - workflow = Workflow(steps=[ - query_check, # Step 1: Verifica query - condition_query_ok, # Step 2: Condizione - info_recovery, # Step 3: Team di raccolta - report_generation # Step 4: Report finale - ]) - - # Esecuzione con streaming - iterator = await workflow.arun( - query, - stream=True, - stream_intermediate_steps=True - ) - - # Event handling - async for event in iterator: - if event.event == PipelineEvent.TOOL_USED: - log(f"Tool: {event.tool.tool_name}") - elif event.event == WorkflowRunEvent.step_completed: - log(f"Step: {event.step_name} completed") +workflow = Workflow(steps=[ + query_check, condition, + info_recovery, report_generation +]) + +iterator = await workflow.arun(query, stream=True) + +async for event in iterator: + if event.event == PipelineEvent.TOOL_USED: + log(f"Tool: {event.tool.tool_name}") ``` -**Vantaggi:** -- ⚑ Esecuzione asincrona per migliori performance -- πŸ“Š Streaming di eventi intermedi -- 🎯 Gestione condizionale del flusso -- πŸ”„ Retry automatico sui tools +**Vantaggi:** Asincrono, Streaming, Condizionale, Retry ## πŸ“ˆ Future Enhancements -Possibili miglioramenti architetturali: - -1. **Parallel Tool Execution**: Esecuzione parallela di Market/News/Social agents -2. **Caching Layer**: Redis/Memcached per ridurre chiamate API -3. **Database Integration**: PostgreSQL per storico analisi -4. **Real-time WebSocket**: Aggiornamenti live prezzi -5. **ML Model Integration**: Modelli predittivi custom (LSTM, Transformer) -6. **Advanced Aggregation**: Confidence scoring migliorato con ML -7. **User Profiles**: Personalizzazione strategie per utente -8. **Backtesting Module**: Validazione strategie su dati storici - ---- -*Documento aggiornato: 2025-10-22* -*Sistema: upo-appAI Crypto Analysis Platform* -*Framework: Agno (Agentic AI) + Gradio + Telegram* \ No newline at end of file +- Parallel Tool Execution +- Caching (Redis) +- Database (PostgreSQL) +- Real-time WebSocket +- ML Models +- User Profiles +- Backtesting