forked from google/adk-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_diagram.py
More file actions
69 lines (57 loc) · 2.39 KB
/
generate_diagram.py
File metadata and controls
69 lines (57 loc) · 2.39 KB
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
61
62
63
64
65
66
67
68
69
# To generate the diagram from this script, ensure you have Python and the 'diagrams' library installed.
# For more information on the 'diagrams' library, visit: https://diagrams.mingrammer.com/
# Then, navigate to the directory containing this file in your terminal and run:
# python time-series-forecasting-diagram.py
# The output image (e.g., time-series-forecasting-diagram.png) will be saved in the same directory.
from diagrams import Diagram, Cluster, Edge
from diagrams.onprem.client import User
from diagrams.gcp.compute import Run as CloudRunService
from diagrams.gcp.analytics import BigQuery
from diagrams.gcp.ml import AIPlatform
from diagrams.gcp.devtools import Code as DevToolCode
with Diagram(
"Time Series Forecasting Architecture",
filename="diagram",
show=False,
direction="LR",
graph_attr={
"splines": "ortho",
"fontsize": "18",
"labelloc": "t",
"nodesep": "1.0",
"ranksep": "1.5",
},
):
cli_user = User("User")
with Cluster("Google Cloud"):
with Cluster("Forecasting App"):
agent_cloud_run_app = CloudRunService("Java ADK Agent")
with Cluster("MCP Toolbox for Databases"):
mcp_toolbox_cloud_run_service = CloudRunService("MCP Toolbox\nServer")
forecasting_tools_on_mcp = DevToolCode("MCP Forecasting\nTools")
(
mcp_toolbox_cloud_run_service
>> Edge(label="Hosts Tools")
>> forecasting_tools_on_mcp
)
with Cluster("Vertex AI"):
llm_gemini = AIPlatform("Gemini LLM")
with Cluster("BigQuery"):
bq_engine = BigQuery("BQ Engine")
bq_dataset = BigQuery("BQ Dataset")
timesfm_model_in_bq = BigQuery("TimesFM Model")
agent_cloud_run_app >> Edge(label="LLM for Reasoning") >> llm_gemini
(
agent_cloud_run_app
>> Edge(label="Invokes Tools")
>> mcp_toolbox_cloud_run_service
)
forecasting_tools_on_mcp >> Edge(label="Executes AI.FORECAST") >> bq_engine
bq_engine >> Edge(label="Reads Data") >> bq_dataset
bq_engine >> Edge(label="Forecasts With") >> timesfm_model_in_bq
cli_user >> Edge(label="Requests Forecast") >> agent_cloud_run_app
(
agent_cloud_run_app
>> Edge(label="Returns Forecast", style="dashed", color="#2E8B57")
>> cli_user
)