Spaces:
Sleeping
Sleeping
Upload analytics_pipeline.py
Browse files- agents/analytics_pipeline.py +4 -14
agents/analytics_pipeline.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
|
|
| 1 |
from google.adk.agents import LlmAgent
|
| 2 |
from tools import csv_parser, plot_generator, forecaster
|
| 3 |
|
| 4 |
-
# Define the agents using raw function references as tools
|
| 5 |
trend_detector_agent = LlmAgent(
|
| 6 |
name="trend_detector_agent",
|
| 7 |
model="gemini-2.5-pro-exp-03-25",
|
|
@@ -10,10 +10,7 @@ trend_detector_agent = LlmAgent(
|
|
| 10 |
Analyze the input table. Identify major trends, seasonal patterns,
|
| 11 |
and anomalies (spikes or drops). Return a concise summary.
|
| 12 |
""",
|
| 13 |
-
tools=[
|
| 14 |
-
csv_parser.parse_csv_tool,
|
| 15 |
-
plot_generator.plot_sales_tool
|
| 16 |
-
]
|
| 17 |
)
|
| 18 |
|
| 19 |
forecast_agent = LlmAgent(
|
|
@@ -24,9 +21,7 @@ forecast_agent = LlmAgent(
|
|
| 24 |
Forecast next 3 months of sales based on historical patterns.
|
| 25 |
Use the forecast tool to generate a visual chart.
|
| 26 |
""",
|
| 27 |
-
tools=[
|
| 28 |
-
forecaster.forecast_tool
|
| 29 |
-
]
|
| 30 |
)
|
| 31 |
|
| 32 |
strategy_agent = LlmAgent(
|
|
@@ -39,7 +34,6 @@ strategy_agent = LlmAgent(
|
|
| 39 |
"""
|
| 40 |
)
|
| 41 |
|
| 42 |
-
# Parent coordinator that orchestrates all sub-agents
|
| 43 |
analytics_coordinator = LlmAgent(
|
| 44 |
name="analytics_coordinator",
|
| 45 |
model="gemini-2.5-pro-exp-03-25",
|
|
@@ -51,9 +45,5 @@ analytics_coordinator = LlmAgent(
|
|
| 51 |
3. Recommend business strategies using strategy_agent
|
| 52 |
Return a full dashboard-style summary.
|
| 53 |
""",
|
| 54 |
-
sub_agents=[
|
| 55 |
-
trend_detector_agent,
|
| 56 |
-
forecast_agent,
|
| 57 |
-
strategy_agent
|
| 58 |
-
]
|
| 59 |
)
|
|
|
|
| 1 |
+
|
| 2 |
from google.adk.agents import LlmAgent
|
| 3 |
from tools import csv_parser, plot_generator, forecaster
|
| 4 |
|
|
|
|
| 5 |
trend_detector_agent = LlmAgent(
|
| 6 |
name="trend_detector_agent",
|
| 7 |
model="gemini-2.5-pro-exp-03-25",
|
|
|
|
| 10 |
Analyze the input table. Identify major trends, seasonal patterns,
|
| 11 |
and anomalies (spikes or drops). Return a concise summary.
|
| 12 |
""",
|
| 13 |
+
tools=[csv_parser.parse_csv_tool, plot_generator.plot_sales_tool]
|
|
|
|
|
|
|
|
|
|
| 14 |
)
|
| 15 |
|
| 16 |
forecast_agent = LlmAgent(
|
|
|
|
| 21 |
Forecast next 3 months of sales based on historical patterns.
|
| 22 |
Use the forecast tool to generate a visual chart.
|
| 23 |
""",
|
| 24 |
+
tools=[forecaster.forecast_tool]
|
|
|
|
|
|
|
| 25 |
)
|
| 26 |
|
| 27 |
strategy_agent = LlmAgent(
|
|
|
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
|
|
|
|
| 37 |
analytics_coordinator = LlmAgent(
|
| 38 |
name="analytics_coordinator",
|
| 39 |
model="gemini-2.5-pro-exp-03-25",
|
|
|
|
| 45 |
3. Recommend business strategies using strategy_agent
|
| 46 |
Return a full dashboard-style summary.
|
| 47 |
""",
|
| 48 |
+
sub_agents=[trend_detector_agent, forecast_agent, strategy_agent]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
)
|