Skip to content
Dashboard
Integrations

Mastra

Use Lightcone browser actions as tools in Mastra AI agents.

Use Lightcone with Mastra, a TypeScript framework for building AI agents, workflows, and RAG pipelines.

Terminal window
npm install mastra @tzafon/lightcone
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);

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.

  • Vercel AI SDK — another TypeScript AI framework with Lightcone
  • LangChain — Python and TypeScript agent tools
  • Computers — direct browser control API