Skip to main content

Documentation Index

Fetch the complete documentation index at: https://libretto.sh/docs/llms.txt

Use this file to discover all available pages before exploring further.

Install Libretto and run your first workflow end to end.

Agent prompt

Fetch and follow https://libretto.sh/start.md to set up Libretto and create a new browser automation.

Manual

Install Libretto into the Node.js package that contains your browser automations. Run Libretto commands with npx libretto from that package.
1

Choose a setup path

Decide whether you want to create a new Libretto package or add Libretto to an existing Node.js package.If you create a new package, choose where it should live and what it should be named. If you use an existing package, switch into that package directory before installing Libretto.
2

Option A: create a new Libretto package

From the directory where the new package should be created:
npm create libretto@latest
You can pass a package name directly:
npm create libretto@latest my-automations
This scaffolds a package, installs dependencies, runs setup, and downloads Chromium.
3

Option B: add Libretto to an existing package

From the existing package directory, add Libretto as a dependency and run setup:
npm install libretto zod
npx libretto setup
Then create a workflow file and run it with npx libretto run <path> --headless.
4

Create and run a smoke workflow

Create src/workflows/scrape-page.ts in the package you set up:
src/workflows/scrape-page.ts
import { workflow } from "libretto";
import { z } from "zod";

export default workflow(
  "scrape-page",
  {
    input: z.object({}),
    output: z.object({
      title: z.string(),
    }),
  },
  async ({ page }) => {
    await page.goto("https://example.com");
    const title = await page.title();
    console.log(`Page title: ${title}`);

    return { title };
  },
);
Run it headless:
npx libretto run src/workflows/scrape-page.ts --headless
This confirms your local setup works and shows the basic run loop.

Next: First workflow

Expand the smoke workflow into a minimal real workflow you can iterate on.