diff --git a/docs/tools/built-in-tools.md b/docs/tools/built-in-tools.md index 03ef4a6f7..41fb2c2e5 100644 --- a/docs/tools/built-in-tools.md +++ b/docs/tools/built-in-tools.md @@ -117,7 +117,7 @@ to use built-in tools with other tools by using multiple agents: instruction=""" You're a specialist in Code Execution """, - code_executor=[BuiltInCodeExecutor], + code_executor=BuiltInCodeExecutor(), ) root_agent = Agent( name="RootAgent", @@ -204,7 +204,7 @@ to use built-in tools with other tools by using multiple agents: model="gemini-2.0-flash", description="Root Agent", tools=[custom_function], - executor=[BuiltInCodeExecutor] # <-- not supported when used with tools + code_executor=BuiltInCodeExecutor() # <-- not supported when used with tools ) ``` @@ -244,7 +244,7 @@ is **not** currently supported: instruction=""" You're a specialist in Code Execution """, - executor=[BuiltInCodeExecutor], + code_executor=BuiltInCodeExecutor(), ) root_agent = Agent( name="RootAgent", diff --git a/examples/python/snippets/tools/built-in-tools/code_execution.py b/examples/python/snippets/tools/built-in-tools/code_execution.py index 0dc525b1e..e1b7b7750 100644 --- a/examples/python/snippets/tools/built-in-tools/code_execution.py +++ b/examples/python/snippets/tools/built-in-tools/code_execution.py @@ -29,7 +29,7 @@ code_agent = LlmAgent( name=AGENT_NAME, model=GEMINI_MODEL, - executor=[BuiltInCodeExecutor], + code_executor=BuiltInCodeExecutor(), instruction="""You are a calculator agent. When given a mathematical expression, write and execute Python code to calculate the result. Return only the final numerical result as plain text, without markdown or code blocks. @@ -39,9 +39,9 @@ # Session and Runner session_service = InMemorySessionService() -session = session_service.create_session( +session = asyncio.run(session_service.create_session( app_name=APP_NAME, user_id=USER_ID, session_id=SESSION_ID -) +)) runner = Runner(agent=code_agent, app_name=APP_NAME, session_service=session_service)