Skip to content

Commit dbaf5c8

Browse files
authored
Merge pull request #3 from google/polong-20250408
fix: update model id to gemini-2.0-flash-exp
2 parents 120b8fd + 85c9f6d commit dbaf5c8

34 files changed

+72
-67
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ from google.adk.tools import google_search
4242

4343
root_agent = Agent(
4444
name="search_assistant",
45-
model="gemini-2.0-flash",
45+
model="gemini-2.0-flash-exp",
4646
instruction="You are a helpful assistant. Answer user questions using Google Search when needed.",
4747
description="An assistant that can search the web.",
4848
tools=[google_search]

docs/agents/custom-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ These are standard `LlmAgent` definitions, responsible for specific tasks. Their
220220
```python
221221
# agent.py (LLM Agent Definitions part)
222222
223-
GEMINI_FLASH = "gemini-1.5-flash" # Define model constant
223+
GEMINI_FLASH = "gemini-2.0-flash-exp" # Define model constant
224224
225225
story_generator = LlmAgent(
226226
name="StoryGenerator", model=GEMINI_FLASH,

docs/agents/llm-agents.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ First, you need to establish what the agent *is* and what it's *for*.
1414

1515
* **`description` (Optional, Recommended for Multi-Agent):** Provide a concise summary of the agent's capabilities. This description is primarily used by *other* LLM agents to determine if they should route a task to this agent. Make it specific enough to differentiate it from peers (e.g., "Handles inquiries about current billing statements," not just "Billing agent").
1616

17-
* **`model` (Required):** Specify the underlying LLM that will power this agent's reasoning. This is a string identifier like `"gemini-2.0-flash-001"`. The choice of model impacts the agent's capabilities, cost, and performance. See the [Models](models.md) page for available options and considerations.
17+
* **`model` (Required):** Specify the underlying LLM that will power this agent's reasoning. This is a string identifier like `"gemini-2.0-flash-exp"`. The choice of model impacts the agent's capabilities, cost, and performance. See the [Models](models.md) page for available options and considerations.
1818

1919
```python
2020
# Example: Defining the basic identity
2121
capital_agent = LlmAgent(
22-
model="gemini-2.0-flash-001",
22+
model="gemini-2.0-flash-exp",
2323
name="capital_agent",
2424
description="Answers user questions about the capital city of a given country."
2525
# instruction and tools will be added next
@@ -46,7 +46,7 @@ The `instruction` parameter is arguably the most critical for shaping an `LlmAge
4646
```python
4747
# Example: Adding instructions
4848
capital_agent = LlmAgent(
49-
model="gemini-1.5-flash",
49+
model="gemini-2.0-flash-exp",
5050
name="capital_agent",
5151
description="Answers user questions about the capital city of a given country.",
5252
instruction="""You are an agent that provides the capital city of a country.
@@ -84,7 +84,7 @@ def get_capital_city(country: str) -> str:
8484

8585
# Add the tool to the agent
8686
capital_agent = LlmAgent(
87-
model="gemini-1.5-flash",
87+
model="gemini-2.0-flash-exp",
8888
name="capital_agent",
8989
description="Answers user questions about the capital city of a given country.",
9090
instruction="""You are an agent that provides the capital city of a country... (previous instruction text)""",
@@ -171,7 +171,7 @@ Here's the complete basic `capital_agent`:
171171

172172
```python
173173
# Full example code for the basic capital agent
174-
--8<-- "examples/python/snippets/agents/llm-agent/capital-agent.py"
174+
--8<-- "examples/python/snippets/agents/llm-agent/capital_agent.py"
175175
```
176176

177177
_(This example demonstrates the core concepts. More complex agents might incorporate schemas, context control, planning, etc.)_

docs/agents/models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ from google.adk.agents import LlmAgent
5656
# --- Example using a stable Gemini Flash model ---
5757
agent_gemini_flash = LlmAgent(
5858
# Use the latest stable Flash model identifier
59-
model="gemini-2.0-flash-001",
59+
model="gemini-2.0-flash-exp",
6060
name="gemini_flash_agent",
6161
instruction="You are a fast and helpful Gemini assistant.",
6262
# ... other agent parameters

docs/agents/multi-agents.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ The foundation for structuring multi-agent systems is the parent-child relations
2929
from google.adk.agents import LlmAgent, BaseAgent
3030

3131
# Define individual agents
32-
greeter = LlmAgent(name="Greeter", model="gemini-2.0-flash-001")
32+
greeter = LlmAgent(name="Greeter", model="gemini-2.0-flash-exp")
3333
task_doer = BaseAgent(name="TaskExecutor") # Custom non-LLM agent
3434

3535
# Create parent agent and assign children via sub_agents
3636
coordinator = LlmAgent(
3737
name="Coordinator",
38-
model="gemini-2.0-flash-001",
38+
model="gemini-2.0-flash-exp",
3939
description="I coordinate greetings and tasks.",
4040
sub_agents=[ # Assign sub_agents here
4141
greeter,
@@ -196,7 +196,7 @@ image_tool = AgentTool(agent=image_agent) # Wrap the agent
196196
# Parent agent uses the AgentTool
197197
artist_agent = LlmAgent(
198198
name="Artist",
199-
model="gemini-1.5-flash",
199+
model="gemini-2.0-flash-exp",
200200
instruction="Create a prompt and use the ImageGen tool to generate the image.",
201201
tools=[image_tool] # Include the AgentTool
202202
)
@@ -229,7 +229,7 @@ support_agent = LlmAgent(name="Support", description="Handles technical support
229229

230230
coordinator = LlmAgent(
231231
name="HelpDeskCoordinator",
232-
model="gemini-1.5-flash",
232+
model="gemini-2.0-flash-exp",
233233
instruction="Route user requests: Use Billing agent for payment issues, Support agent for technical problems.",
234234
description="Main help desk router.",
235235
# allow_transfer=True is often implicit with sub_agents in AutoFlow
@@ -317,15 +317,15 @@ summarizer = LlmAgent(name="Summarizer", description="Summarizes text.")
317317
# Mid-level agent combining tools
318318
research_assistant = LlmAgent(
319319
name="ResearchAssistant",
320-
model="gemini-1.5-flash",
320+
model="gemini-2.0-flash-exp",
321321
description="Finds and summarizes information on a topic.",
322322
tools=[AgentTool(agent=web_searcher), AgentTool(agent=summarizer)]
323323
)
324324

325325
# High-level agent delegating research
326326
report_writer = LlmAgent(
327327
name="ReportWriter",
328-
model="gemini-1.5-flash",
328+
model="gemini-2.0-flash-exp",
329329
instruction="Write a report on topic X. Use the ResearchAssistant to gather information.",
330330
tools=[AgentTool(agent=research_assistant)]
331331
# Alternatively, could use LLM Transfer if research_assistant is a sub_agent

docs/agents/workflow-agents/loop-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ In this setup, the `LoopAgent` would manage the iterative process. The `CriticA
4242
#### Full code
4343

4444
```py
45-
--8<-- "examples/python/snippets/agents/workflow-agents/loop-agent-doc-improv-agent.py"
45+
--8<-- "examples/python/snippets/agents/workflow-agents/loop_agent_doc_improv_agent.py"
4646
```

docs/callbacks/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def my_before_model_logic(
3636
# --- Register it during Agent creation ---
3737
my_agent = LlmAgent(
3838
name="MyCallbackAgent",
39-
model="gemini-2.0-flash", # Or your desired model
39+
model="gemini-2.0-flash-exp", # Or your desired model
4040
instruction="Be helpful.",
4141
# Other agent parameters...
4242
before_model_callback=my_before_model_logic # Pass the function here
@@ -132,7 +132,7 @@ def block_forbidden_input(
132132
# Agent definition using the callback
133133
guardrail_agent = LlmAgent(
134134
name="GuardrailAgent",
135-
model="gemini-2.0-flash",
135+
model="gemini-2.0-flash-exp",
136136
instruction="Answer user questions.",
137137
before_model_callback=block_forbidden_input
138138
)

docs/get-started/running-the-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ from agents.sessions import InMemorySessionService
125125

126126
# Step 1: Define your agent:
127127
root_agent = Agent(name="my_agent",
128-
model="gemini-2.0-flash",
128+
model="gemini-2.0-flash-exp",
129129
instruction="Answer questions.")
130130

131131
# Step 2: Initiate Session

docs/guides/responsible-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def validate_tool_params(
156156

157157
# Hypothetical Agent setup
158158
root_agent = LlmAgent( # Use specific agent type
159-
model='gemini-1.5-flash-001',
159+
model='gemini-2.0-flash-exp',
160160
name='root_agent',
161161
instruction="...",
162162
before_tool_callback=validate_tool_params, # Assign the callback

docs/runtime/artifacts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ from google.adk.agents import LlmAgent # Any agent
106106
from google.adk.sessions import InMemorySessionService
107107

108108
# Example: Configuring the Runner with an Artifact Service
109-
my_agent = LlmAgent(name="artifact_user_agent", model="gemini-2.0-flash")
109+
my_agent = LlmAgent(name="artifact_user_agent", model="gemini-2.0-flash-exp")
110110
artifact_service = InMemoryArtifactService() # Choose an implementation
111111
session_service = InMemorySessionService()
112112

@@ -206,7 +206,7 @@ from google.adk.agents import LlmAgent
206206
from google.adk.sessions import InMemorySessionService
207207

208208
# Your agent definition
209-
agent = LlmAgent(name="my_agent", model="gemini-2.0-flash")
209+
agent = LlmAgent(name="my_agent", model="gemini-2.0-flash-exp")
210210

211211
# Instantiate the desired artifact service
212212
artifact_service = InMemoryArtifactService()

docs/sessions/memory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ from google.genai.types import Content, Part
8383
# --- Constants ---
8484
APP_NAME = "memory_example_app"
8585
USER_ID = "mem_user"
86-
MODEL = "gemini-1.5-flash" # Use a valid model
86+
MODEL = "gemini-2.0-flash-exp" # Use a valid model
8787

8888
# --- Agent Definitions ---
8989
# Agent 1: Simple agent to capture information

docs/sessions/state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ from google.genai.types import Content, Part
8181
# Define agent with output_key
8282
greeting_agent = LlmAgent(
8383
name="Greeter",
84-
model="gemini-1.5-flash", # Use a valid model
84+
model="gemini-2.0-flash-exp", # Use a valid model
8585
instruction="Generate a short, friendly greeting.",
8686
output_key="last_greeting" # Save response to state['last_greeting']
8787
)

docs/tools/google-cloud-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Note: this tutorial includes an agent creation. If you already have an agent, yo
8383
from .tools import sample_toolset
8484
8585
root_agent = LlmAgent(
86-
model='gemini-2.0-flash',
86+
model='gemini-2.0-flash-exp',
8787
name='enterprise_assistant',
8888
instruction='Help user, leverage the tools you have access to',
8989
tools=sample_toolset.get_tools(),)

docs/tools/mcp-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ async def get_agent_async():
234234
tools, exit_stack = await get_tools_async()
235235
print(f"Fetched {len(tools)} tools from MCP server.")
236236
root_agent = LlmAgent(
237-
model='gemini-1.5-flash', # Adjust if needed
237+
model='gemini-2.0-flash-exp', # Adjust if needed
238238
name='maps_assistant',
239239
instruction='Help user with mapping and directions using available tools.',
240240
tools=tools,

docs/tools/openapi-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Follow these steps to integrate an OpenAPI spec into your agent:
7070

7171
my_agent = LlmAgent(
7272
name="api_interacting_agent",
73-
model="gemini-2.0-flash-001", # Or your preferred model
73+
model="gemini-2.0-flash-exp", # Or your preferred model
7474
tools=api_tools, # Pass the list of generated tools
7575
# ... other agent config ...
7676
)

docs/tools/third-party-tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ADK provides the `LangchainTool` wrapper to integrate tools from the LangChain e
5555
# Define the ADK agent, including the wrapped tool
5656
my_agent = Agent(
5757
name="langchain_tool_agent",
58-
model="gemini-2.0-flash",
58+
model="gemini-2.0-flash-exp",
5959
description="Agent to answer questions using TavilySearch.",
6060
instruction="I can answer your questions by searching the internet. Just ask me anything!",
6161
tools=[adk_tavily_tool] # Add the wrapped tool here
@@ -125,7 +125,7 @@ ADK provides the `CrewaiTool` wrapper to integrate tools from the CrewAI library
125125
# Define the ADK agent
126126
my_agent = Agent(
127127
name="crewai_search_agent",
128-
model="gemini-2.0-flash",
128+
model="gemini-2.0-flash-exp",
129129
description="Agent to find recent news using the Serper search tool.",
130130
instruction="I can find the latest news for you. What topic are you interested in?",
131131
tools=[adk_serper_tool] # Add the wrapped tool here

examples/python/snippets/agents/custom-agent/storyflow-agent.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import AsyncGenerator
33
from typing_extensions import override
44

5-
from google.adk.agents import Agent, LlmAgent, BaseAgent, LoopAgent, SequentialAgent
5+
from google.adk.agents import LlmAgent, BaseAgent, LoopAgent, SequentialAgent
66
from google.adk.agents.invocation_context import InvocationContext
77
from google.genai import types
88
from google.adk.sessions import InMemorySessionService
@@ -14,7 +14,7 @@
1414
APP_NAME = "story_app"
1515
USER_ID = "12345"
1616
SESSION_ID = "123344"
17-
GEMINI_2_FLASH = "gemini-2.0-flash-001"
17+
GEMINI_2_FLASH = "gemini-2.0-flash-exp"
1818

1919
# --- Configure Logging ---
2020
logging.basicConfig(level=logging.INFO)
@@ -240,7 +240,9 @@ def call_agent(user_input_topic: str):
240240
Sends a new topic to the agent (overwriting the initial one if needed)
241241
and runs the workflow.
242242
"""
243-
current_session = session_service.get_session(APP_NAME, USER_ID, SESSION_ID)
243+
current_session = session_service.get_session(app_name=APP_NAME,
244+
user_id=USER_ID,
245+
session_id=SESSION_ID)
244246
if not current_session:
245247
logger.error("Session not found!")
246248
return
@@ -260,7 +262,9 @@ def call_agent(user_input_topic: str):
260262
print("\n--- Agent Interaction Result ---")
261263
print("Agent Final Response: ", final_response)
262264

263-
final_session = session_service.get_session(APP_NAME, USER_ID, SESSION_ID)
265+
final_session = session_service.get_session(app_name=APP_NAME,
266+
user_id=USER_ID,
267+
session_id=SESSION_ID)
264268
print("Final Session State:")
265269
import json
266270
print(json.dumps(final_session.state, indent=2))

examples/python/snippets/agents/llm-agent/capital-agent.py renamed to examples/python/snippets/agents/llm-agent/capital_agent.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# --- Full example code demonstrating LlmAgent with Tools vs. Output Schema ---
2-
import asyncio
32
import json # Needed for pretty printing dicts
43

54
from google.adk.agents import LlmAgent
@@ -13,7 +12,7 @@
1312
USER_ID = "test_user_456"
1413
SESSION_ID_TOOL_AGENT = "session_tool_agent_xyz"
1514
SESSION_ID_SCHEMA_AGENT = "session_schema_agent_xyz"
16-
MODEL_NAME = "gemini-2.0-flash-001"
15+
MODEL_NAME = "gemini-2.0-flash-exp"
1716

1817
# --- 2. Define Schemas ---
1918

@@ -117,7 +116,9 @@ async def call_agent_and_print(
117116

118117
print(f"<<< Agent '{agent_instance.name}' Response: {final_response_content}")
119118

120-
current_session = session_service.get_session(APP_NAME, USER_ID, session_id)
119+
current_session = session_service.get_session(app_name=APP_NAME,
120+
user_id=USER_ID,
121+
session_id=session_id)
121122
stored_output = current_session.state.get(agent_instance.output_key)
122123

123124
# Pretty print if the stored output looks like JSON (likely from output_schema)

examples/python/snippets/agents/workflow-agents/loop-agent-doc-improv-agent.py renamed to examples/python/snippets/agents/workflow-agents/loop_agent_doc_improv_agent.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
APP_NAME = "doc_writing_app"
99
USER_ID = "dev_user_01"
1010
SESSION_ID = "session_01"
11-
GEMINI_MODEL = "gemini-2.0-flash-001"
11+
GEMINI_MODEL = "gemini-2.0-flash-exp"
1212

1313
# --- State Keys ---
1414
STATE_INITIAL_TOPIC = "quantum physics"
@@ -55,12 +55,12 @@
5555

5656
# Agent Interaction
5757
def call_agent(query):
58-
content = types.Content(role='user', parts=[types.Part(text=query)])
59-
events = runner.run(user_id=USER_ID, session_id=SESSION_ID, new_message=content)
58+
content = types.Content(role='user', parts=[types.Part(text=query)])
59+
events = runner.run(user_id=USER_ID, session_id=SESSION_ID, new_message=content)
6060

61-
for event in events:
62-
if event.is_final_response():
63-
final_response = event.content.parts[0].text
64-
print("Agent Response: ", final_response)
61+
for event in events:
62+
if event.is_final_response():
63+
final_response = event.content.parts[0].text
64+
print("Agent Response: ", final_response)
6565

66-
call_agent("execute")
66+
call_agent("execute")

examples/python/snippets/agents/workflow-agents/parallel_agent_web_research.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
APP_NAME = "parallel_research_app"
99
USER_ID = "research_user_01"
1010
SESSION_ID = "parallel_research_session"
11-
GEMINI_MODEL = "gemini-2.0-flash-001"
11+
GEMINI_MODEL = "gemini-2.0-flash-exp"
1212

1313
# --- Define Researcher Sub-Agents ---
1414

examples/python/snippets/agents/workflow-agents/sequential-agent-code-development-agent.py renamed to examples/python/snippets/agents/workflow-agents/sequential_agent_code_development_agent.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
APP_NAME = "code_pipeline_app"
99
USER_ID = "dev_user_01"
1010
SESSION_ID = "pipeline_session_01"
11-
GEMINI_MODEL = "gemini-2.0-flash-001"
11+
GEMINI_MODEL = "gemini-2.0-flash-exp"
1212

1313
# --- 1. Define Sub-Agents for Each Pipeline Stage ---
1414

@@ -77,12 +77,12 @@
7777

7878
# Agent Interaction
7979
def call_agent(query):
80-
content = types.Content(role='user', parts=[types.Part(text=query)])
81-
events = runner.run(user_id=USER_ID, session_id=SESSION_ID, new_message=content)
80+
content = types.Content(role='user', parts=[types.Part(text=query)])
81+
events = runner.run(user_id=USER_ID, session_id=SESSION_ID, new_message=content)
8282

83-
for event in events:
84-
if event.is_final_response():
85-
final_response = event.content.parts[0].text
86-
print("Agent Response: ", final_response)
83+
for event in events:
84+
if event.is_final_response():
85+
final_response = event.content.parts[0].text
86+
print("Agent Response: ", final_response)
8787

88-
call_agent("perform math addition")
88+
call_agent("perform math addition")

examples/python/snippets/get-started/google_search_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# A unique name for the agent.
66
name="basic_search_agent",
77
# The Large Language Model (LLM) that agent will use.
8-
model="gemini-2.0-flash",
8+
model="gemini-2.0-flash-exp",
99
# A short description of the agent's purpose.
1010
description="Agent to answer questions using Google Search.",
1111
# Instructions to set the agent's behavior.

examples/python/snippets/get-started/multi_tool_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_current_time(city: str) -> dict:
5757

5858
root_agent = Agent(
5959
name="weather_time_agent",
60-
model="gemini-2.0-flash",
60+
model="gemini-2.0-flash-exp",
6161
description=(
6262
"Agent to answer questions about the time and weather in a city."
6363
),

0 commit comments

Comments
 (0)