Skip to content

BuiltInCodeExecutor is not working #898

@BugsBunnyWanders

Description

@BugsBunnyWanders

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
BuiltInCodeExecutor when imported from from google.adk.code_executors and added inside Agent declaration like below:
code_agent = LlmAgent(
name=AGENT_NAME,
model=GEMINI_MODEL,
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.
""",
description="Executes Python code to perform calculations.",
)
Its throwing the error: Extra inputs are not permitted [type=extra_forbidden, input_value=[<class 'google.adk.code_...r.BuiltInCodeExecutor'>], input_type=list]
For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden

To Reproduce
Steps to reproduce the behavior:

  1. Install google-adk
  2. Import BuiltInCodeExecutor from google.adk.code_executors and use it like mentioned in the description
  3. Compile and Run
  4. See error

Expected behavior
There should be no errors and should be able to use BuiltInCodeExecutor as mentioned in the adk docs.

Screenshots

Image

Desktop (please complete the following information):

  • OS: Windows 11
  • Python version(python -V): 3.11.3
  • ADK version(pip show google-adk): 1.0.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions