> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oneshotagent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool watches

> Run a read-only tool on a schedule and be told when its answer changes

A tool watch repeats a read-only call every `every_minutes`. Its first answer is the baseline. Changed answers produce [watch](https://docs.oneshotagent.com/api-reference/watch.md) notifications and, with `webhook_url`, signed webhooks.

## What can be watched

* `web_read`: a page. `selection.text` watches the paragraph, or the section under a heading, that holds the text. `selection.regex` watches what the pattern matches (its groups when it has any). Without a selection, the whole page. At least every 5 minutes.
* A lookup that answers at once. A lookup of one entity compares its fields; `selection.path` narrows them. A search compares which results are listed. At least every 15 minutes, or longer when the source asks.

Tools with delayed results, such as social feeds, and physical-person lookups requiring a stated purpose for each call are refused. Input follows the tool's endpoint rules.

## Charges

Each successful check costs the tool's own price plus the check fee; each change also costs the change price ([Pricing](https://docs.oneshotagent.com/pricing.md)). A failed read is free. `max_spend` must cover a check and a possible change. A check runs only if credits and the remaining cap cover it plus a possible change; otherwise the watch pauses.

Five failed reads in a row stop the watch: `status` `stopped`, `stop_reason` `unreadable`. A stopped watch cannot be changed; delete it.

## Changes

Page changes show changed lines in `before` and `after`; lookup changes have `field`, `before` and `after`. Search changes use `field` `$list`: `before`/`after` are full membership counts; `added` results and `removed` identities each contain at most ten entries, not the complete delta.

## Goals

A goal pays from its budget and holds at most 5 watches; they stop when it ends or cannot pay. Changes send `watch_changed` only to a live session. Between recurring runs, no event fires and the baseline stays: a later check delivers a persisting change, but a reversion means no wake. An event count [done check](https://docs.oneshotagent.com/api-reference/compute/create.md) accepts `watch_changed`.

## Create

`source_tool` (`web_read` or a lookup name), `input` (the tool's input), `selection`, `every_minutes` (default: 15 or the source minimum, whichever is greater), `max_spend` and `webhook_url`. Leave out `entity_type`, `attribute` and `key`.

```bash cURL theme={null}
curl -X POST https://win.oneshotagent.com/v1/tools/watch \
  -H "Content-Type: application/json" \
  -H "X-Agent-ID: 0x..." \
  -H "X-Agent-Proof: <signed proof>" \
  -d '{
    "source_tool": "web_read",
    "input": {"url": "https://example.com/camps"},
    "selection": {"text": "Summer camp"},
    "every_minutes": 30,
    "max_spend": 1
  }'
```

```json 201 theme={null}
{
  "success": true,
  "data": {
    "id": "0c5e2f7a-3b1d-4e8a-9f60-1a2b3c4d5e6f",
    "source": "tool",
    "source_tool": "web_read",
    "input": {"url": "https://example.com/camps"},
    "selection": {"text": "Summer camp"},
    "every_minutes": 30,
    "checks": 0,
    "delivery": "notification",
    "status": "running",
    "stop_reason": null,
    "max_spend": 1,
    "spent": 0
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.