You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Vertex Express Mode: Using Sessions and Memory for Free
1
+
# Vertex AI Express Mode: Using Vertex AI Sessions and Memory for Free
2
2
3
3
If you are interested in using either the `VertexAiSessionService` or `VertexAiMemoryBankService` but you don't have a Google Cloud Project, you can sign up for Vertex AI Express Mode and get access
4
4
for free and try out these services! You can sign up with an eligible ***gmail*** account [here](https://console.cloud.google.com/expressmode). For more details about Vertex AI Express mode, see the [overview page](https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview).
@@ -13,12 +13,12 @@ Once you sign up, get an [API key](https://cloud.google.com/vertex-ai/generative
13
13
`Session` objects are children of an `AgentEngine`. When using Vertex AI Express Mode, we can create an empty `AgentEngine` parent to manage all of our `Session` and `Memory` objects.
14
14
First, ensure that your enviornment variables are set correctly. For example, in Python:
For Free Express Mode Projects, `VertexAiMemoryBankService` has the following quota:
102
+
101
103
- 200 Memory Entities
102
104
103
105
## Code Sample: Weather Agent with Session and Memory using Vertex AI Express Mode
104
106
105
107
In this sample, we create a weather agent that utilizes both `VertexAiSessionService` and `VertexAiMemoryBankService` for context maangement, allowing our agent to recall user prefereneces and conversations!
106
108
107
-
**[Weather Agent with Session and Memory using Vertex Express Mode](https://github.com/google/adk-docs/blob/main/examples/python/notebooks/express-mode-weather-agent.ipynb)**
109
+
**[Weather Agent with Session and Memory using Vertex AI Express Mode](https://github.com/google/adk-docs/blob/main/examples/python/notebooks/express-mode-weather-agent.ipynb)**
"* `name`: A unique identifier for this agent (e.g., \"weather\\_agent\\_v1\"). \n",
225
-
"* `model`: Specifies which LLM to use (e.g., `MODEL_GEMINI_2_5_PRO`). We'll start with a specific Gemini model. \n",
225
+
"* `model`: Specifies which LLM to use (e.g., `MODEL_GEMINI_2_0_FLASH`). We'll start with a specific Gemini model. \n",
226
226
"* `description`: A concise summary of the agent's overall purpose. This becomes crucial later when other agents need to decide whether to delegate tasks to *this* agent. \n",
227
227
"* `instruction`: Detailed guidance for the LLM on how to behave, its persona, its goals, and specifically *how and when* to utilize its assigned `tools`. \n",
228
228
"* `tools`: A list containing the actual Python tool functions the agent is allowed to use (e.g., `[get_weather]`).\n",
@@ -244,17 +244,18 @@
244
244
"\n",
245
245
"weather_agent = Agent(\n",
246
246
" name=\"weather_agent_v1\",\n",
247
-
" model=MODEL_GEMINI_2_5_PRO,\n",
247
+
" model=MODEL_GEMINI_2_0_FLASH,\n",
248
248
" description=\"Provides weather information for specific cities.\",\n",
249
249
" instruction=\"You are a helpful weather assistant. \"\n",
250
250
"\"When the user asks for the weather in a specific city, \"\n",
251
251
"\"use the 'get_weather' tool to find the information. \"\n",
252
252
"\"If the tool returns an error, inform the user politely. \"\n",
253
-
"\"If the tool is successful, present the weather report clearly.\",\n",
253
+
"\"If the tool is successful, present the weather report clearly.\"\n",
254
+
"\"You can help the user find what city has better weather based on their preferences using the preload memory tool.\",\n",
254
255
" tools=[get_weather, adk.tools.preload_memory_tool.PreloadMemoryTool()], # Pass the function directly\n",
255
256
")\n",
256
257
"\n",
257
-
"print(f\"Agent '{weather_agent.name}' created using model '{MODEL_GEMINI_2_5_PRO}'.\")"
258
+
"print(f\"Agent '{weather_agent.name}' created using model '{MODEL_GEMINI_2_0_FLASH}'.\")"
258
259
]
259
260
},
260
261
{
@@ -534,8 +535,8 @@
534
535
"# @title Create a Memory Based on the Previous Session\n",
535
536
"\n",
536
537
"# We can generate a memory given the previous session id\n",
0 commit comments