Repository navigation
browser use Integration
weego edited this page May 28, 2026
·
1 revision
The browser-use package can be wrapped as a LightAgent tool for browser-based data collection.
Use browser automation when no direct API is available, page interaction is required, or data is only visible after navigation. Prefer direct API tools when possible.
pip install browser-use langchain-openaibrowser-use 0.11 and newer may expect the LangChain LLM object to expose a provider attribute. Use this helper when needed:
def ensure_browser_use_provider(llm, provider: str = "openai"):
if hasattr(llm, "provider"):
return llm
try:
setattr(llm, "provider", provider)
except Exception:
object.__setattr__(llm, "provider", provider)
return llmimport os
from browser_use import Agent
from langchain_openai import ChatOpenAI
async def fetch_data_with_browser(task_description: str) -> str:
llm = ensure_browser_use_provider(ChatOpenAI(
model=os.getenv("BROWSER_USE_MODEL", "gpt-4.1-mini"),
api_key=os.getenv("OPENAI_API_KEY"),
base_url=os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1"),
))
browser_agent = Agent(
task=task_description,
llm=llm,
use_vision=False,
)
result = await browser_agent.run()
return result.final_result()Attach tool_info and pass it as a normal LightAgent tool.
- Keep browser tasks narrow and explicit.
- Use environment variables for keys.
- Expect browser tasks to be slower than API calls.
- Avoid letting arbitrary users describe unrestricted browser actions.
- Log task metadata, not secrets.
Reference example: example/08.browser_use.py.
LightAgent Wiki - see the repository, releases, and issues.
- Installation and Your First Agent
- Tools and Integrations
- Memory, Sessions, and RAG
- Workflows and Multiple Agents
- Agent Backends and Codex
- Durable Execution, Jobs, and Subagents
- Safety, Observability, and Evaluation
- Usage, Cost Estimates, and Budgets
- Deployment, Migration, and Verification
- 安装与第一个 Agent
- 工具和集成
- 记忆、会话与 RAG
- 工作流与多 Agent
- 执行后端与 Codex
- 持久执行、Jobs 与 Subagents
- 安全、观测与评测
- 用量统计、费用估算与预算
- 部署、升级与验收
- Quick Start
- Core Concepts
- API Reference
- Examples Cookbook
- Migration Guide
- Tools
- Tool Generator
- Memory
- MCP
- Skills
- LightFlow
- Tree of Thought
- Self-Learning
- Multi-Agent
- Tracing and Debugging
- Langfuse Observability
- Model Providers
- browser-use Integration
- Testing and CI
- Deployment Guide
- Architecture
- Security
- Known Limitations
- FAQ
- FAQ 中文
- Roadmap
- Release Process
- Contributing