--- title: Mastra | Lightcone description: Use Lightcone browser actions as tools in Mastra AI agents. --- Use Lightcone with [Mastra](https://mastra.ai), a TypeScript framework for building AI agents, workflows, and RAG pipelines. ## Install Terminal window ``` npm install mastra @tzafon/lightcone ``` ## Example ``` import { Agent } from "mastra"; import Lightcone from "@tzafon/lightcone"; const lightcone = new Lightcone(); const browseWebTool = { name: "browse_web", description: "Visit a URL, interact with the page, and take a screenshot", parameters: { url: { type: "string" as const, description: "URL to visit" }, }, execute: async ({ url }: { url: string }) => { const computer = await lightcone.computers.create({ kind: "browser" }); const id = computer.id!; await lightcone.computers.navigate(id, { url }); const result = await lightcone.computers.screenshot(id); await lightcone.computers.delete(id); return { screenshot: result.result?.screenshot_url }; }, }; const agent = new Agent({ name: "Web Researcher", instructions: "You are a helpful assistant that can browse the web.", model: { provider: "OPEN_AI", name: "gpt-4o" }, tools: { browse_web: browseWebTool }, }); const response = await agent.generate( "Visit https://news.ycombinator.com and describe the top stories" ); console.log(response.text); ``` ## How it works Mastra agents use tools to interact with external systems. Lightcone’s browser actions are wrapped as Mastra tools. When the agent decides it needs to visit a web page, it calls the tool, which creates a browser session, performs actions, and returns results. ## Resources - [Mastra documentation](https://mastra.ai/docs) - [Mastra GitHub](https://github.com/mastra-ai/mastra) ## See also - [**Vercel AI SDK**](/integrations/vercel-ai/index.md) — another TypeScript AI framework with Lightcone - [**LangChain**](/integrations/langchain/index.md) — Python and TypeScript agent tools - [**Computers**](/guides/computers/index.md) — direct browser control API