# Agent.python\_executor in Web Browser Automation

**URL:** <https://discuss.huggingface.co/t/agent-python-executor-in-web-browser-automation/147640>\
**Category:** Beginners\
**Created:** [March 27, 2025, 8:33am UTC](https://discuss.huggingface.co/t/agent-python-executor-in-web-browser-automation/147640 "2025-03-27T08:33:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgaleev](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tgaleev](https://discuss.huggingface.co/u/tgaleev)\
**Post date:** [March 27, 2025, 8:33am UTC](https://discuss.huggingface.co/t/agent-python-executor-in-web-browser-automation/147640/1 "2025-03-27T08:33:00Z")

</div>

I’m experiencing an issue with the `agent.python_executor` function in SmolAgents. When I try to run the following code:

```auto
agent.python_executor("from helium import *", agent.state)

```

I get the error:

```auto
TypeError: LocalPythonExecutor. __call__ () takes 2 positional arguments but 3 were given

```

I’m following the example from the official documentation ([Web Browser Automation with Agents 🤖🌐](https://huggingface.co/docs/smolagents/examples/web_browser)), but I’m still getting this error.

I’ve checked the versions of my dependencies, including SmolAgents and Helium, and they are up to date. I’ve also reviewed my code and can’t find any issues with the logic.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 27, 2025, 12:33pm UTC](https://discuss.huggingface.co/t/agent-python-executor-in-web-browser-automation/147640/2 "2025-03-27T12:33:35Z")

</div>

It seems that the function specifications have changed without notice…😅

```py
#agent.python_executor("from helium import *", agent.state)
agent.python_executor("from helium import *")

```

> <https://github.com/huggingface/smolagents/blob/v1.12.0/src/smolagents/local_python_executor.py#L1433>

> <https://github.com/huggingface/smolagents/blob/v1.12.0/src/smolagents/agents.py#L1139>

---

<div class="post-metadata">

**Author:** ![tgaleev](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tgaleev](https://discuss.huggingface.co/u/tgaleev)\
**Post date:** [March 27, 2025, 1:28pm UTC](https://discuss.huggingface.co/t/agent-python-executor-in-web-browser-automation/147640/3 "2025-03-27T13:28:20Z")

</div>

Thank you!
