当前位置: 首页 > news >正文

index: 自动化浏览器智能体

GitHub:https://github.com/lmnr-ai/index

更多AI开源软件:https://www.aiinn.cn/

在做浏览器自动化脚本时,我们常常需要编写大量代码来处理复杂的网页交互,不仅耗时耗力,还难以调试和优化,要是出错更是难以精准定位问题所在。

主要功能

Index 是一款先进的开源浏览器代理,能够自主地在网络上执行复杂任务。

  • 它由 Claude 3.7 Sonnet 驱动,具有扩展性思维。未来将支持更多模型。
  • Index 还提供托管 API 服务。
  • 您还可以尝试通过托管 UI 或完全自托管 UI 来使用 Index。
  • 支持由 Laminar 提供的先进浏览器代理可观察性。

安装和使用

安装 Laminar
pip install lmnr
通过 API 使用 Index
from lmnr import Laminar, AsyncLaminarClient
# you can also set LMNR_PROJECT_API_KEY environment variable# Initialize tracing
Laminar.initialize(project_api_key="your_api_key")# Initialize the client
client = AsyncLaminarClient(api_key="your_api_key")async def main():# Run a taskresponse = await client.agent.run(prompt="Navigate to news.ycombinator.com, find a post about AI, and summarize it")# Print the resultprint(response.result)if __name__ == "__main__":asyncio.run(main())

当您通过 API 调用 Index 时,您会自动在 Laminar 平台上获得完整的浏览器代理可观察性。详细了解 Index 浏览器可观测性。

本地快速入门
安装依赖项
pip install lmnr-index# Install playwright
playwright install chromium
运行代理
import asyncio
from index import Agent, AnthropicProviderasync def main():# Initialize the LLM providerllm = AnthropicProvider(model="claude-3-7-sonnet-20250219",enable_thinking=True, thinking_token_budget=2048)# Create an agent with the LLMagent = Agent(llm=llm)# Run the agent with a taskoutput = await agent.run(prompt="Navigate to news.ycombinator.com, find a post about AI, and summarize it")# Print the resultprint(output.result)if __name__ == "__main__":asyncio.run(main())

实战演习

场景1:流式传输代理的输出
from index import Agent, AnthropicProvideragent = Agent(llm=AnthropicProvider(model="claude-3-7-sonnet-20250219"))  # Stream the agent's output
async for chunk in agent.run_stream(prompt="Navigate to news.ycombinator.com, find a post about AI, and summarize it"):print(chunk)
场景2:启用浏览器代理可观测性

要跟踪 Index 代理的作并记录浏览器会话,您只需在运行代理之前初始化 Laminar 跟踪。

from lmnr import LaminarLaminar.initialize(project_api_key="your_api_key")

然后,您将获得与 Laminar 平台中的浏览器会话同步的代理作的完全可观察性。

​​

场景3:使用远程 CDP URL 运行
import asyncio
from index import Agent, AnthropicProvider, BrowserConfigasync def main():# Configure browser to connect to an existing Chrome DevTools Protocol endpointbrowser_config = BrowserConfig(cdp_url="<cdp_url>")# Initialize the LLM providerllm = AnthropicProvider(model="claude-3-7-sonnet-20250219", enable_thinking=True, thinking_token_budget=2048)# Create an agent with the LLM and browseragent = Agent(llm=llm, browser_config=browser_config)# Run the agent with a taskoutput = await agent.run(prompt="Navigate to news.ycombinator.com and find the top story")# Print the resultprint(output.result)if __name__ == "__main__":asyncio.run(main())
场景4:自定义浏览器窗口大小
import asyncio
from index import Agent, AnthropicProvider, BrowserConfigasync def main():# Configure browser with custom viewport sizebrowser_config = BrowserConfig(viewport_size={"width": 1200, "height": 900})# Initialize the LLM providerllm = AnthropicProvider(model="claude-3-7-sonnet-20250219")# Create an agent with the LLM and browseragent = Agent(llm=llm, browser_config=browser_config)# Run the agent with a taskoutput = await agent.run("Navigate to a responsive website and capture how it looks in full HD resolution")# Print the resultprint(output.result)if __name__ == "__main__":asyncio.run(main())
http://www.xdnf.cn/news/8821.html

相关文章:

  • 【 图像梯度处理,图像边缘检测】图像处理(OpenCv)-part6
  • HarmonyOS 基础语法概述 UI范式
  • 双击热备方案及不同方案的需求、方案对比
  • hive的基础配置优化与数仓流程
  • GitHub Copilot在产品/安全团队中的应用实践:处理Markdown、自动化报告与电子表格、使用CLI命令等
  • leetcode0145. 二叉树的后序遍历-easy
  • AutoSAR从概念到实践系列之MCAL篇(一)——MCAL架构及其模块详解
  • 手撕数据结构算法OJ——栈和队列
  • eNSP无法启动AR报错码40,而且按照eNSP帮助手册排查都没用,我的处理方法【自己存档版】
  • 2N60-ASEMI功业控制与自动化专用2N60
  • python中,处理多分类时,模型之间的参数设置
  • sort和swap函数
  • 数据结构之稀疏矩阵与三元组表示法
  • 23种设计模式全面解析
  • 告别Feign:基于Spring 6.1 RestClient构建高可靠声明式HTTP客户端
  • 今日多肽之——订书肽
  • Linux文件类型
  • 建筑科技的未来图景:探究中建海龙的创新基因
  • C语言超详细结构体知识
  • 工程化实践:Flutter项目结构与规范
  • 广东中级消防设施操作员理论考试精选题
  • SpringAI+DeepSeek大模型应用开发——5 ChatPDF
  • 相比其他缓存/内存数据库(如 Memcached, Ehcache 等),Redis 在微服务环境中的优势和劣势是什么?
  • 【RK3588 嵌入式图形编程】-SDL2-扫雷游戏-结束和重新开始游戏
  • string函数的应用
  • Python 写生成 应用商店(2025版) 网页 方便收集应用 ,局域网使用
  • 极狐GitLab 外部授权控制机制是怎样的?
  • 【前端知识】今天聊一聊web的事件机制
  • SpringBoot学习(properties、yml(主流)、yaml格式配置文件)(读取yml配置文件的3种方式)(详解)
  • Kafka消费者端重平衡流程