Skip to content

[BUG] Local python executor fails to run isinstance function #1474

@xavier-owkin

Description

@xavier-owkin

Describe the bug

The local python executor is unable to execute a code line involving the built-in isinstance function

Code to reproduce the error

from smolagents import CodeAgent

agent = CodeAgent(
    model=...,
    tools=[],
    verbosity_level=2,
    max_steps=5,
)

rep = agent.run("Run `isinstance(5, int)`")

Error logs (if any)

Code execution failed at line 'result = isinstance(5, int)' due to: TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

Expected behavior
The isinstance function should work correctly

Packages version:
1.18.0

Additional context
Of course the code runs well in my local terminal with python.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions