File size: 1,898 Bytes
eeb326f
afda7e7
eeb326f
afda7e7
eeb326f
 
 
 
 
 
 
 
afda7e7
 
 
 
eeb326f
 
 
 
 
 
 
 
 
 
afda7e7
 
 
eeb326f
 
 
 
 
 
 
 
 
 
 
 
afda7e7
eeb326f
 
 
 
 
 
 
 
 
 
 
afda7e7
 
 
 
 
eeb326f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from google.adk.agents import LlmAgent
from tools import csv_parser, plot_generator, forecaster

# Define the agents using raw function references as tools
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).
    """
)

# Parent coordinator that orchestrates all sub-agents
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
    ]
)