# CrawlDex Stagehand Pack

Canonical: https://crawldex.com/agents/stagehand
Markdown: https://crawldex.com/agents/stagehand.md
Harness id: stagehand
Channel: adapter-stagehand

## Why this exists

Stagehand can use CrawlDex as a route gate so it does not start a brittle flow without blocker and user-presence context.

## When to call CrawlDex

Before calling `stagehand.page.act` on a public website task.

## Install or paste

```typescript
/*
No Stagehand PR merge is required. Install the CrawlDex reporter SDK directly:
npm install crawldex-report
export CRAWLDEX_CHANNEL=adapter-stagehand
*/

async function crawldexPreflight(site: string, task: string) {
  const response = await fetch("https://crawldex.com/api/v1/preflight", {
    method: "POST",
    headers: {
      "content-type": "application/json",
      "x-crawldex-channel": process.env.CRAWLDEX_CHANNEL ?? "adapter-stagehand"
    },
    body: JSON.stringify({
      site,
      task,
      agent_profile: { stack: "stagehand", browser_runtime: "playwright" }
    })
  });
  if (!response.ok) throw new Error("CrawlDex preflight failed");
  return response.json();
}

const preflight = await crawldexPreflight("netflix.com", "subscriptions.cancel");
if (!preflight.decision.should_attempt_autonomously) {
  throw new Error(preflight.agent_instruction);
}
```

## Preflight call

```bash
curl -sS -X POST https://crawldex.com/api/v1/preflight \
  -H "content-type: application/json" \
  -H "x-crawldex-channel: adapter-stagehand" \
  -d '{"site":"netflix.com","task":"subscriptions.cancel","agent_profile":{"stack":"browser-agent","browser_runtime":"chromium"}}'
```

## Report redacted outcome after eligible public work

Do not report private account data, payment data, messages, screenshots with sensitive content, tokens, cookies, raw traces, local files, or logged-in-only pages.

```bash
curl -sS -X POST https://crawldex.com/api/v1/runs \
  -H "content-type: application/json" \
  -H "x-crawldex-agent-key: $CRAWLDEX_AGENT_KEY" \
  -H "x-crawldex-channel: adapter-stagehand" \
  -d '{"site":"netflix.com","task":"subscriptions.cancel","outcome":"success_with_handoff","friction":["login_required"],"source_tier":"anonymous_report","evidence":{"artifact_types":["redacted_agent_report"]}}'
```
