Fix `executionModel` propagation on agent
why
When passing an executionModel to agent (for LLM-powered tools -- act, extract...) from a different provider than the one for the model provided in the Stagehand constructor, or in the AgentConfig, API keys are not propagating properly and causing errors in non-local environments
The root cause is the execution model was being passed as a string, and its respective API key doesn't propagate if explicitly defined. Unnoticeable if the API key for each provider is exported or in .env, since we automatically pull when none is specified. This issue doesn't express itself if the different models share the same provider.
what changed
test plan
Summary by cubic
Fix executionModel propagation by accepting either a string or AgentModelConfig across agent tools and the handler, and normalizing model names for correct resolution, API key usage, and telemetry.
- Refactors
- Added extractModelName; used in resolveModel and telemetry model logging.
- Updated act, extract, fillForm tools, tool options, and V3AgentHandler to accept executionModel: string | AgentModelConfig.
- In V3, pass executionModel (or fallback to model) directly to the handler and use extractModelName for the logged model.
- Added tests covering tool propagation, fallback logic, and model utils (extractModelName, resolveModel).