# Use Vigil with AI

> Ask the AI agent inside Vigil in plain language, or connect your own assistant such as Claude or Codex with an access token and one copy-and-paste prompt.

Source: https://vigilsecure.net/docs/setup/use-vigil-with-ai/

Vigil is built to be run with the help of AI. You ask in plain language, and an AI assistant
looks things up or does the routine work for you: checks who is on duty, requests a patrol,
adds a list of sites, builds a client report.

There are three ways to do this. Start with the first one. It needs no setup.

| Way                                | What you need                        | Good for                                                               |
| ---------------------------------- | ------------------------------------ | ---------------------------------------------------------------------- |
| **Ask the agent inside Vigil**     | Nothing. Every organization has one. | Everyday questions and jobs, and anything that should repeat by itself |
| **Connect your own AI assistant**  | An access token and one prompt       | Setting up many sites at once, and one-off reports at your desk        |
| **Give any AI this documentation** | A link                               | Learning how Vigil works and planning your setup                       |

## Ask the agent inside Vigil

Your organization already has an AI agent called **Operations**. Open **Communication** in
the console, or **Chats** on a device, start a chat with it and ask in plain language:

- "Who is signed in at Rosebank Mall right now?"
- "Which patrols were missed last night?"
- "Ask whoever is on site at the depot to check the back gate."
- "Invite thandi@example.co.za as an operator."

It answers in the chat, by text or by voice note, and is instructed to do only what you are
allowed to do yourself. You can also create agents of your own, with standing instructions
and schedules. See [Agents](https://vigilsecure.net/docs/concepts/agents.md).

This is the right choice for anything that should keep happening when your computer is off.

## Connect your own AI assistant

If you already use an AI assistant that can work on your computer, such as Claude Code,
Codex or Cursor, it can work with your Vigil organization for you. It acts as you, with your
permissions, and it asks before it changes anything.

There are three steps, and they take about five minutes.

### Step 1: Create an access token

An access token is a key that lets your assistant into Vigil as you, so you do not have to
sign in for it each time. Vigil's screens call it an API token.

1. Sign in to the console, open the account menu and choose **Account settings**, then
   **API tokens**.
2. Choose **Create token**.
3. Enter a **Name** that says what the token is for, such as `My AI assistant`.
4. Choose an **Expiration**: 7, 30, 90, 180 or 365 days. Start with a short one, such as 7
   or 30 days. You can always create another.
5. Choose **Create token**.
6. Under **Your token is ready**, choose **Copy token** and keep the value somewhere safe,
   such as a password manager. Vigil shows it once and cannot show it again.

### Step 2: Ask your assistant to set up Vigil for you

Open your assistant, then copy this prompt and paste it in:

```text wrap
Please set up Vigil for me. Vigil is the system my security company uses, at https://next.vigilsecure.net.

1. Install the Vigil skill from https://github.com/Tiental/vigil-skills so that you know how to work with Vigil.
2. I have a Vigil access token ready. Help me save it on this computer so that you can use it from now on. The Vigil address to save with it is https://next.vigilsecure.net/api/graphql. Do not ask me to paste the token into this chat. Show me where to put it instead.
3. Check that it works by telling me my name and which organizations I belong to in Vigil.

I am not technical. Explain each step in plain language, do as much as you can yourself, and ask me before you change anything in Vigil.
```

Your assistant then does the work:

- It installs the **Vigil skill**, a set of instructions Vigil publishes that teaches an
  assistant how to work with Vigil.
- It shows you where to put the token you copied in step 1.
- It tells you your name and your organizations, which shows that the connection works.

If a step fails, tell the assistant what you see on your screen and ask it to try another
way.

### Step 3: Ask it something

Ask in plain language, and mention Vigil so the assistant knows where to look:

- "Using Vigil, list our sites and how many beacons each one has."
- "From Vigil, summarise yesterday's gate traffic at the main gate: how many vehicles in
  and out, and any with an expired licence disc."
- "Add these twelve sites to Vigil from the spreadsheet in this folder."
- "Build a patrol report for Rosebank Mall for last week and publish it to Vigil."

### What your assistant can do

| Area                       | What your assistant can do                                                                       |
| -------------------------- | ------------------------------------------------------------------------------------------------ |
| **Chats and messages**     | Read and search chats, post a message, send a file or photo, ask one of your Vigil agents        |
| **Devices**                | See where devices are, their battery and signal, who is signed in, and what happened on a device |
| **Patrols**                | Request a patrol, follow the scans, and find missed checkpoints                                  |
| **Sign-ins and sign-outs** | Make a device ask for a sign-in, and sign a user out                                             |
| **The gate register**      | Read vehicles and people in and out, and who is still on site                                    |
| **Reports**                | Build a report, publish it as an [artifact](https://vigilsecure.net/docs/concepts/artifacts.md) and share it by link      |
| **Setup**                  | Add sites and geofence beacons, invite people                                                    |

Your assistant works when you ask it to. For work that should repeat without you, such as a
patrol every three hours, use an [agent inside Vigil](https://vigilsecure.net/docs/concepts/agents.md). Your
assistant can help you write that agent's instructions.

### Stay in control

- **The assistant is you.** Your token gives it everything your
  [roles](https://vigilsecure.net/docs/concepts/roles.md) allow, in every organization you belong to, and nothing
  more. If your roles change, the token changes with them.
- **It asks before changing things.** The Vigil skill tells the assistant to get your
  go-ahead before it posts a message, sends a patrol request or a device command, invites
  somebody or creates a public link. Read what it proposes.
- **Changes are real.** A patrol request sounds on a guard's device. Try things out in a
  test organization first.
- **Treat the token like a password.** Keep it out of chat messages, emails and
  screenshots.

> **Give an assistant its own account:** For an assistant that should only read, or only work in one organization, create a separate
> Vigil account for it, invite that account with a limited role, and create the token there.

### Check, replace or cancel a token

The **API tokens** page lists each token with its state (**Active**, **Expired** or
**Revoked**), its expiry date and when it was last used.

- **When a token expires**, create a new one and ask your assistant to replace the saved
  token with it, as in step 2.
- **To cut off access at once**, choose **Revoke** on the token. Everything that uses it
  stops straight away, and this cannot be undone. Signing out of the console does not
  revoke your tokens.

### Set it up by hand

If you are comfortable in a terminal, you can do what the prompt does yourself. You need
Node.js for the installer and Python 3 for the skill.

Install the skill:

```sh
npx skills add Tiental/vigil-skills
```

Then set two environment variables in the terminal where your assistant runs:

```sh
export VIGIL_API_URL="https://next.vigilsecure.net/api/graphql"
export VIGIL_API_TOKEN="vigil_pat_…"
```

The skill is open source and follows the open Agent Skills format.
[github.com/Tiental/vigil-skills](https://github.com/Tiental/vigil-skills) has the other
ways to install it, and [Developers](https://vigilsecure.net/docs/developers/make-your-first-api-request.md) covers
using the token in your own software.

## Give any AI this documentation

To ask an AI assistant how Vigil works, give it this documentation. For example, paste this
into ChatGPT, Claude or Gemini:

```text wrap
Read https://next.vigilsecure.net/llms-full.txt and then help me plan how to set up patrols for a shopping centre with three gates.
```

The documentation is published in three forms made for AI to read:

| Address                                       | What it is                                                                                    |
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [`/llms.txt`](https://vigilsecure.net/llms.txt)                      | A list of every documentation page with a one-line summary                                    |
| [`/llms-full.txt`](https://vigilsecure.net/llms-full.txt)            | The whole documentation in one plain-text file                                                |
| Any page with `.md` in place of the final `/` | That page as plain text, for example [`/docs/concepts/beacons.md`](https://vigilsecure.net/docs/concepts/beacons.md) |

## Which one should I use?

- A guard or supervisor needs an answer on shift: **the agent inside Vigil**.
- Something should happen every night without you: **an agent inside Vigil**, with a
  schedule in its instructions.
- You are setting up many sites, moving data in or out, or building a one-off report at
  your desk: **your own assistant**.
- You are evaluating Vigil or learning it: **the documentation**.

## Related

- [Agents](https://vigilsecure.net/docs/concepts/agents.md)
- [Skills](https://vigilsecure.net/docs/concepts/skills.md)
- [Frequently asked questions](https://vigilsecure.net/docs/faq.md#ai-agents-and-skills)
