Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

stagehand tool#277

Merged
lucasgomide merged 19 commits intocrewAIInc:mainfrom
filip-michalsky:fm/stagehand-python-tool
May 10, 2025
Merged

stagehand tool#277
lucasgomide merged 19 commits intocrewAIInc:mainfrom
filip-michalsky:fm/stagehand-python-tool

Conversation

@filip-michalsky
Copy link
Contributor

@filip-michalsky filip-michalsky commented Apr 20, 2025

Integration of Stagehand Python SDK with CrewAI

https://pypi.org/project/stagehand-py/

@filip-michalsky filip-michalsky marked this pull request as ready for review April 20, 2025 16:13
@lucasgomide
Copy link
Contributor

@filip-michalsky could you share a video showing this tool working?

@filip-michalsky
Copy link
Contributor Author

@filip-michalsky could you share a video showing this tool working?

Hey @lucasgomide - absolutely!

Here is a video of the Stagehand tool powering atomic browsing commands for CrewAI web research agent:

https://screen.studio/share/1HTuXVvs

please let me know if you have any other questions for this PR?

Copy link
Contributor

@lucasgomide lucasgomide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! I liked that..

I drop a few comments, let me know what you think

@filip-michalsky
Copy link
Contributor Author

@lucasgomide the feedback was addressed - is this good to merge? Thanks so much!

@lucasgomide
Copy link
Contributor

@filip-michalsky Just double-checking it’s important that we support both ways of using StagehandTool: with a context manager and without one.
The documentation currently says it’s only usable without a context manager, but we’re actually supporting usage like this:

# Using as a context manager
with StagehandTool() as tool:
    Agent(tools=[tool])
# Manual management
tool = StagehandTool()
try:
    Agent(tools=[tool])
finally:
    tool.close()

Just update the documentation by adding we can use with context manager also

@filip-michalsky
Copy link
Contributor Author

@lucasgomide this was updated as well!

@filip-michalsky
Copy link
Contributor Author

@lucasgomide thanks for the approval! I see there are other tools not related to stagehand failing in the CI - how should we address so that this can be merged? I am happy to try to help but I am not familiar with the other tools that much

@lucasgomide
Copy link
Contributor

lucasgomide commented May 9, 2025

@filip-michalsky Add it into your pyproject.toml

[project.optional-dependencies]
.... 
# added it after mcp 
stagehand = [
    "stagehand-py>=0.3.6",
]

then run uv sync and then push that!

@lucasgomide
Copy link
Contributor

@filip-michalsky something weird is happing with your tests.. I gonna checkout later and fix it

@filip-michalsky
Copy link
Contributor Author

thank you @lucasgomide !

@filip-michalsky
Copy link
Contributor Author

@lucasgomide i have been trying to fix the tests. in isolation uv run pytest tests/tools/stagehand_tool_test.py -vv

the tests work, but the module mocking is when running the whole test suite is failing...
uv run pytest tests/tools/ -vv`
I have been trying to fix this but no luck thus far

@lucasgomide lucasgomide merged commit 5a5eaad into crewAIInc:main May 10, 2025
1 check passed
mplachta pushed a commit to mplachta/crewAI-tools that referenced this pull request Aug 27, 2025
* stagehand tool

* update import paths

* updates

* improve example

* add tests

* revert init

* imports

* add context manager

* update tests

* update example to run again

* update context manager docs

* add to pyproject.toml and run uv sync

* run uv sync

* update lazy import

* update test mock

* fixing tests

* attempt to fix tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants