feat(crewai): add Stagehand code-mode MCP example - #2628
Conversation
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Confidence score: 5/5
- In
packages/integrations/examples/crewai/agent.py(build_stagehand_agentandrun_stagehand_agent), duplicating the default model literal while docs/smoke use a different model can cause config drift and confusing example behavior over time; centralize the default in one constant and align the docs/smoke reference to it.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/integrations/examples/crewai/agent.py">
<violation number="1" location="packages/integrations/examples/crewai/agent.py:49">
P3: The default LLM model string `openai/gpt-5-mini` is duplicated as a literal on both `build_stagehand_agent` and `run_stagehand_agent`, and the docs/smoke use a different literal (`openai/gpt-4o-mini`). Because there is no single source of truth, the default can drift between the two helpers and the examples. Consider hoisting it to a module-level constant (e.g. `DEFAULT_STAGEHAND_LLM`) used by both functions and referenced in the README, so the model name stays consistent.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| def build_stagehand_agent( | ||
| tools: Sequence[BaseTool], | ||
| llm: str | Any = "openai/gpt-5-mini", |
There was a problem hiding this comment.
P3: The default LLM model string openai/gpt-5-mini is duplicated as a literal on both build_stagehand_agent and run_stagehand_agent, and the docs/smoke use a different literal (openai/gpt-4o-mini). Because there is no single source of truth, the default can drift between the two helpers and the examples. Consider hoisting it to a module-level constant (e.g. DEFAULT_STAGEHAND_LLM) used by both functions and referenced in the README, so the model name stays consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/integrations/examples/crewai/agent.py, line 49:
<comment>The default LLM model string `openai/gpt-5-mini` is duplicated as a literal on both `build_stagehand_agent` and `run_stagehand_agent`, and the docs/smoke use a different literal (`openai/gpt-4o-mini`). Because there is no single source of truth, the default can drift between the two helpers and the examples. Consider hoisting it to a module-level constant (e.g. `DEFAULT_STAGEHAND_LLM`) used by both functions and referenced in the README, so the model name stays consistent.</comment>
<file context>
@@ -0,0 +1,64 @@
+
+def build_stagehand_agent(
+ tools: Sequence[BaseTool],
+ llm: str | Any = "openai/gpt-5-mini",
+) -> Agent:
+ return Agent(
</file context>
Why
The code-mode MCP should be proven through framework-native clients before the package is published. This layer ports the CrewAI draft beside the canonical Stagehand implementation so the Python adapter can be tested without waiting for a separate package release.
Stack
code_execute, executor, configuration, and runtime testsWhat changed
code_executeand uses the canonical Stagehand skill as agent guidanceE2E Test Matrix
dist/codemode/stdio-server.mjs.ruff format --checkandruff checkover the Python exampleSTAGEHAND_BROWSER=localcode_executeran twice; the second call observed the same page title and DOM marker; the adapter exited cleanly.STAGEHAND_BROWSER=browserbasecode_executeran twice against the same remote page and retained its DOM marker and title.code_executecalls; the second retained the remote page title and marker, and the agent returnedCREWAI_PERSISTENCE_PASS.Changeset
None. This adds a private example and test surface without changing a published package.