# Inventory and policy check: a synthetic example

Version 1.0.0, October 16, 2026. Every record here is made up. This is a teaching format, not a Kosmoy connector, import format or export.

## Run it

You need Node.js 22 or newer. Put evaluate.mjs, inventory.json and sample-audit.json in one folder. Nothing to install; no credentials, network access or paid service.

```
node evaluate.mjs inventory.json > reproduced-audit.json
diff reproduced-audit.json sample-audit.json
```

If diff prints nothing, you reproduced the published result. On Windows Command Prompt, use `fc` instead of `diff`.

Five requests go in. One is allowed. Four are denied:

- the agent asks for a tool it is not allowed to use;
- the request costs more than the agent's remaining budget;
- the agent has no owner and was never approved;
- the agent's source was last seen 45 days ago, past the 7-day limit.

`input_sha256` is a SHA-256 hash of the parsed input (`JSON.stringify`), not of the file on disk, so `sha256sum inventory.json` gives a different value. It shows whether the input changed. It is not a signature and does not prove where a file came from.

## Break it

- Set the first agent's owner to null: its allowed request is now denied.
- Set a request's estimated_cost_cents to -1: validation fails instead of enlarging the budget.
- Set the first agent's status to "retired": none of its requests pass.
- Send a request from an agent ID that does not exist: it is denied.

## What it does not do

inventory.schema.json describes the file's shape. The script adds the rest: unique IDs, real calendar dates, no future sightings and the policy rules. If an edit breaks the file, the script prints one line naming the record and exits with an error. It handles requests one at a time, with cost estimates in whole cents. It does not reserve budget for concurrent calls, reconcile final usage, convert currencies, handle credentials, retry or store an audit trail. A production system has to do all of those.

## How this maps to the agent registry worksheet

The [agent registry worksheet](https://www.kosmoy.com/downloads/kosmoy-ai-agent-registry-template.xlsx) uses the same core fields under other names: Agent name → id, Owner → owner, Business purpose → purpose, Platform / runtime → source, Tools & APIs it can call → allowed_tools, Approved use case → status (approved or discovered). This example adds last_seen, budget_cents and spent_cents. It does not check the worksheet's risk tier, containment status or kill-switch path.

## Use the method on a real deployment

1. Agree on the agent IDs, owners, approvers and scope. Start with synthetic or anonymized records.
2. Test one connector: its API permissions, version, refresh interval and the fields it returns. Do not assume another platform behaves the same way.
3. Route one throwaway application through the AI Gateway. Record allowed and denied requests, and the fields the product actually exports, separately from this example.
4. Test failures, stale sources, exceptions, concurrent spend and rollback. Keep the gaps next to the results.
5. If you need runtime containment, deploy and test an Action Capsule separately. Registering an agent does not contain it.

The kosmoy.com build reruns this recipe and fails if the output changes. The example has not been run in a container, on Kubernetes or against a live Kosmoy deployment, and it is not a regulatory assessment.
