# AI use cases for Botscent (nalinbhardwaj/botscent)

Repo: [nalinbhardwaj/botscent](https://github.com/nalinbhardwaj/botscent) | Use cases: 4 | Page: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/

Botscent is a small open-source TypeScript and Python library that tells a site whether an AI agent, not a person, is browsing it and which agent it is.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Log which AI agents visit your site: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/log-ai-agent-visits/
- Let only verified AI agents through: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/allow-only-verified-agents/
- Change page content when an AI agent visits: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/adapt-pages-for-ai-agents/
- Check that Botscent is installed correctly: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/verify-botscent-install/

## How to log which AI agents visit your site with Botscent

Repo: [nalinbhardwaj/botscent](https://github.com/nalinbhardwaj/botscent) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Count visits by agent name so you can see agent traffic apart from people.

**Who it is for:** A site owner or analytics lead who cannot tell AI agent visits from human visits in current logs.

**The problem:** Agent traffic is mixed into normal analytics, so you cannot see which agents arrive or how often.

**The outcome:** A log entry for each request that records the agent name, or human, and the reasons, using the page verdict joined to the request's own verdict.

### Steps

1. Run `npm install botscent` in the project, or `pip install botscent` for a Python server.
2. Add the page half for your framework, following the Quickstart section for that framework.
3. Add the server half, for example `app.use(botscent())` in Express, or `export { proxy } from 'botscent/next'` in Next.js 16 or later.
4. Send the page verdict to your server with `reportHeaders` on same-origin requests, then join it with `combine(own, report)` on the server.
5. Run `npx botscent check https://your-site.example/` and confirm the server and page halves report pass.

### Prompt to paste into your agent

```text
Using the botscent repo (nalinbhardwaj/botscent), add agent visit logging to <site path>. Expected output: one log line per request with agent_name or human and the reasons. Verify that `npx botscent check https://<your-site>/` reports pass for both halves.
```

### Caveat

The page verdict comes from the visitor's browser, so use it to measure and adapt pages, not to make access decisions.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/log-ai-agent-visits/

## How to let only verified AI agents through with Botscent

Repo: [nalinbhardwaj/botscent](https://github.com/nalinbhardwaj/botscent) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Use Web Bot Auth verification so access decisions rely on signed requests, not names.

**Who it is for:** A site owner who wants to block unknown AI agents or give a named agent extra access, such as a higher rate limit.

**The problem:** A user-agent string or declared name is easy to fake, so blocking or allowing by name is unreliable.

**The outcome:** Request handlers that allow access only when the request's own verdict passes isVerified for the agent you choose.

### Steps

1. Install the server half for your framework, such as `import { botscent } from 'botscent/express'` followed by `app.use(botscent())`.
2. In the handler, read the request's own verdict with `await inspect(request)` from `botscent/server`.
3. Gate access with `isVerified(own, 'chatgpt')` for one named agent, or `isVerified(own)` for any verified agent.
4. Do not gate on `agent_name`, reasons or page reports, because those can be forged.
5. Run `npx botscent check https://your-site.example/` and confirm the server half reports pass.

### Prompt to paste into your agent

```text
Using the botscent repo (nalinbhardwaj/botscent), gate <route path> so only requests where isVerified(own, '<agent name>') is true get through. Expected output: verified requests pass and unsigned requests are refused. Verify with `npx botscent check https://<your-site>/` that the server half reports pass.
```

### Caveat

Named verification only works for agents whose keys are bundled in the installed release, so check the release before relying on a specific agent.

Risk, credentials: isVerified authenticates the operator's server, not the person or model in the session, and a captured signature can be replayed to the same host until it expires.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/allow-only-verified-agents/

## How to change page content when an AI agent visits with Botscent

Repo: [nalinbhardwaj/botscent](https://github.com/nalinbhardwaj/botscent) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Hide ads, simplify layout or adjust prices for agent visitors in the page itself.

**Who it is for:** A front-end developer whose site shows ads or long layouts that are not useful to AI agents.

**The problem:** Agents receive the same page as people, including ad blocks and layout that slow or confuse them.

**The outcome:** A page that renders a simpler version when the page verdict is agent, while people see the normal page.

### Steps

1. Install the package with `npm install botscent`.
2. Add the page half for your framework, for example `import 'botscent/auto'` in `instrumentation-client.ts` for Next.js 15.3 or later.
3. In the component, call `useBotscent()` from `botscent/react` and branch on the verdict type.
4. Hide the ad or simplify the layout only when the verdict type is agent.
5. Run `npx botscent check https://your-site.example/` and confirm the page half reports pass.

### Prompt to paste into your agent

```text
Using the botscent repo (nalinbhardwaj/botscent), change <component path> to hide ads when useBotscent() returns type agent. Expected output: the normal page for humans and a simplified page when the page verdict is agent. Verify with `npx botscent check https://<your-site>/` that the page half reports pass.
```

### Caveat

Use the page verdict to adapt content only, because it comes from the visitor's browser and can be forged.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/adapt-pages-for-ai-agents/

## How to check that Botscent is installed correctly with Botscent

Repo: [nalinbhardwaj/botscent](https://github.com/nalinbhardwaj/botscent) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Run one check against a live site to confirm both halves and the project setup work.

**Who it is for:** A developer who has just added Botscent and needs to confirm both halves work before trusting any verdict.

**The problem:** A half-installed setup returns wrong verdicts without any visible error.

**The outcome:** A pass, fail, unknown or skipped line for each check, with the likely cause and fix for any line that is not a pass.

### Steps

1. Install the package with `npm install botscent`, or `pip install botscent` for Python.
2. Add the page half and the server half for your framework from the Quickstart section.
3. Run `npx botscent check https://your-site.example/`.
4. Read each line. A line that is not a pass also gives the likely cause and the fix.
5. Use `--json` for scripts or `--report` for an issue. Exit code 0 means the install works, 1 means it is broken and 2 means neither half was confirmed.

### Prompt to paste into your agent

```text
Using the botscent repo (nalinbhardwaj/botscent), run `npx botscent check https://<your-site>/` in the project. Expected output: pass, fail, unknown or skipped for each check. Verify that the exit code is 0 and list the files you changed.
```

### Caveat

The check opens the page in a local Chrome that sets the webdriver flag, so the page half will report an agent during the check.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nalinbhardwaj-botscent/verify-botscent-install/
