agent-starter-pack 0.4.2__py3-none-any.whl → 0.4.4__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.
- {agent_starter_pack-0.4.2.dist-info → agent_starter_pack-0.4.4.dist-info}/METADATA +1 -1
- {agent_starter_pack-0.4.2.dist-info → agent_starter_pack-0.4.4.dist-info}/RECORD +11 -11
- agents/live_api/README.md +1 -1
- agents/live_api/app/agent.py +1 -2
- agents/live_api/app/server.py +13 -14
- src/base_template/Makefile +2 -2
- src/base_template/README.md +1 -1
- src/cli/commands/create.py +3 -3
- {agent_starter_pack-0.4.2.dist-info → agent_starter_pack-0.4.4.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.4.2.dist-info → agent_starter_pack-0.4.4.dist-info}/entry_points.txt +0 -0
- {agent_starter_pack-0.4.2.dist-info → agent_starter_pack-0.4.4.dist-info}/licenses/LICENSE +0 -0
@@ -26,16 +26,16 @@ agents/langgraph_base_react/app/agent.py,sha256=srxiOT-NIM87WnUvP0PXuZGryEG9S33Z
|
|
26
26
|
agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb,sha256=PlW41fL-ji9NKkimW6u25YRLGWN2pgoX2G8w5nzIEPE,58737
|
27
27
|
agents/langgraph_base_react/template/.templateconfig.yaml,sha256=NE_EJzZPtdbJRFdp5k9fovc6zUA6Wvm1MBUBvaZ6gV0,1050
|
28
28
|
agents/langgraph_base_react/tests/integration/test_agent.py,sha256=wg2Y8V4l7dh7rhWy7Z8zioDW5ILRsz7RZJ-mz0AhK3U,1619
|
29
|
-
agents/live_api/README.md,sha256=
|
30
|
-
agents/live_api/app/agent.py,sha256=
|
31
|
-
agents/live_api/app/server.py,sha256=
|
29
|
+
agents/live_api/README.md,sha256=c3lu5WguOUBc5hO_UtNZfVhfYxvSzMXuGFICn9M38mU,2897
|
30
|
+
agents/live_api/app/agent.py,sha256=FBsmCYI_dmBIbFD1uojcPxJfozGNc-0rg1fW2PhEyFw,2298
|
31
|
+
agents/live_api/app/server.py,sha256=A2frpeM-mHoRiUAlvJKZAdU_Q8-GOwcCh3iODdRmbr4,7652
|
32
32
|
agents/live_api/template/.templateconfig.yaml,sha256=xN4ZNa_-qoBWNh4oMh8WBu-KmxUAYtJdF7qlYbHg-FM,964
|
33
33
|
agents/live_api/tests/integration/test_server_e2e.py,sha256=D2VETDIyTD2fQyQ6DXwLr-POSYyVzzzcpIFLt5Ppyx4,8398
|
34
34
|
agents/live_api/tests/load_test/load_test.py,sha256=HHZyfC4gqiQtZVF_CbbxENGgWQccMLpwMv0IdoQ6cbQ,1275
|
35
35
|
agents/live_api/tests/unit/test_server.py,sha256=_TjlgQgNkjerIaBGnu8P8_KB8ZlSolDcivALpUOn_Rw,4786
|
36
36
|
src/base_template/.gitignore,sha256=mJKTZIcVdAFiIUQicRfPNGUg6WvwcfTEC2xbmAaU34g,2579
|
37
|
-
src/base_template/Makefile,sha256=
|
38
|
-
src/base_template/README.md,sha256=
|
37
|
+
src/base_template/Makefile,sha256=O65aYaRQlCOZHfCaAdWbK3eEobw5x83A8nEjK88jtpQ,4538
|
38
|
+
src/base_template/README.md,sha256=fZ2qe3LS9bA2pBzvBvAqclPTmdjBzRr84O5P3QoNk0I,10143
|
39
39
|
src/base_template/pyproject.toml,sha256=V2Df010o_Q8smOaS1K9fx-pVe9X4_KZT4vpIRaB0aFs,2959
|
40
40
|
src/base_template/app/__init__.py,sha256=UyAgc2l8nkVIUPUzL9hKR7EgzCsc2jSYcOcjHNNmpMU,59
|
41
41
|
src/base_template/app/utils/tracing.py,sha256=2rv1Ukh2jTBENDwoghCItJ28l-Sjz9gMlzdojlVgJa4,6052
|
@@ -63,7 +63,7 @@ src/base_template/deployment/terraform/dev/vars/env.tfvars,sha256=LoQMjh1AAMR-MG
|
|
63
63
|
src/base_template/deployment/terraform/vars/env.tfvars,sha256=Nze8q1x2Aj6ZUeWC2hDeZWqNUkLp13DgzA_LFmmOzCo,1216
|
64
64
|
src/base_template/tests/unit/test_dummy.py,sha256=2exfCH8qhkZrLWvK04ZxNTO9MV3fdTbZkJN3uK6zvok,850
|
65
65
|
src/cli/main.py,sha256=pMsSlNwkrFqHUHHA5U-WMZ4QRquaI_F7OXQt6yxuugE,1688
|
66
|
-
src/cli/commands/create.py,sha256=
|
66
|
+
src/cli/commands/create.py,sha256=g0cSZUM2MabAg2h7GomuHHr7n5uMVjXBKebt1_1u17o,24145
|
67
67
|
src/cli/commands/setup_cicd.py,sha256=Lr0wLeKlRxROsRVFLAI3ygfIh_sTavvgQckDkzFEKMQ,31705
|
68
68
|
src/cli/utils/__init__.py,sha256=_cTmsXGPqOtK0q8UW5164QTltbJRJFR_Efxq_BRL1-o,1311
|
69
69
|
src/cli/utils/cicd.py,sha256=m2BxwV39323rVzJCjJjB37IPdSNQdxVgXGrgnhdbb84,26040
|
@@ -169,8 +169,8 @@ src/resources/setup_cicd/providers.tf,sha256=Km4z6IJt7x7PLaa0kyZbBrO2m3lpuIJZFD5
|
|
169
169
|
src/utils/generate_locks.py,sha256=6V1B8V2BEuevWnXUsxZVTrLjXwFRII8UfsIGrQqZxVs,4320
|
170
170
|
src/utils/lock_utils.py,sha256=RSE6n3hBkH64xNm3Q5wrR0Pqbeo-oc7xaTOhA9yzHjk,2275
|
171
171
|
src/utils/watch_and_rebuild.py,sha256=vP4yIiA7E_lj5sfQdJUl8TXas6V7msDg8XWUutAC05Q,6679
|
172
|
-
agent_starter_pack-0.4.
|
173
|
-
agent_starter_pack-0.4.
|
174
|
-
agent_starter_pack-0.4.
|
175
|
-
agent_starter_pack-0.4.
|
176
|
-
agent_starter_pack-0.4.
|
172
|
+
agent_starter_pack-0.4.4.dist-info/METADATA,sha256=9f-WXcPpX22tOh8Qn9Jp1a1FK_EMX5Ix0lUcvnFqMVk,10452
|
173
|
+
agent_starter_pack-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
174
|
+
agent_starter_pack-0.4.4.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
|
175
|
+
agent_starter_pack-0.4.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
176
|
+
agent_starter_pack-0.4.4.dist-info/RECORD,,
|
agents/live_api/README.md
CHANGED
@@ -6,7 +6,7 @@ This pattern showcases a real-time conversational agent powered by Google Gemini
|
|
6
6
|
|
7
7
|
**Key components:**
|
8
8
|
|
9
|
-
- **Python Backend** (in `app/` folder): A production-ready server built with [FastAPI](https://fastapi.tiangolo.com/) and [google-genai](https://googleapis.github.io/python-
|
9
|
+
- **Python Backend** (in `app/` folder): A production-ready server built with [FastAPI](https://fastapi.tiangolo.com/) and [google-genai](https://googleapis.github.io/python-genai/) that features:
|
10
10
|
|
11
11
|
- **Real-time bidirectional communication** via WebSockets between the frontend and Gemini model
|
12
12
|
- **Integrated tool calling** with a weather information tool for demonstrating external data retrieval
|
agents/live_api/app/agent.py
CHANGED
@@ -22,8 +22,7 @@ from google.genai import types
|
|
22
22
|
# Constants
|
23
23
|
VERTEXAI = os.getenv("VERTEXAI", "true").lower() == "true"
|
24
24
|
LOCATION = "us-central1"
|
25
|
-
|
26
|
-
MODEL_ID = "gemini-2.0-flash-exp"
|
25
|
+
MODEL_ID = "gemini-2.0-flash-live-preview-04-09"
|
27
26
|
|
28
27
|
# Initialize Google Cloud clients
|
29
28
|
credentials, project_id = google.auth.default()
|
agents/live_api/app/server.py
CHANGED
@@ -70,6 +70,7 @@ class GeminiSession:
|
|
70
70
|
while True:
|
71
71
|
try:
|
72
72
|
data = await self.websocket.receive_json()
|
73
|
+
|
73
74
|
if isinstance(data, dict) and (
|
74
75
|
"realtimeInput" in data or "clientContent" in data
|
75
76
|
):
|
@@ -98,13 +99,7 @@ class GeminiSession:
|
|
98
99
|
async def _handle_tool_call(
|
99
100
|
self, session: Any, tool_call: LiveServerToolCall
|
100
101
|
) -> None:
|
101
|
-
"""Process tool calls from Gemini and send back responses.
|
102
|
-
|
103
|
-
Args:
|
104
|
-
session: The Gemini session
|
105
|
-
tool_call: Tool call request from Gemini
|
106
|
-
"""
|
107
|
-
# Handle case where function_calls might be None
|
102
|
+
"""Process tool calls from Gemini and send back responses."""
|
108
103
|
if tool_call.function_calls is None:
|
109
104
|
logging.debug("No function calls in tool_call")
|
110
105
|
return
|
@@ -116,7 +111,14 @@ class GeminiSession:
|
|
116
111
|
logging.error(f"Function {fc.name} not found")
|
117
112
|
continue
|
118
113
|
args = fc.args if fc.args is not None else {}
|
119
|
-
|
114
|
+
|
115
|
+
# Handle both async and sync functions appropriately
|
116
|
+
if asyncio.iscoroutinefunction(func):
|
117
|
+
# Function is already async
|
118
|
+
response = await func(**args)
|
119
|
+
else:
|
120
|
+
# Run sync function in a thread pool to avoid blocking
|
121
|
+
response = await asyncio.to_thread(func, **args)
|
120
122
|
|
121
123
|
tool_response = types.LiveClientToolResponse(
|
122
124
|
function_responses=[
|
@@ -127,18 +129,15 @@ class GeminiSession:
|
|
127
129
|
await session.send(input=tool_response)
|
128
130
|
|
129
131
|
async def receive_from_gemini(self) -> None:
|
130
|
-
"""Listen for and process messages from Gemini.
|
131
|
-
|
132
|
-
Continuously receives messages from Gemini, forwards them to the client,
|
133
|
-
and handles any tool calls. Handles connection errors gracefully.
|
134
|
-
"""
|
132
|
+
"""Listen for and process messages from Gemini without blocking."""
|
135
133
|
while result := await self.session._ws.recv(decode=False):
|
136
134
|
await self.websocket.send_bytes(result)
|
137
135
|
raw_message = json.loads(result)
|
138
136
|
if "toolCall" in raw_message:
|
139
137
|
message = types.LiveServerMessage.model_validate(raw_message)
|
140
138
|
tool_call = LiveServerToolCall.model_validate(message.tool_call)
|
141
|
-
|
139
|
+
# Create a separate task to handle the tool call without blocking
|
140
|
+
asyncio.create_task(self._handle_tool_call(self.session, tool_call))
|
142
141
|
|
143
142
|
|
144
143
|
def get_connect_and_run_callable(websocket: WebSocket) -> Callable:
|
src/base_template/Makefile
CHANGED
@@ -22,7 +22,7 @@ playground:
|
|
22
22
|
uv run uvicorn app.server:app --host 0.0.0.0 --port 8000 --reload &
|
23
23
|
{%- endif %}
|
24
24
|
{%- if cookiecutter.agent_name == 'live_api' %}
|
25
|
-
npm --prefix frontend start
|
25
|
+
PORT=8501 npm --prefix frontend start
|
26
26
|
{%- else %}
|
27
27
|
{% if cookiecutter.deployment_target == 'agent_engine' %}PYTHONPATH=. {% endif %}uv run streamlit run frontend/streamlit_app.py --browser.serverAddress=localhost --server.enableCORS=false --server.enableXsrfProtection=false
|
28
28
|
{%- endif %}
|
@@ -54,7 +54,7 @@ local-backend:
|
|
54
54
|
{%- if cookiecutter.agent_name == 'live_api' %}
|
55
55
|
|
56
56
|
ui:
|
57
|
-
npm --prefix frontend start
|
57
|
+
PORT=8501 npm --prefix frontend start
|
58
58
|
{%- endif %}
|
59
59
|
{%- endif %}
|
60
60
|
|
src/base_template/README.md
CHANGED
@@ -110,7 +110,7 @@ Here’s the recommended workflow for local development:
|
|
110
110
|
This launches the Streamlit application, which connects to the backend server (by default at `http://localhost:8000`).
|
111
111
|
|
112
112
|
4. **Interact and Iterate:**
|
113
|
-
* Open the Streamlit UI in your browser (usually `http://localhost:
|
113
|
+
* Open the Streamlit UI in your browser (usually `http://localhost:8501` or `http://localhost:3001`).
|
114
114
|
* Click the play button in the UI to connect to the backend.
|
115
115
|
* Interact with the agent! Try prompts like: *"Using the tool you have, define Governance in the context MLOPs"*
|
116
116
|
* Modify the agent logic in `app/agent.py`. The backend server (FastAPI with `uvicorn --reload`) should automatically restart when you save changes. Refresh the frontend if needed to see behavioral changes.
|
src/cli/commands/create.py
CHANGED
@@ -134,7 +134,7 @@ def create(
|
|
134
134
|
console.print("\n=== GCP Agent Starter Pack :rocket:===", style="bold blue")
|
135
135
|
console.print("Welcome to the Agent Starter Pack!")
|
136
136
|
console.print(
|
137
|
-
"This tool will help you create an end-to-end production-ready AI agent in
|
137
|
+
"This tool will help you create an end-to-end production-ready AI agent in Google Cloud!\n"
|
138
138
|
)
|
139
139
|
# Validate project name
|
140
140
|
if len(project_name) > 26:
|
@@ -317,9 +317,9 @@ def create(
|
|
317
317
|
|
318
318
|
console.print("\n> Success! Your agent project is ready.")
|
319
319
|
console.print(
|
320
|
-
"\n📖
|
320
|
+
f"\n📖 Project README: [cyan]cat {cd_path}/README.md[/]"
|
321
|
+
"\n Online Development Guide: [cyan][link=https://goo.gle/asp-dev]https://goo.gle/asp-dev[/link][/cyan]"
|
321
322
|
)
|
322
|
-
console.print(f" [cyan]cat {cd_path}/README.md[/]")
|
323
323
|
# Determine the correct path to display based on whether output_dir was specified
|
324
324
|
console.print("\n🚀 To get started, run the following command:")
|
325
325
|
console.print(
|
File without changes
|
File without changes
|
File without changes
|