Team Workflow aggiornato #37

Merged
Berack96 merged 16 commits from 19-team-instructions into main 2025-10-20 22:05:58 +02:00
Berack96 commented 2025-10-19 19:04:55 +02:00 (Migrated from github.com)

This pull request refactors the agent pipeline input and output structure by consolidating and simplifying class definitions.

This pull request refactors the agent pipeline input and output structure by consolidating and simplifying class definitions.
Simo93-rgb (Migrated from github.com) approved these changes 2025-10-20 18:04:14 +02:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-20 18:05:29 +02:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR refactors the agent pipeline to introduce a multi-step workflow with query validation, team-based information recovery, and report generation. The changes replace the previous "predictor" approach with a more structured "query analyzer" and "report generator" pattern.

Key Changes:

  • Introduced query validation and report generation steps into the pipeline workflow
  • Refactored agent prompts to provide clearer instructions with fallback strategies and error handling
  • Consolidated pipeline input/output structures by moving core classes to a dedicated module

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/agents/test_team.py Added test suite for team agent workflow execution
tests/agents/test_report.py Added test suite for report generation agent
tests/agents/test_query_check.py Added test suite for query validation logic
src/app/configs.py Replaced predictor_model with query_analyzer_model and report_generation_model
src/app/api/wrapper_handler.py Changed logging level from info to debug for wrapper operations
src/app/agents/prompts/team_social.txt Updated social agent instructions with fallback tool strategy and error handling
src/app/agents/prompts/team_news.txt Updated news agent instructions with fallback tool strategy and error handling
src/app/agents/prompts/team_market.txt Updated market agent instructions with fallback tool strategy and error handling
src/app/agents/prompts/team_leader.txt Completely restructured team leader instructions with workflow rules and report structure
src/app/agents/prompts/report_generation.txt Added new report generation instructions for markdown formatting
src/app/agents/prompts/query_check.txt Added new query validation instructions
src/app/agents/prompts/predictor.txt Removed predictor agent instructions (replaced by new workflow)
src/app/agents/prompts/init.py Updated exports to reflect new agent structure
src/app/agents/predictor.py Removed predictor module (replaced by query analyzer and report generator)
src/app/agents/pipeline.py Refactored pipeline to use multi-step workflow with query check and report generation
src/app/agents/core.py Created new module consolidating pipeline inputs/outputs and agent factory methods
src/app/agents/init.py Updated exports to reflect new structure
configs.yaml Updated agent configuration with new model assignments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This PR refactors the agent pipeline to introduce a multi-step workflow with query validation, team-based information recovery, and report generation. The changes replace the previous "predictor" approach with a more structured "query analyzer" and "report generator" pattern. **Key Changes:** - Introduced query validation and report generation steps into the pipeline workflow - Refactored agent prompts to provide clearer instructions with fallback strategies and error handling - Consolidated pipeline input/output structures by moving core classes to a dedicated module ### Reviewed Changes Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | tests/agents/test_team.py | Added test suite for team agent workflow execution | | tests/agents/test_report.py | Added test suite for report generation agent | | tests/agents/test_query_check.py | Added test suite for query validation logic | | src/app/configs.py | Replaced `predictor_model` with `query_analyzer_model` and `report_generation_model` | | src/app/api/wrapper_handler.py | Changed logging level from info to debug for wrapper operations | | src/app/agents/prompts/team_social.txt | Updated social agent instructions with fallback tool strategy and error handling | | src/app/agents/prompts/team_news.txt | Updated news agent instructions with fallback tool strategy and error handling | | src/app/agents/prompts/team_market.txt | Updated market agent instructions with fallback tool strategy and error handling | | src/app/agents/prompts/team_leader.txt | Completely restructured team leader instructions with workflow rules and report structure | | src/app/agents/prompts/report_generation.txt | Added new report generation instructions for markdown formatting | | src/app/agents/prompts/query_check.txt | Added new query validation instructions | | src/app/agents/prompts/predictor.txt | Removed predictor agent instructions (replaced by new workflow) | | src/app/agents/prompts/__init__.py | Updated exports to reflect new agent structure | | src/app/agents/predictor.py | Removed predictor module (replaced by query analyzer and report generator) | | src/app/agents/pipeline.py | Refactored pipeline to use multi-step workflow with query check and report generation | | src/app/agents/core.py | Created new module consolidating pipeline inputs/outputs and agent factory methods | | src/app/agents/__init__.py | Updated exports to reflect new structure | | configs.yaml | Updated agent configuration with new model assignments | </details> --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/Berack96/upo-appAI/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
@@ -41,5 +41,6 @@ api:
agents:
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:29 +02:00

The predictor_model configuration field appears to be unused after the refactoring that replaced it with query_analyzer_model and report_generation_model. This configuration should be removed to avoid confusion.


The `predictor_model` configuration field appears to be unused after the refactoring that replaced it with `query_analyzer_model` and `report_generation_model`. This configuration should be removed to avoid confusion. ```suggestion ```
@@ -1,4 +1,4 @@
from app.agents.predictor import PredictorInput, PredictorOutput
from app.agents.pipeline import Pipeline, PipelineInputs, PipelineEvent
from app.agents.pipeline import Pipeline, PipelineEvent
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:29 +02:00

PipelineInputs is imported twice from different modules, which will cause the second import to shadow the first. Remove the duplicate import from line 1.

from app.agents.pipeline import Pipeline, PipelineEvent
`PipelineInputs` is imported twice from different modules, which will cause the second import to shadow the first. Remove the duplicate import from line 1. ```suggestion from app.agents.pipeline import Pipeline, PipelineEvent ```
@@ -0,0 +46,4 @@
Sceglie il modello LLM da usare per il Team Leader.
"""
assert index >= 0 and index < len(self.configs.models.all_models), "Index out of range for models list."
self.team_leader_model = self.configs.models.all_models[index]
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:28 +02:00

Variable assignment uses team_leader_model instead of leader_model as mentioned in the method's docstring. The docstring should be updated or the variable name should be consistent.

Variable assignment uses `team_leader_model` instead of `leader_model` as mentioned in the method's docstring. The docstring should be updated or the variable name should be consistent.
@@ -5,3 +1,1 @@
2. `get_top_headlines(limit: int)`: Get the 'limit' top global news headlines.
3. `get_latest_news_aggregated(query: str, limit: int)`: Get aggregated latest news articles for a specific 'query'.
4. `get_top_headlines_aggregated(limit: int)`: Get aggregated top global news headlines.
**TASK:** You are a specialized **Crypto News Analyst**. Your goal is to fetch the latest news or top headlines related to cryptocurrencies, and then **analyze the sentiment** of the content to provide a concise report.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:28 +02:00

Corrected spelling of 'Etherium' to 'Ethereum'.

- **Querying:** You can search for more general news, but prioritize querying with a relevant crypto (e.g., 'Bitcoin', 'Ethereum').
Corrected spelling of 'Etherium' to 'Ethereum'. ```suggestion - **Querying:** You can search for more general news, but prioritize querying with a relevant crypto (e.g., 'Bitcoin', 'Ethereum'). ```
@@ -0,0 +1,48 @@
import pytest
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:28 +02:00

Corrected spelling of 'Etherium' to 'Ethereum'.

        response = self.agent.run("Ha senso investire in Ethereum?")  #type: ignore
Corrected spelling of 'Etherium' to 'Ethereum'. ```suggestion response = self.agent.run("Ha senso investire in Ethereum?") #type: ignore ```
@@ -0,0 +1,37 @@
import asyncio
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 18:05:27 +02:00

Unconditional assertion failure will cause this test to always fail. This appears to be a debugging leftover that should be removed.


Unconditional assertion failure will cause this test to always fail. This appears to be a debugging leftover that should be removed. ```suggestion ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-20 21:52:01 +02:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments. --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/Berack96/upo-appAI/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
@@ -0,0 +46,4 @@
Sceglie il modello LLM da usare per il Team Leader.
"""
assert index >= 0 and index < len(self.configs.models.all_models), "Index out of range for models list."
self.team_leader_model = self.configs.models.all_models[index]
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:58 +02:00

The choose_team_leader method assigns to self.team_leader_model but the initialization in __init__ uses a different assignment pattern via get_model_by_name(). This inconsistency means the model assignment won't have the same validation and could break if index is out of bounds. Use self.team_leader_model = self.configs.models.all_models[index] with proper validation or use the same pattern as __init__.

        model_list = self.configs.models.all_models
        if 0 <= index < len(model_list):
            model_name = model_list[index].name
            self.team_leader_model = self.configs.get_model_by_name(model_name)
        else:
            raise IndexError(f"Model index {index} out of range for team leader selection.")
The `choose_team_leader` method assigns to `self.team_leader_model` but the initialization in `__init__` uses a different assignment pattern via `get_model_by_name()`. This inconsistency means the model assignment won't have the same validation and could break if `index` is out of bounds. Use `self.team_leader_model = self.configs.models.all_models[index]` with proper validation or use the same pattern as `__init__`. ```suggestion model_list = self.configs.models.all_models if 0 <= index < len(model_list): model_name = model_list[index].name self.team_leader_model = self.configs.get_model_by_name(model_name) else: raise IndexError(f"Model index {index} out of range for team leader selection.") ```
@@ -0,0 +53,4 @@
Sceglie il modello LLM da usare per il Team.
"""
assert index >= 0 and index < len(self.configs.models.all_models), "Index out of range for models list."
self.team_model = self.configs.models.all_models[index]
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:59 +02:00

The choose_team method has the same issue as choose_team_leader: it directly indexes into all_models without validation, which could raise an IndexError if the index is invalid. Consider adding bounds checking or using a safer retrieval method.

        all_models = self.configs.models.all_models
        if not (0 <= index < len(all_models)):
            raise ValueError(f"Invalid index {index} for team models. Must be between 0 and {len(all_models)-1}.")
        self.team_model = all_models[index]
The `choose_team` method has the same issue as `choose_team_leader`: it directly indexes into `all_models` without validation, which could raise an `IndexError` if the index is invalid. Consider adding bounds checking or using a safer retrieval method. ```suggestion all_models = self.configs.models.all_models if not (0 <= index < len(all_models)): raise ValueError(f"Invalid index {index} for team models. Must be between 0 and {len(all_models)-1}.") self.team_model = all_models[index] ```
@@ -93,12 +46,14 @@ class Pipeline:
"""
def __init__(self, inputs: PipelineInputs):
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:58 +02:00

The Pipeline class is missing a docstring. Add a class-level docstring explaining its purpose, key responsibilities, and basic usage pattern.

The `Pipeline` class is missing a docstring. Add a class-level docstring explaining its purpose, key responsibilities, and basic usage pattern.
@@ -0,0 +1,55 @@
from agno.tools.toolkit import Toolkit
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:59 +02:00

The # type: ignore comment suggests a type-checking issue. If Toolkit.__init__ requires specific typing that conflicts with how it's being called, consider using a more specific type ignore directive like # type: ignore[call-arg] or address the underlying type mismatch.

The `# type: ignore` comment suggests a type-checking issue. If `Toolkit.__init__` requires specific typing that conflicts with how it's being called, consider using a more specific type ignore directive like `# type: ignore[call-arg]` or address the underlying type mismatch.
@@ -0,0 +1,18 @@
GOAL: check if the query is crypto-related
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:52:00 +02:00

Corrected spelling of 'releated' to 'related'.

    - if is not crypto related, then output why is not related in a brief message
Corrected spelling of 'releated' to 'related'. ```suggestion - if is not crypto related, then output why is not related in a brief message ```
@@ -0,0 +1,48 @@
import pytest
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:59 +02:00

The #type: ignore comment is missing a space after #. Use # type: ignore for consistency with Python style conventions.

The `#type: ignore` comment is missing a space after `#`. Use `# type: ignore` for consistency with Python style conventions.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:52:00 +02:00

The #type: ignore comment is missing a space after #. Use # type: ignore for consistency with Python style conventions.

        response = self.agent.run("What is the capital of France?")  # type: ignore
The `#type: ignore` comment is missing a space after `#`. Use `# type: ignore` for consistency with Python style conventions. ```suggestion response = self.agent.run("What is the capital of France?") # type: ignore ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:52:00 +02:00

The #type: ignore comment is missing a space after #. Use # type: ignore for consistency with Python style conventions.

The `#type: ignore` comment is missing a space after `#`. Use `# type: ignore` for consistency with Python style conventions.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:52:00 +02:00

The #type: ignore comment is missing a space after #. Use # type: ignore for consistency with Python style conventions.

        response = self.agent.run("Ha senso investire in Ethereum?")  # type: ignore
The `#type: ignore` comment is missing a space after `#`. Use `# type: ignore` for consistency with Python style conventions. ```suggestion response = self.agent.run("Ha senso investire in Ethereum?") # type: ignore ```
@@ -0,0 +1,31 @@
import pytest
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-20 21:51:59 +02:00

The #type: ignore comment is missing a space after #. Use # type: ignore for consistency with Python style conventions.

        response = self.agent.run(sample_data)  # type: ignore
The `#type: ignore` comment is missing a space after `#`. Use `# type: ignore` for consistency with Python style conventions. ```suggestion response = self.agent.run(sample_data) # type: ignore ```
Sign in to join this conversation.