|
31 | 31 | from google.adk.agents import loop_agent |
32 | 32 | from google.adk.events import event as event_lib |
33 | 33 | from google.adk.models import google_llm |
| 34 | +from google.adk.planners import built_in_planner |
34 | 35 | from google.adk.tools import base_tool |
35 | 36 | from google.genai import types |
| 37 | +from retry import api as retry |
36 | 38 |
|
37 | 39 |
|
38 | 40 | class EnvResponse(Protocol): |
@@ -134,6 +136,11 @@ def _adk_agent( |
134 | 136 | model=model or 'gemini-2.5-flash', |
135 | 137 | retry_options=_default_retry_options(), |
136 | 138 | ), |
| 139 | + planner=built_in_planner.BuiltInPlanner( |
| 140 | + thinking_config=types.ThinkingConfig( |
| 141 | + thinking_budget=-1, include_thoughts=False |
| 142 | + ) |
| 143 | + ), |
137 | 144 | instruction=instruction, |
138 | 145 | tools=tools, |
139 | 146 | generate_content_config=types.GenerateContentConfig( |
@@ -173,11 +180,17 @@ async def _run_async_impl(self, ctx: Any) -> Any: |
173 | 180 | return |
174 | 181 |
|
175 | 182 | if last_event.content and last_event.content.parts: |
176 | | - next_message = last_event.content.parts[-1].text |
| 183 | + next_message = '\n\n'.join([p.text for p in last_event.content.parts]) |
177 | 184 | else: |
178 | 185 | logging.warn('Empty content with event=%s', last_event) |
179 | 186 | next_message = '' |
180 | | - env_response = self.env.step(types.Part(text=next_message)) |
| 187 | + env_response = retry.retry_call( |
| 188 | + self.env.step, |
| 189 | + fargs=(types.Part(text=next_message),), |
| 190 | + tries=3, |
| 191 | + delay=2, |
| 192 | + backoff=2, |
| 193 | + ) |
181 | 194 |
|
182 | 195 | output_event = event_lib.Event( |
183 | 196 | content=types.Content( |
|
0 commit comments