Spaces:
Sleeping
Sleeping
Update agents/analytics_pipeline.py
Browse files- agents/analytics_pipeline.py +15 -7
agents/analytics_pipeline.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
| 1 |
-
|
| 2 |
from google.adk.agents import LlmAgent
|
| 3 |
-
from tools
|
| 4 |
-
from tools.plot_generator import plot_sales_tool
|
| 5 |
-
from tools.forecaster import forecast_tool
|
| 6 |
|
|
|
|
| 7 |
trend_detector_agent = LlmAgent(
|
| 8 |
name="trend_detector_agent",
|
| 9 |
model="gemini-2.5-pro-exp-03-25",
|
|
@@ -12,7 +10,10 @@ trend_detector_agent = LlmAgent(
|
|
| 12 |
Analyze the input table. Identify major trends, seasonal patterns,
|
| 13 |
and anomalies (spikes or drops). Return a concise summary.
|
| 14 |
""",
|
| 15 |
-
tools=[
|
|
|
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
forecast_agent = LlmAgent(
|
|
@@ -23,7 +24,9 @@ forecast_agent = LlmAgent(
|
|
| 23 |
Forecast next 3 months of sales based on historical patterns.
|
| 24 |
Use the forecast tool to generate a visual chart.
|
| 25 |
""",
|
| 26 |
-
tools=[
|
|
|
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
strategy_agent = LlmAgent(
|
|
@@ -36,6 +39,7 @@ strategy_agent = LlmAgent(
|
|
| 36 |
"""
|
| 37 |
)
|
| 38 |
|
|
|
|
| 39 |
analytics_coordinator = LlmAgent(
|
| 40 |
name="analytics_coordinator",
|
| 41 |
model="gemini-2.5-pro-exp-03-25",
|
|
@@ -47,5 +51,9 @@ analytics_coordinator = LlmAgent(
|
|
| 47 |
3. Recommend business strategies using strategy_agent
|
| 48 |
Return a full dashboard-style summary.
|
| 49 |
""",
|
| 50 |
-
sub_agents=[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
)
|
|
|
|
|
|
|
| 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 |
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 |
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 |
"""
|
| 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 |
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 |
)
|