Skip to main content
sentinel
Works with existing Playwright tests

AI-powered Playwright.
Zero rewrites.

Sentinel adds natural language actions, self-healing locators, and autonomous agents to Playwright — without replacing it. One import, one extra method, your tests stay intact.

The problem with selectors

Every Playwright test is coupled to the DOM. When the UI changes — and it always does — tests break. Sentinel decouples your intent from the implementation.

Before — Plain Playwright

▌ typescripttest.spec.ts
// Plain Playwright — fragile selectors
await page.click('#email-input');
await page.fill('#email-input', 'user@example.com');
await page.click('button[type="submit"]');

// Every UI change breaks your tests.
// Find the new selector, update, repeat.

After — Sentinel

▌ typescripttest.spec.ts
// Sentinel — natural language, self-healing
await ai.act('fill the email field with user@example.com');
await ai.act('click the sign in button');

// Sentinel finds the element itself.
// When the UI changes, it re-discovers it automatically.

Three ways to adopt

01

Extend any page

sentinel.extend(page) adds AI methods to an existing Playwright Page. Zero test restructuring.

02

ai test fixture

import { test } from '@isoldex/sentinel/test' — the ai fixture works alongside page and browser.

03

Autonomous agent

sentinel.run(goal) takes over and completes multi-step flows without step-by-step scripting.

Path 1 — extend(page)

▌ typescriptscript.ts
import { chromium } from 'playwright';
import { expect } from '@playwright/test';
import { Sentinel, z } from '@isoldex/sentinel';

const browser = await chromium.launch();
const page = await browser.newPage();
const sentinel = new Sentinel({ apiKey: process.env.GEMINI_API_KEY! });
const ai = await sentinel.extend(page);

try {
  await page.goto('https://myapp.com');
  await ai.act('click the login button');
  await expect(page.locator('h1')).toBeVisible();
  const data = await ai.extract('get user name', z.object({ name: z.string() }));
  console.log(data.name);
} finally {
  await browser.close();
}

Path 2 — Playwright Test fixture

▌ typescriptplaywright.config.ts
// playwright.config.ts
import { defineConfig } from '@playwright/test';
import type { SentinelOptions } from '@isoldex/sentinel/test';

export default defineConfig<{ sentinelOptions: Partial<SentinelOptions> }>({
  use: {
    sentinelOptions: {
      apiKey: process.env.GEMINI_API_KEY!,
      locatorCache: true,
      headless: true,
    },
  },
});
▌ typescriptsearch.spec.ts
// search.spec.ts — install @playwright/test as well as Sentinel
import { test, expect } from '@isoldex/sentinel/test';
import { z } from '@isoldex/sentinel';

test('search and extract results', async ({ ai }) => {
  // ai manages its own browser page; use ai.page for Playwright locators.
  await ai.goto('https://news.ycombinator.com');
  const stories = await ai.extract(
    'Get the top 5 story titles and their point counts',
    z.object({ stories: z.array(z.object({ title: z.string(), points: z.number() })) })
  );
  expect(stories.stories).toHaveLength(5);
  expect(stories.stories[0].title).toBeTruthy();
});

Path 3 — Autonomous agent

▌ typescriptagent.ts
// Let the agent figure out the whole flow
const result = await sentinel.run(
  'Log in with credentials from env, navigate to settings, ' +
  'enable 2FA, and extract the backup codes',
  { maxSteps: 30 }
);

console.log(result.goalAchieved); // true
console.log(result.data);         // { backupCodes: [...] }

Plain Playwright vs. Sentinel

Sentinel is additive — it doesn't replace Playwright, it enhances it.

CapabilityPlain PlaywrightPlaywright + Sentinel
Element targetingCSS selectors / rolesNatural language
When UI changesTests break, manual fixSelf-healing — auto re-discovers
Dynamic pagesRequires knowing selectorsObserves + acts on what's visible
Shadow DOM / iframespartial✓
Autonomous multi-step✗yes (run() agent loop)
Data extractionRequires selectors + parsingextract() returns typed objects
Existing test migration—extend(page) — one line
Works with expect()✓yes — fully compatible
Cost per run—~$0.002 (Gemini Flash)
OpenTelemetry tracing✗✓

What you gain

🔁

Self-healing locators

Successful selectors are cached and reused. When the DOM changes, Sentinel re-discovers the element automatically — no manual fix needed.

💬

Natural language actions

Write what you want, not how to find it. act('click the checkout button') works regardless of the underlying selector.

🤖

Autonomous agent mode

run(goal) plans and executes multi-step flows without scripting each step. Handles unknown page states, dynamic content, and unexpected redirects.

📊

Typed data extraction

extract('get product name and price', schema) returns fully typed data — no selector hunting, no innerHTML parsing.

📡

OpenTelemetry tracing

Every AI action emits a span. Drop into Datadog, Grafana, or Jaeger to see exactly what Sentinel did, for how long, and at what cost.

💰

~$0.002 per run

Gemini Flash is 40× cheaper than GPT-4o. With self-healing locators and prompt caching, repeated runs cost effectively zero.

Add AI to Playwright in 5 minutes

One install. One import. Your existing tests stay exactly as they are.