LangChain
Use Lightcone as a document loader and browser tool in LangChain agents.
Use Lightcone with LangChain as a document loader to extract web page content, or as a tool that gives LangChain agents the ability to browse the web.
Install
Section titled “Install”pip install langchain-tzafon tzafonnpm install @langchain/tzafon @tzafon/lightconeDocument loader
Section titled “Document loader”Load web page content into your LangChain pipeline:
from langchain_tzafon import TzafonLoader
loader = TzafonLoader( urls=["https://example.com", "https://example.com/about"], kind="browser",)
documents = loader.load()for doc in documents: print(doc.page_content[:200]) print(doc.metadata["url"])import { TzafonLoader } from "@langchain/tzafon";
const loader = new TzafonLoader({ urls: ["https://example.com", "https://example.com/about"], kind: "browser",});
const documents = await loader.load();for (const doc of documents) { console.log(doc.pageContent.slice(0, 200)); console.log(doc.metadata.url);}Browser tool for agents
Section titled “Browser tool for agents”Give a LangChain agent the ability to navigate and interact with web pages:
from langchain_tzafon import TzafonBrowserToolfrom langchain.agents import initialize_agent, AgentTypefrom langchain_openai import ChatOpenAI
tools = [TzafonBrowserTool()]
agent = initialize_agent( tools, ChatOpenAI(model="gpt-4o"), agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,)
result = agent.run("Go to news.ycombinator.com and tell me the top 3 stories")print(result)How it works
Section titled “How it works”- Document loader: Creates a Lightcone browser session, navigates to each URL, extracts the HTML content, and returns it as LangChain
Documentobjects with metadata (URL, title). - Browser tool: Wraps Lightcone actions (navigate, click, type, screenshot, and more) as LangChain tools that an agent can invoke during its reasoning loop.
Resources
Section titled “Resources”See also
Section titled “See also”- CrewAI — multi-agent workflows with browser tools
- Web scraping — scraping patterns that work with document loaders
- Computers — direct browser control without a framework