Stagehand v3.0.5 的 AISdkClient Bug
问题描述:
Error executing agent task: No LLM API key or LLM Client configured
原因:
- Stagehand 源码中有两个
AISdkClient 类:
AISdkClient(第 16183 行):有 getLanguageModel() 方法
AISdkClient2(第 39244 行):没有 getLanguageModel() 方法
- 包导出的是
AISdkClient2:AISdkClient: () => AISdkClient2
- Agent 内部需要调用
llmClient.getLanguageModel() 但方法不存在
解决方案(临时 Workaround):
// 手动添加缺失的方法
if (!llmClient.getLanguageModel) {
(llmClient as any).getLanguageModel = () => model;
}