agent-starter-pack 0.0.3b0__py3-none-any.whl → 0.0.5b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agent-starter-pack might be problematic. Click here for more details.
- {agent_starter_pack-0.0.3b0.dist-info → agent_starter_pack-0.0.5b0.dist-info}/METADATA +1 -1
- {agent_starter_pack-0.0.3b0.dist-info → agent_starter_pack-0.0.5b0.dist-info}/RECORD +12 -17
- agents/agentic_rag_vertexai_search/template/.templateconfig.yaml +14 -0
- agents/crewai_coding_crew/template/.templateconfig.yaml +14 -0
- agents/langgraph_base_react/template/.templateconfig.yaml +14 -0
- agents/multimodal_live_api/README.md +18 -2
- agents/multimodal_live_api/template/.templateconfig.yaml +14 -0
- src/cli/commands/create.py +156 -163
- src/cli/utils/gcp.py +7 -8
- src/deployment_targets/agent_engine/tests/load_test/.results/report.html +0 -264
- src/deployment_targets/agent_engine/tests/load_test/.results/results_exceptions.csv +0 -1
- src/deployment_targets/agent_engine/tests/load_test/.results/results_failures.csv +0 -1
- src/deployment_targets/agent_engine/tests/load_test/.results/results_stats.csv +0 -3
- src/deployment_targets/agent_engine/tests/load_test/.results/results_stats_history.csv +0 -22
- {agent_starter_pack-0.0.3b0.dist-info → agent_starter_pack-0.0.5b0.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.0.3b0.dist-info → agent_starter_pack-0.0.5b0.dist-info}/entry_points.txt +0 -0
- {agent_starter_pack-0.0.3b0.dist-info → agent_starter_pack-0.0.5b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@ agents/agentic_rag_vertexai_search/app/agent.py,sha256=ly4OZiOj_jKKSLvo2ZhtQgrxW
|
|
|
3
3
|
agents/agentic_rag_vertexai_search/app/retrievers.py,sha256=h5mIa2wphDLefBxNQLH50_zFfbKnEwpz7p1S2rTqt28,2769
|
|
4
4
|
agents/agentic_rag_vertexai_search/app/templates.py,sha256=h3dtaVScPNMLqEudh63ZURzZh59p4tclKusFP5rWPgA,1632
|
|
5
5
|
agents/agentic_rag_vertexai_search/notebooks/evaluating_langgraph_agent.ipynb,sha256=INlcKJQ_2KB9XAXloG6wKB7cHBKDhW56w1bAQm2IeLA,58048
|
|
6
|
-
agents/agentic_rag_vertexai_search/template/.templateconfig.yaml,sha256=
|
|
6
|
+
agents/agentic_rag_vertexai_search/template/.templateconfig.yaml,sha256=Y1QvZ8Q0kilS_EN6N9YxKW7LOXABq2i2DgeYPwZJHEw,1070
|
|
7
7
|
agents/agentic_rag_vertexai_search/tests/integration/test_agent.py,sha256=8Y4BUvfxPaiEcT8WvdMTl5hVYTWS_W_4aQtYmgrdgx8,1935
|
|
8
8
|
agents/crewai_coding_crew/README.md,sha256=4No7sfHQVHELARGiT3fWANJzDR0NP48ow4ct3FoPwlA,1672
|
|
9
9
|
agents/crewai_coding_crew/app/agent.py,sha256=GcmNrOyRPhnI7LICIV6GvBvcDfA_PKqPsQcOEzAORmY,3269
|
|
@@ -12,19 +12,19 @@ agents/crewai_coding_crew/app/crew/config/agents.yaml,sha256=Cn9zTcP3C-8MvlV19cY
|
|
|
12
12
|
agents/crewai_coding_crew/app/crew/config/tasks.yaml,sha256=SSFuiSQPhi4dM0V5HdNuMqtN7JJr5RUCMhhBzUkPBpc,1511
|
|
13
13
|
agents/crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb,sha256=OxUud-wX9CLhKEldFwU_jYgA8KALkQ8_MwLN8gvOai8,58007
|
|
14
14
|
agents/crewai_coding_crew/notebooks/evaluating_langgraph_agent.ipynb,sha256=INlcKJQ_2KB9XAXloG6wKB7cHBKDhW56w1bAQm2IeLA,58048
|
|
15
|
-
agents/crewai_coding_crew/template/.templateconfig.yaml,sha256=
|
|
15
|
+
agents/crewai_coding_crew/template/.templateconfig.yaml,sha256=cl2idKg9NZKrkIkDhxCVSiDIJaoDjy5yMVmVc93Nlm8,974
|
|
16
16
|
agents/crewai_coding_crew/tests/integration/test_agent.py,sha256=0uvfmM3FSdESIU7ICb2oqABsQqylQU2PE3UBwbpif-A,1629
|
|
17
17
|
agents/langgraph_base_react/README.md,sha256=erfhoSbEqbqn1XM_sSjxXyWleBWIyAMuaN5xMIG6f3M,485
|
|
18
18
|
agents/langgraph_base_react/app/agent.py,sha256=2HsbZaSLpMhJQ21geauKPfavcavPW50lx4WV5dXlvnQ,2514
|
|
19
19
|
agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb,sha256=INlcKJQ_2KB9XAXloG6wKB7cHBKDhW56w1bAQm2IeLA,58048
|
|
20
|
-
agents/langgraph_base_react/template/.templateconfig.yaml,sha256=
|
|
20
|
+
agents/langgraph_base_react/template/.templateconfig.yaml,sha256=NpQRZbXtCOeX0XiYtqyI73V6zH4tWWr1TpcTDsSTcjw,991
|
|
21
21
|
agents/langgraph_base_react/tests/integration/test_agent.py,sha256=wg2Y8V4l7dh7rhWy7Z8zioDW5ILRsz7RZJ-mz0AhK3U,1619
|
|
22
|
-
agents/multimodal_live_api/README.md,sha256=
|
|
22
|
+
agents/multimodal_live_api/README.md,sha256=v_RsHdcmw1ed5jQ65ZgdoDldCsoQuupPTLd9YvG_U8w,3435
|
|
23
23
|
agents/multimodal_live_api/app/agent.py,sha256=WFB7lvDiImvNyWFlds_f5TtzyrbwcquJe6JyJo8HGSs,2690
|
|
24
24
|
agents/multimodal_live_api/app/server.py,sha256=2l7WgNVQAHbnhWUyXBsIt4DI2_kuBoKiEEhcmg1Hom4,6991
|
|
25
25
|
agents/multimodal_live_api/app/templates.py,sha256=HgA4QGIle4Q-Nr6xAAXk1pTX7eNbZqlQUD9_fbCvDWA,3301
|
|
26
26
|
agents/multimodal_live_api/app/vector_store.py,sha256=AYRSNpfevbVTt-nnWna_dp2pn4T7o1nz9-9wOoWaxsA,2045
|
|
27
|
-
agents/multimodal_live_api/template/.templateconfig.yaml,sha256=
|
|
27
|
+
agents/multimodal_live_api/template/.templateconfig.yaml,sha256=gkXZxV15yY6OpJ64VWRhWlCtPhJxyacrv_e2kY3-Wo0,1082
|
|
28
28
|
agents/multimodal_live_api/tests/integration/test_server_e2e.py,sha256=D2VETDIyTD2fQyQ6DXwLr-POSYyVzzzcpIFLt5Ppyx4,8398
|
|
29
29
|
agents/multimodal_live_api/tests/load_test/load_test.py,sha256=HHZyfC4gqiQtZVF_CbbxENGgWQccMLpwMv0IdoQ6cbQ,1275
|
|
30
30
|
agents/multimodal_live_api/tests/unit/test_server.py,sha256=_TjlgQgNkjerIaBGnu8P8_KB8ZlSolDcivALpUOn_Rw,4786
|
|
@@ -57,11 +57,11 @@ src/base_template/deployment/terraform/dev/vars/env.tfvars,sha256=xz5cYG29ZIgqM1
|
|
|
57
57
|
src/base_template/deployment/terraform/vars/env.tfvars,sha256=2dxWRDzeolN2f7eKSHXcBiBt9fRcIMO6VH-2MAZevLQ,1633
|
|
58
58
|
src/base_template/tests/unit/test_utils/test_tracing_exporter.py,sha256=JAb0vIB7wNFPm_kaDaHcxtPKNReypDHjdsMQyzpuePQ,4687
|
|
59
59
|
src/cli/main.py,sha256=134KpcOQlexr_vR-KT3D3B1jKh1Y6S3qHGJ-9uD9Kkg,950
|
|
60
|
-
src/cli/commands/create.py,sha256=
|
|
60
|
+
src/cli/commands/create.py,sha256=oupbVv8zfMho4JowBCvgr0YpS2I7mYWCDR3We8VxqjI,18497
|
|
61
61
|
src/cli/commands/setup_cicd.py,sha256=EgVkDdA94npDHHPTuYDmWNIiRscnsXtN7CbTuelrTVU,28347
|
|
62
62
|
src/cli/utils/__init__.py,sha256=x-k6jfcv68_zYS88LrA1mr0yB5y5SekJ0nc5Tvt6iDA,1064
|
|
63
63
|
src/cli/utils/cicd.py,sha256=x-8PKp4aevkUwAmtbEZVwu0UlrA6ifXGbouxICu1D0o,25664
|
|
64
|
-
src/cli/utils/gcp.py,sha256=
|
|
64
|
+
src/cli/utils/gcp.py,sha256=nZP9wBfzJXuATbX-e8gVY9FyF23b3q-bXFosgkW3eBU,4128
|
|
65
65
|
src/cli/utils/logging.py,sha256=0lHe4EPi1A8sOx9xkA7gS4UNl0GsIyp2ahydkkuCzLY,1570
|
|
66
66
|
src/cli/utils/template.py,sha256=p7uKv5yHkXIOWo8EJJ0IjUh57lOSDL7kYHA9OZ7j-z4,25447
|
|
67
67
|
src/data_ingestion/README.md,sha256=QlomTIZINvZxf2ftCkm2_QVozlivJqAfFKyfiGMZDpY,4217
|
|
@@ -79,11 +79,6 @@ src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py,s
|
|
|
79
79
|
src/deployment_targets/agent_engine/tests/load_test/README.md,sha256=ckP2eu5_HpOjM390KXNwUk4YWAzWqir3YOTceyoeL64,1441
|
|
80
80
|
src/deployment_targets/agent_engine/tests/load_test/load_test.py,sha256=msUkkqsNinCJ8loQHsEeGkQQqQ-Zvv7oAp5ni9vOsWs,3541
|
|
81
81
|
src/deployment_targets/agent_engine/tests/load_test/.results/.placeholder,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
|
-
src/deployment_targets/agent_engine/tests/load_test/.results/report.html,sha256=QVJtVS8wsFhWltwaH1v2JSkdS6q4rdSs_DuaXEfYu9I,1475308
|
|
83
|
-
src/deployment_targets/agent_engine/tests/load_test/.results/results_exceptions.csv,sha256=PnPo9mVzHuTkWmqRICoxsGmZ8sUyQPFK7iUy4OC0Kwk,31
|
|
84
|
-
src/deployment_targets/agent_engine/tests/load_test/.results/results_failures.csv,sha256=7K2uMJ7c4_mPrMYsMQE9JyDAUClzKhuz2PKIY5_8NzY,31
|
|
85
|
-
src/deployment_targets/agent_engine/tests/load_test/.results/results_stats.csv,sha256=IOlGa4JOaOOKjMjICLFvd5k80pUHzY6eYe38dF2-ljY,588
|
|
86
|
-
src/deployment_targets/agent_engine/tests/load_test/.results/results_stats_history.csv,sha256=2WjXHaQb17ieFrcVZo-P94qpjSELzt1tAJdiPa6MBeI,3794
|
|
87
82
|
src/deployment_targets/agent_engine/tests/unit/test_dummy.py,sha256=hL-JCmoQUJ4IgluliEo3KkYd47nmiCy3obiPuz_b0sU,712
|
|
88
83
|
src/deployment_targets/cloud_run/Dockerfile,sha256=JTh6P_RXE3bkdsHS0zIgguDVVf0XyLViMcb-UNT3Da4,835
|
|
89
84
|
src/deployment_targets/cloud_run/uv.lock,sha256=2RYrR89xDS1FHVb-g2JGZq8zZ-rzbm_jRvehVCYuXRQ,887957
|
|
@@ -155,8 +150,8 @@ src/resources/setup_cicd/providers.tf,sha256=Km4z6IJt7x7PLaa0kyZbBrO2m3lpuIJZFD5
|
|
|
155
150
|
src/utils/generate_locks.py,sha256=xu5IAhGGBPkVQGSJX4kk7_JNDwWJUEaXAHbmaQIohbg,4386
|
|
156
151
|
src/utils/lock_utils.py,sha256=plw3vWkRViCMxBK3IrLRHtF_I0kbbP043T9KIYxcb20,2423
|
|
157
152
|
src/utils/watch_and_rebuild.py,sha256=IdbTLReYknTXXu5KWPz3sc7Zg5HTEMS5UVlMSnuhs5E,6067
|
|
158
|
-
agent_starter_pack-0.0.
|
|
159
|
-
agent_starter_pack-0.0.
|
|
160
|
-
agent_starter_pack-0.0.
|
|
161
|
-
agent_starter_pack-0.0.
|
|
162
|
-
agent_starter_pack-0.0.
|
|
153
|
+
agent_starter_pack-0.0.5b0.dist-info/METADATA,sha256=bPlCq8nyiNrEuW_3fNR_i3LGViTs0MWwK9-qp_OL6PY,6805
|
|
154
|
+
agent_starter_pack-0.0.5b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
155
|
+
agent_starter_pack-0.0.5b0.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
|
|
156
|
+
agent_starter_pack-0.0.5b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
157
|
+
agent_starter_pack-0.0.5b0.dist-info/RECORD,,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
description: "A RAG agent using Vertex AI Search and LangGraph for document retrieval and Q&A"
|
|
2
16
|
settings:
|
|
3
17
|
requires_data_ingestion: true
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
description: "A multi-agent system implemented with CrewAI created to support coding activities"
|
|
2
16
|
settings:
|
|
3
17
|
requires_data_ingestion: false
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
description: "A agent implementing a base ReAct agent using LangGraph"
|
|
2
16
|
settings:
|
|
3
17
|
requires_data_ingestion: false
|
|
@@ -28,16 +28,32 @@ This pattern showcases a real-time conversational RAG agent powered by Google Ge
|
|
|
28
28
|
|
|
29
29
|
2. **Start the Backend and Frontend:**
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**Backend:**
|
|
32
32
|
```bash
|
|
33
33
|
make backend
|
|
34
34
|
```
|
|
35
|
+
|
|
36
|
+
The backend will be ready when you see `INFO: Application startup complete.` in the console.
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary><b>Click here if you want to use AI Studio and API Key instead of Vertex AI:</b></summary>
|
|
35
40
|
|
|
36
|
-
In a different shell, start the frontend:
|
|
37
41
|
```bash
|
|
42
|
+
export VERTEXAI=false
|
|
43
|
+
export GOOGLE_API_KEY=your-google-api-key
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
<br>
|
|
48
|
+
|
|
49
|
+
**Frontend:**
|
|
50
|
+
```bash
|
|
51
|
+
# In a different shell
|
|
38
52
|
make ui
|
|
39
53
|
```
|
|
40
54
|
|
|
55
|
+
This is the suggested mode for development as it allows you to see changes in real-time.
|
|
56
|
+
|
|
41
57
|
Once both the backend and frontend are running, click the play button in the frontend UI to establish a connection with the backend. You can now interact with the Multimodal Live Agent! You can try asking questions such as "Using the tool you have, define Governance in the context MLOPs" to allow the agent to use the [documentation](https://cloud.google.com/architecture/deploy-operate-generative-ai-applications) it was provided to.
|
|
42
58
|
|
|
43
59
|
## Additional Resources for Multimodal Live API
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
description: "A real-time multimodal RAG agent powered by Gemini, supporting audio/video/text chat with vector DB-backed responses"
|
|
2
16
|
settings:
|
|
3
17
|
requires_data_ingestion: false
|
src/cli/commands/create.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
import logging
|
|
16
|
+
import os
|
|
16
17
|
import pathlib
|
|
17
18
|
import subprocess
|
|
18
19
|
|
|
@@ -47,8 +48,6 @@ console = Console()
|
|
|
47
48
|
@click.option(
|
|
48
49
|
"--include-data-ingestion", "-i", is_flag=True, help="Include data pipeline"
|
|
49
50
|
)
|
|
50
|
-
@click.option("--gcp-account", help="GCP service account email")
|
|
51
|
-
@click.option("--gcp-project", help="GCP project ID")
|
|
52
51
|
@click.option("--debug", is_flag=True, help="Enable debug logging")
|
|
53
52
|
@click.option(
|
|
54
53
|
"--output-dir",
|
|
@@ -77,8 +76,6 @@ def create(
|
|
|
77
76
|
agent: str | None,
|
|
78
77
|
deployment_target: str | None,
|
|
79
78
|
include_data_ingestion: bool,
|
|
80
|
-
gcp_account: str | None,
|
|
81
|
-
gcp_project: str | None,
|
|
82
79
|
debug: bool,
|
|
83
80
|
output_dir: str | None,
|
|
84
81
|
auto_approve: bool,
|
|
@@ -164,88 +161,23 @@ def create(
|
|
|
164
161
|
logging.debug(f"Selected region: {region}")
|
|
165
162
|
|
|
166
163
|
# GCP Setup
|
|
167
|
-
|
|
168
|
-
if debug:
|
|
169
|
-
logging.debug("Setting up GCP...")
|
|
170
|
-
|
|
171
|
-
# Handle GCP credentials
|
|
172
|
-
if gcp_account and gcp_project:
|
|
173
|
-
try:
|
|
174
|
-
subprocess.run(
|
|
175
|
-
["gcloud", "config", "set", "account", gcp_account], check=True
|
|
176
|
-
)
|
|
177
|
-
subprocess.run(
|
|
178
|
-
["gcloud", "config", "set", "project", gcp_project], check=True
|
|
179
|
-
)
|
|
180
|
-
subprocess.run(
|
|
181
|
-
[
|
|
182
|
-
"gcloud",
|
|
183
|
-
"auth",
|
|
184
|
-
"application-default",
|
|
185
|
-
"set-quota-project",
|
|
186
|
-
gcp_project,
|
|
187
|
-
],
|
|
188
|
-
check=True,
|
|
189
|
-
)
|
|
190
|
-
except subprocess.CalledProcessError as e:
|
|
191
|
-
console.print(f"Error setting GCP credentials: {e!s}", style="bold red")
|
|
192
|
-
raise
|
|
164
|
+
logging.debug("Setting up GCP...")
|
|
193
165
|
|
|
166
|
+
# Check for uv installation if not skipping checks
|
|
194
167
|
if not skip_checks:
|
|
195
|
-
# Verify GCP credentials
|
|
196
|
-
if debug:
|
|
197
|
-
logging.debug("Verifying GCP credentials...")
|
|
198
|
-
creds_info = verify_credentials()
|
|
199
|
-
|
|
200
|
-
if not auto_approve:
|
|
201
|
-
change_creds = (
|
|
202
|
-
Prompt.ask(
|
|
203
|
-
f"\n> You are logged in with account '{creds_info['account']}' "
|
|
204
|
-
f"and using project '{creds_info['project']}'. "
|
|
205
|
-
"Is this correct?",
|
|
206
|
-
choices=["Y", "n"],
|
|
207
|
-
default="Y",
|
|
208
|
-
).lower()
|
|
209
|
-
== "n"
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
if change_creds:
|
|
213
|
-
handle_credential_change()
|
|
214
|
-
else:
|
|
215
|
-
console.print(
|
|
216
|
-
f"\n> Using account '{creds_info['account']}' "
|
|
217
|
-
f"with project '{creds_info['project']}'"
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
# Check for uv installation
|
|
221
|
-
console.print("> Checking for uv installation...")
|
|
222
168
|
check_and_install_uv()
|
|
223
169
|
|
|
224
|
-
#
|
|
225
|
-
console.print("> Testing GCP and Vertex AI Connection...")
|
|
170
|
+
# Set up GCP environment
|
|
226
171
|
try:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
f"> ✓ Successfully verified connection to Vertex AI in project {creds_info['project']}"
|
|
172
|
+
setup_gcp_environment(
|
|
173
|
+
auto_approve=auto_approve,
|
|
174
|
+
skip_checks=skip_checks,
|
|
175
|
+
region=region,
|
|
176
|
+
debug=debug,
|
|
233
177
|
)
|
|
234
178
|
except Exception as e:
|
|
235
|
-
|
|
236
|
-
f"
|
|
237
|
-
f"> Please check your authentication settings and permissions. "
|
|
238
|
-
f"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
|
|
239
|
-
style="bold red"
|
|
240
|
-
)
|
|
241
|
-
else:
|
|
242
|
-
if debug:
|
|
243
|
-
logging.debug("Skipping verification checks due to --skip-checks flag")
|
|
244
|
-
console.print("> Skipping verification checks", style="yellow")
|
|
245
|
-
# Set a default creds_info when skipping checks
|
|
246
|
-
creds_info = (
|
|
247
|
-
{"project": gcp_project} if gcp_project else {"project": "unknown"}
|
|
248
|
-
)
|
|
179
|
+
if debug:
|
|
180
|
+
logging.warning(f"GCP environment setup failed: {e}")
|
|
249
181
|
|
|
250
182
|
# Process template
|
|
251
183
|
template_path = get_template_path(final_agent, debug=debug)
|
|
@@ -332,74 +264,172 @@ def display_agent_selection(deployment_target: str | None = None) -> str:
|
|
|
332
264
|
return agents[choice]["name"]
|
|
333
265
|
|
|
334
266
|
|
|
335
|
-
def
|
|
336
|
-
"""
|
|
267
|
+
def set_gcp_project(project_id: str, set_quota_project: bool = True) -> None:
|
|
268
|
+
"""Set the GCP project and optionally the application default quota project.
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
project_id: The GCP project ID to set.
|
|
272
|
+
set_quota_project: Whether to set the application default quota project.
|
|
273
|
+
"""
|
|
337
274
|
try:
|
|
275
|
+
subprocess.run(
|
|
276
|
+
["gcloud", "config", "set", "project", project_id],
|
|
277
|
+
check=True,
|
|
278
|
+
capture_output=True,
|
|
279
|
+
text=True,
|
|
280
|
+
)
|
|
281
|
+
except subprocess.CalledProcessError as e:
|
|
282
|
+
console.print(f"\n> Error setting project to {project_id}:")
|
|
283
|
+
console.print(e.stderr)
|
|
284
|
+
raise
|
|
285
|
+
|
|
286
|
+
if set_quota_project:
|
|
287
|
+
try:
|
|
288
|
+
subprocess.run(
|
|
289
|
+
[
|
|
290
|
+
"gcloud",
|
|
291
|
+
"auth",
|
|
292
|
+
"application-default",
|
|
293
|
+
"set-quota-project",
|
|
294
|
+
project_id,
|
|
295
|
+
],
|
|
296
|
+
check=True,
|
|
297
|
+
capture_output=True,
|
|
298
|
+
text=True,
|
|
299
|
+
)
|
|
300
|
+
except subprocess.CalledProcessError as e:
|
|
301
|
+
console.print("> Error setting application default quota project:")
|
|
302
|
+
console.print(e.stderr)
|
|
303
|
+
raise
|
|
304
|
+
|
|
305
|
+
console.print(f"> Successfully configured project: {project_id}")
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def setup_gcp_environment(
|
|
309
|
+
auto_approve: bool, skip_checks: bool, region: str, debug: bool
|
|
310
|
+
) -> dict:
|
|
311
|
+
"""Set up the GCP environment with proper credentials and project.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
auto_approve: Whether to skip confirmation prompts
|
|
315
|
+
skip_checks: Whether to skip verification checks
|
|
316
|
+
region: GCP region for deployment
|
|
317
|
+
debug: Whether debug logging is enabled
|
|
318
|
+
|
|
319
|
+
Returns:
|
|
320
|
+
Dictionary with credential information
|
|
321
|
+
"""
|
|
322
|
+
# Skip all verification if requested
|
|
323
|
+
if skip_checks:
|
|
324
|
+
if debug:
|
|
325
|
+
logging.debug("Skipping verification checks due to --skip-checks flag")
|
|
326
|
+
console.print("> Skipping verification checks", style="yellow")
|
|
327
|
+
return {"project": "unknown"}
|
|
328
|
+
|
|
329
|
+
# Verify current GCP credentials
|
|
330
|
+
if debug:
|
|
331
|
+
logging.debug("Verifying GCP credentials...")
|
|
332
|
+
creds_info = verify_credentials()
|
|
333
|
+
|
|
334
|
+
# Handle credential verification and project selection
|
|
335
|
+
if not auto_approve:
|
|
336
|
+
creds_info = _handle_credential_verification(creds_info)
|
|
337
|
+
else:
|
|
338
|
+
# Even with auto_approve, we should still set the GCP project
|
|
339
|
+
set_gcp_project(creds_info["project"], set_quota_project=True)
|
|
340
|
+
|
|
341
|
+
# Test Vertex AI connection
|
|
342
|
+
_test_vertex_ai_connection(creds_info["project"], region)
|
|
343
|
+
|
|
344
|
+
return creds_info
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def _handle_credential_verification(creds_info: dict) -> dict:
|
|
348
|
+
"""Handle verification of credentials and project selection.
|
|
349
|
+
|
|
350
|
+
Args:
|
|
351
|
+
creds_info: Current credential information
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
Updated credential information
|
|
355
|
+
"""
|
|
356
|
+
# Check if running in Cloud Shell
|
|
357
|
+
if os.environ.get("CLOUD_SHELL") == "true":
|
|
358
|
+
if creds_info["project"] == "":
|
|
359
|
+
console.print("> It looks like you are running in Cloud Shell.")
|
|
360
|
+
console.print(
|
|
361
|
+
"> You need to set up a project ID to continue, but you haven't setup a project yet."
|
|
362
|
+
)
|
|
363
|
+
new_project = Prompt.ask("\n> Enter a project ID")
|
|
364
|
+
creds_info["project"] = new_project
|
|
365
|
+
set_gcp_project(creds_info["project"], set_quota_project=False)
|
|
366
|
+
return creds_info
|
|
367
|
+
|
|
368
|
+
# Ask user if current credentials are correct
|
|
369
|
+
change_creds = (
|
|
370
|
+
Prompt.ask(
|
|
371
|
+
f"\n> You are logged in with account '{creds_info['account']}' "
|
|
372
|
+
f"and using project '{creds_info['project']}'. "
|
|
373
|
+
"Is this correct?",
|
|
374
|
+
choices=["Y", "n"],
|
|
375
|
+
default="Y",
|
|
376
|
+
).lower()
|
|
377
|
+
== "n"
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
if change_creds:
|
|
381
|
+
# Handle credential change
|
|
338
382
|
console.print("\n> Initiating new login...")
|
|
339
383
|
subprocess.run(["gcloud", "auth", "login", "--update-adc"], check=True)
|
|
340
384
|
console.print("> Login successful. Verifying new credentials...")
|
|
341
385
|
|
|
342
386
|
# Re-verify credentials after login
|
|
343
|
-
|
|
387
|
+
creds_info = verify_credentials()
|
|
344
388
|
|
|
345
389
|
# Prompt for project change
|
|
346
390
|
change_project = (
|
|
347
391
|
Prompt.ask(
|
|
348
|
-
f"\n> You are now logged in with account '{
|
|
349
|
-
f"Current project is '{
|
|
350
|
-
"
|
|
392
|
+
f"\n> You are now logged in with account '{creds_info['account']}'. "
|
|
393
|
+
f"Current project is '{creds_info['project']}'. "
|
|
394
|
+
"Is this correct?",
|
|
351
395
|
choices=["y", "n"],
|
|
352
|
-
default="
|
|
396
|
+
default="y",
|
|
353
397
|
).lower()
|
|
354
|
-
== "
|
|
398
|
+
== "n"
|
|
355
399
|
)
|
|
356
400
|
|
|
357
401
|
if change_project:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
console.print(
|
|
362
|
-
"\n> Error during login process. Please try again.", style="bold red"
|
|
363
|
-
)
|
|
364
|
-
logging.debug(f"Login error: {e!s}")
|
|
365
|
-
raise
|
|
366
|
-
except Exception as e:
|
|
367
|
-
console.print(f"\n> Unexpected error: {e!s}", style="bold red")
|
|
368
|
-
logging.debug(f"Unexpected error during login: {e!s}")
|
|
369
|
-
raise
|
|
402
|
+
# Prompt for new project ID
|
|
403
|
+
new_project = Prompt.ask("\n> Enter the new project ID")
|
|
404
|
+
creds_info["project"] = new_project
|
|
370
405
|
|
|
406
|
+
set_gcp_project(creds_info["project"], set_quota_project=True)
|
|
407
|
+
return creds_info
|
|
371
408
|
|
|
372
|
-
def handle_project_change() -> None:
|
|
373
|
-
"""Handle the process of changing GCP project."""
|
|
374
|
-
try:
|
|
375
|
-
# Prompt for new project ID
|
|
376
|
-
new_project = Prompt.ask("\n> Enter the new project ID")
|
|
377
409
|
|
|
378
|
-
|
|
379
|
-
|
|
410
|
+
def _test_vertex_ai_connection(project_id: str, region: str) -> None:
|
|
411
|
+
"""Test connection to Vertex AI.
|
|
380
412
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
413
|
+
Args:
|
|
414
|
+
project_id: GCP project ID
|
|
415
|
+
region: GCP region for deployment
|
|
416
|
+
"""
|
|
417
|
+
console.print("> Testing GCP and Vertex AI Connection...")
|
|
418
|
+
try:
|
|
419
|
+
verify_vertex_connection(
|
|
420
|
+
project_id=project_id,
|
|
421
|
+
location=region,
|
|
385
422
|
)
|
|
386
|
-
|
|
387
|
-
console.print(f"> Successfully switched to project: {new_project}")
|
|
388
|
-
|
|
389
|
-
# Re-verify credentials one final time
|
|
390
|
-
final_creds_info = verify_credentials()
|
|
391
423
|
console.print(
|
|
392
|
-
f"
|
|
393
|
-
f"with project '{final_creds_info['project']}'"
|
|
424
|
+
f"> ✓ Successfully verified connection to Vertex AI in project {project_id}"
|
|
394
425
|
)
|
|
395
|
-
|
|
396
|
-
except subprocess.CalledProcessError as e:
|
|
426
|
+
except Exception as e:
|
|
397
427
|
console.print(
|
|
398
|
-
"
|
|
428
|
+
f"> ✗ Failed to connect to Vertex AI: {e!s}\n"
|
|
429
|
+
f"> Please check your authentication settings and permissions. "
|
|
430
|
+
f"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
|
|
399
431
|
style="bold red",
|
|
400
432
|
)
|
|
401
|
-
logging.debug(f"Project change error: {e!s}")
|
|
402
|
-
raise
|
|
403
433
|
|
|
404
434
|
|
|
405
435
|
def replace_region_in_files(
|
|
@@ -485,11 +515,11 @@ def replace_region_in_files(
|
|
|
485
515
|
|
|
486
516
|
|
|
487
517
|
def check_and_install_uv() -> None:
|
|
488
|
-
"""Check if uv is installed and
|
|
518
|
+
"""Check if uv is installed and inform the user if it's not."""
|
|
489
519
|
try:
|
|
490
520
|
# Use shell=True for Windows compatibility and add timeout
|
|
491
521
|
process = subprocess.run(
|
|
492
|
-
"uv --version", shell=True, capture_output=True, text=True, timeout=
|
|
522
|
+
"uv --version", shell=True, capture_output=True, text=True, timeout=5
|
|
493
523
|
)
|
|
494
524
|
if process.returncode == 0:
|
|
495
525
|
logging.debug("uv is already installed")
|
|
@@ -502,43 +532,6 @@ def check_and_install_uv() -> None:
|
|
|
502
532
|
console.print("> uv is not installed", style="yellow")
|
|
503
533
|
|
|
504
534
|
console.print(
|
|
505
|
-
"\n> uv is
|
|
506
|
-
"\n
|
|
507
|
-
"\n 2. Manual installation from: https://docs.astral.sh/uv/getting-started/installation"
|
|
508
|
-
"\n This includes other options e.g PyPI (pip/pipx), Homebrew, Docker.."
|
|
509
|
-
)
|
|
510
|
-
|
|
511
|
-
install_choice = Prompt.ask(
|
|
512
|
-
"\n> Would you like to install uv automatically now?",
|
|
513
|
-
choices=["y", "n"],
|
|
514
|
-
default="y",
|
|
535
|
+
"\n> uv is recommended for managing virtual environments and dependencies."
|
|
536
|
+
"\n> For installation instructions, visit: https://docs.astral.sh/uv/getting-started/installation"
|
|
515
537
|
)
|
|
516
|
-
if install_choice.lower() == "y":
|
|
517
|
-
console.print("> Installing uv...", style="yellow")
|
|
518
|
-
try:
|
|
519
|
-
install_command = "curl -LsSf https://astral.sh/uv/install.sh | sh"
|
|
520
|
-
# Add timeout to installation process as well
|
|
521
|
-
subprocess.run(
|
|
522
|
-
install_command,
|
|
523
|
-
shell=True,
|
|
524
|
-
check=True,
|
|
525
|
-
timeout=60, # Give installation more time
|
|
526
|
-
)
|
|
527
|
-
console.print("> uv installed successfully!", style="green")
|
|
528
|
-
except subprocess.TimeoutExpired:
|
|
529
|
-
console.print("> uv installation timed out", style="bold red")
|
|
530
|
-
raise
|
|
531
|
-
except subprocess.CalledProcessError as e:
|
|
532
|
-
console.print("> Failed to install uv", style="bold red")
|
|
533
|
-
logging.debug(f"uv installation error: {e!s}")
|
|
534
|
-
console.print(
|
|
535
|
-
"> Please install uv manually using one of the methods listed above",
|
|
536
|
-
style="yellow",
|
|
537
|
-
)
|
|
538
|
-
raise
|
|
539
|
-
else:
|
|
540
|
-
console.print(
|
|
541
|
-
"> Please install uv manually using one of the methods listed above and try again",
|
|
542
|
-
style="yellow",
|
|
543
|
-
)
|
|
544
|
-
raise click.Abort() from None
|
src/cli/utils/gcp.py
CHANGED
|
@@ -24,7 +24,7 @@ from google.cloud.aiplatform_v1beta1.services.prediction_service import (
|
|
|
24
24
|
PredictionServiceClient,
|
|
25
25
|
)
|
|
26
26
|
from google.cloud.aiplatform_v1beta1.types.prediction_service import (
|
|
27
|
-
|
|
27
|
+
CountTokensRequest,
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
|
|
@@ -43,12 +43,11 @@ def get_client_info() -> ClientInfo:
|
|
|
43
43
|
return ClientInfo(client_library_version=version, user_agent=agent)
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
def get_dummy_request(project_id: str, location: str) ->
|
|
46
|
+
def get_dummy_request(project_id: str, location: str) -> CountTokensRequest:
|
|
47
47
|
"""Creates a simple test request for Gemini."""
|
|
48
|
-
return
|
|
49
|
-
contents=[{"role": "user", "parts": [{"text": "Hi
|
|
50
|
-
|
|
51
|
-
model=f"projects/{project_id}/locations/{location}/publishers/google/models/gemini-2.0-flash-001",
|
|
48
|
+
return CountTokensRequest(
|
|
49
|
+
contents=[{"role": "user", "parts": [{"text": "Hi"}]}],
|
|
50
|
+
endpoint=f"projects/{project_id}/locations/{location}/publishers/google/models/gemini-1.5-flash-002",
|
|
52
51
|
)
|
|
53
52
|
|
|
54
53
|
|
|
@@ -64,10 +63,10 @@ def verify_vertex_connection(
|
|
|
64
63
|
api_endpoint=f"{location}-aiplatform.googleapis.com"
|
|
65
64
|
),
|
|
66
65
|
client_info=get_client_info(),
|
|
67
|
-
transport=
|
|
66
|
+
transport=initializer.global_config._api_transport,
|
|
68
67
|
)
|
|
69
68
|
request = get_dummy_request(project_id=project_id, location=location)
|
|
70
|
-
client.
|
|
69
|
+
client.count_tokens(request=request)
|
|
71
70
|
|
|
72
71
|
|
|
73
72
|
def verify_credentials() -> dict[str, str]:
|