> ## Documentation Index
> Fetch the complete documentation index at: https://tbd-6fc993ce-bmsaadat-fill-from-managed-auth.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Val Town

[Val Town](https://www.val.town/) is a serverless platform to run Typescript automations. You can think of it like Zapier for software developers.

Because Val Town can't launch a local browser, Kernel lets you use tools like Puppeteer, Playwright, or Stagehand on Val Town by connecting to a remote browser session hosted on Kernel's infrastructure.

## Quick start with Puppeteer

1. Create a free [Kernel account](https://dashboard.onkernel.com/sign-up) and generate an API key from Settings → API Keys
2. Remix the [Kernel Puppeteer val](https://www.val.town/x/kernel/puppeteer)
3. Add your `KERNEL_API_KEY` to the val's Environment Variables (left sidebar)
4. Click **Run**
5. View logs for output

## Quick start with Playwright

1. Remix the [Kernel Playwright val](https://www.val.town/x/kernel/playwright)
2. Add your `KERNEL_API_KEY` to Environment Variables
3. Set `TMPDIR` to `/tmp` to avoid Playwright file-system warnings
4. Click **Run**
5. Check the logs for output

## Quick start with Stagehand + Gemini

Run an autonomous browser agent powered by Gemini 2.5's computer use capabilities and [Stagehand](https://www.stagehand.dev/).

1. Remix the [Kernel Stagehand + Gemini val](https://www.val.town/x/kernel/stagehand-gemini)
2. Add the following to Environment Variables:
   * `KERNEL_API_KEY` — from [Kernel's API keys page](https://dashboard.onkernel.com/settings/api-keys)
   * `GOOGLE_API_KEY` — from [Google AI Studio](https://aistudio.google.com/apikey)
3. Import `runAgent` into your val and call it with a task, starting URL, and timeout:

   ```ts theme={null}
   const result = await runAgent(
     "Find the top Hacker News story and summarize it",
     "https://news.ycombinator.com",
     120,
   );
   ```
4. The agent returns an object with a `success` status and a `message` containing the results.

## Quick start with a browser-loop agent

Run an autonomous Claude Sonnet 5 agent that switches between DOM tools (snapshot, find, click, fill, navigate, text) and computer-use tools (screenshot, pixel click, scroll, keyboard) in the same browser session.

1. Remix the [Kernel browser loop val](https://www.val.town/x/kernel/kernel-browser-loop)
2. Add the following to Environment Variables:
   * `KERNEL_API_KEY` — from your [Kernel dashboard](https://dashboard.onkernel.com/)
   * `ANTHROPIC_API_KEY` — from the [Anthropic Console](https://console.anthropic.com/settings/keys)
3. Run `check.ts` to verify package compatibility and authenticate both APIs
4. Run `main.ts` to execute the agent
5. Watch the live-view URL logged at startup and review the tool trace in Logs
