-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Haven't yet figured out how to configure this, though it's advertised as a one-line switch. I'd expect to be able to do something like this:
agent = stagehand.agent(
model="claude-sonnet-4-latest",
provider="anthropic",
options={
"apiKey": os.getenv("ANTHROPIC_API_KEY"),
},
)
based on https://docs.stagehand.dev/reference/agent
But this doesn't work, I get
Request failed with status 400: {"error":[{"path":"agentConfig","message":"Expected 'openai' | 'anthropic', received null"}]}
It also seems like you haven't added claude 4 models to https://github.com/browserbase/stagehand-python/blob/main/stagehand/agent/agent.py#L23C1-L25C3 yet?
Another nit: it seems like I have to both provide an apiKey
when initializing stagehand.agent, as well as when initializing Stagehand...
stagehand_config = StagehandConfig(
modelApiKey=os.getenv("OPENAI_API_KEY"),
# ...
)
stagehand = Stagehand(stagehand_config)
# ...
agent = stagehand.agent(
provider="openai", # seems optional?
model="computer-use-preview",
options={
"apiKey": os.getenv("OPENAI_API_KEY"),
},
)
Metadata
Metadata
Assignees
Labels
No labels