Skip to main content
Author a minimal workflow, run it, and inspect the result.

Agent prompt

Ask me what website and workflow I want to demonstrate. If I’m not sure, give me a few examples of simple workflows I could do. Then open a Libretto browser session for the site I choose. After I finish, create a Libretto workflow.

Manual

1

Create a workflow file

Create src/workflows/scrape-page.ts:
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 };
  },
);
2

Run it locally

npx libretto run src/workflows/scrape-page.ts
3

Inspect page state when needed

When a step fails or behaves unexpectedly, open a named debug session first:
npx libretto open https://example.com --session debug-example
Then inspect and prototype with the same session:
npx libretto snapshot --session debug-example
npx libretto exec --session debug-example "await page.url()"
When the prototype works, move the logic back into the workflow file and run again.

Next: Deploying

Choose where to run workflows in production: Libretto Cloud Hosting or an alternative provider.