File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
examples/python/snippets/tools/built-in-tools Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ to use built-in tools with other tools by using multiple agents:
117
117
instruction="""
118
118
You're a specialist in Code Execution
119
119
""",
120
- tools=[ BuiltInCodeExecutor] ,
120
+ code_executor= BuiltInCodeExecutor() ,
121
121
)
122
122
root_agent = Agent(
123
123
name="RootAgent",
@@ -203,7 +203,8 @@ to use built-in tools with other tools by using multiple agents:
203
203
name="RootAgent",
204
204
model="gemini-2.0-flash",
205
205
description="Root Agent",
206
- tools=[custom_function, BuiltInCodeExecutor], # <-- BuiltInCodeExecutor not supported when used with tools
206
+ tools=[custom_function],
207
+ code_executor=BuiltInCodeExecutor() # <-- not supported when used with tools
207
208
)
208
209
```
209
210
@@ -243,7 +244,7 @@ is **not** currently supported:
243
244
instruction="""
244
245
You're a specialist in Code Execution
245
246
""",
246
- tools=[ BuiltInCodeExecutor] ,
247
+ code_executor= BuiltInCodeExecutor() ,
247
248
)
248
249
root_agent = Agent(
249
250
name="RootAgent",
Original file line number Diff line number Diff line change 41
41
session_service = InMemorySessionService ()
42
42
session = asyncio .run (session_service .create_session (
43
43
app_name = APP_NAME , user_id = USER_ID , session_id = SESSION_ID
44
- ))
45
- runner = Runner (agent = code_agent , app_name = APP_NAME , session_service = session_service )
46
-
44
+ )
45
+ runner = Runner (agent = code_agent , app_name = APP_NAME ,
46
+ session_service = session_service )
47
47
48
48
# Agent Interaction (Async)
49
49
async def call_agent_async (query ):
@@ -89,7 +89,8 @@ async def call_agent_async(query):
89
89
final_response_text = event .content .parts [0 ].text .strip ()
90
90
print (f"==> Final Agent Response: { final_response_text } " )
91
91
else :
92
- print ("==> Final Agent Response: [No text content in final event]" )
92
+ print (
93
+ "==> Final Agent Response: [No text content in final event]" )
93
94
94
95
except Exception as e :
95
96
print (f"ERROR during agent run: { e } " )
You can’t perform that action at this time.
0 commit comments