BizIntel_AI / agents /analytics_pipeline.py
mgbam's picture
Upload analytics_pipeline.py
38a9357 verified
from google.adk.agents import LlmAgent
from tools import csv_parser, plot_generator, forecaster
trend_detector_agent = LlmAgent(
name="trend_detector_agent",
model="gemini-2.5-pro-exp-03-25",
description="Detects trends and anomalies in business data.",
instruction="""
Analyze the input table. Identify major trends, seasonal patterns,
and anomalies (spikes or drops). Return a concise summary.
""",
tools=[csv_parser.parse_csv_tool, plot_generator.plot_sales_tool]
)
forecast_agent = LlmAgent(
name="forecast_agent",
model="gemini-2.5-pro-exp-03-25",
description="Forecasts future metrics from time series data.",
instruction="""
Forecast next 3 months of sales based on historical patterns.
Use the forecast tool to generate a visual chart.
""",
tools=[forecaster.forecast_tool]
)
strategy_agent = LlmAgent(
name="strategy_agent",
model="gemini-2.5-pro-exp-03-25",
description="Recommends strategic business decisions.",
instruction="""
Based on trends and forecasts, suggest optimization strategies
across marketing, operations, and finance (ROI, CAC, churn).
"""
)
analytics_coordinator = LlmAgent(
name="analytics_coordinator",
model="gemini-2.5-pro-exp-03-25",
description="Coordinates full BI pipeline: trends, forecast, strategy.",
instruction="""
Run the following:
1. Analyze the CSV with trend_detector_agent
2. Forecast future metrics using forecast_agent
3. Recommend business strategies using strategy_agent
Return a full dashboard-style summary.
""",
sub_agents=[trend_detector_agent, forecast_agent, strategy_agent]
)