diff --git a/docs/tools/built-in-tools.md b/docs/tools/built-in-tools.md index 3467b0bd2..1186908f9 100644 --- a/docs/tools/built-in-tools.md +++ b/docs/tools/built-in-tools.md @@ -119,7 +119,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", @@ -206,7 +206,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 ) ``` @@ -246,7 +246,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..853c54d91 100644 --- a/examples/python/snippets/tools/built-in-tools/code_execution.py +++ b/examples/python/snippets/tools/built-in-tools/code_execution.py @@ -26,10 +26,10 @@ GEMINI_MODEL = "gemini-2.0-flash" # Agent Definition -code_agent = LlmAgent( +code_agent = Agent( 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,7 +39,7 @@ # Session and Runner session_service = InMemorySessionService() -session = session_service.create_session( +session = await 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)