Index API

The easiest way to use Index in production is via the serverless API. Index API manages remote browser sessions, agent infrastructure and browser observability.

Getting Started

Installation

First, install the Laminar TypeScript SDK:

npm install @lmnr-ai/lmnr

Initialize Laminar with your project API key and create a client instance. You can also set the LMNR_PROJECT_API_KEY environment variable instead of passing it directly.

import { Laminar as L, LaminarClient } from '@lmnr-ai/lmnr';

// Initialize Laminar with your project API key
L.initialize({ projectApiKey: "YOUR_PROJECT_API_KEY" });

// Create a client instance
const client = new LaminarClient({
  projectApiKey: "YOUR_PROJECT_API_KEY",
});

Using Index Browser Agent

Basic Usage

To run a browser agent that performs tasks based on your prompt:

import { LaminarClient } from '@lmnr-ai/lmnr';

const client = new LaminarClient({
  projectApiKey: "YOUR_PROJECT_API_KEY",
});

// Execute a browser agent task
async function runBrowserAgent() {
  const response = await client.agent.run({
    prompt: "Search for the latest news about AI, find the most recent article, and summarize it.",
  });

  // Print the final result
  console.log(response.result.content);
}

runBrowserAgent();

Next Steps