# Owners and mandates

Make sure no agent goes live without someone accountable for it, and give each agent a mandate, its purpose, success criteria, the systems it may call and its budget.

## No owner, no deploy

Publishing an agent (its card published, so people and other agents can reach it) when its registry entry names no owner is handled by `TICKETIQ_AGENT_PUBLISH_OWNER`:

| Mode | Effect |
| --- | --- |
| `assign` (default) | The person publishing becomes its owner, audited as `agent.publish.owner_assigned`. No agent is deployed unowned and nobody gains a step |
| `require` | The publish is refused with `422` until the registry entry names an owner (`agent.publish.unowned`) |
| `off` | No check at publish |

The owner is assigned only after the posture and red-team gates let the publish through, so a refused publish changes nothing. A version restore that publishes is handled the same way.

`TICKETIQ_REGISTRY_REQUIRE_OWNER` (default `false`) is separate: it refuses any registry save that leaves the entry without an owner.

## The mandate

A mandate says what the agent is for and the limits it works inside.

```json
PUT /api/governance/mandates/{agent}
{
  "purpose": "Answer IT questions from staff",
  "success_criteria": ["Resolved without a person", "Answered within 2 minutes"],
  "allowed_systems": ["jira", "servicenow"],
  "budget_usd": 200,
  "budget_period": "month"
}
```

| Field | What it does |
| --- | --- |
| `purpose`, `success_criteria` | What the agent is for and how its outcome is judged. Up to 10 criteria |
| `allowed_systems` | The MCP servers it may call. See below |
| `budget_usd`, `budget_period` | Saved as the agent's own [budget](/docs/ai-gateway/budgets) cap when it has none, or a looser one over the same period. A tighter cap, or one over another period, is kept |

`GET /api/governance/mandates/{agent}` returns the mandate and its `gaps`: which of `owner`, `mandate`, `success_criteria`, `allowed_systems` and `budget` are missing. Saving needs `agents.update` and Cedar `update` on the agent, and is audited as `agent.mandate.saved`.

### Allowed systems

When a mandate names its systems, a call by the agent to any other MCP server is handled by `TICKETIQ_AGENT_MANDATE_SYSTEMS`:

| Mode | Effect |
| --- | --- |
| `audit` (default) | The call goes ahead. `agent.mandate.outside` is recorded, at most once an hour per agent and server |
| `enforce` | The call is refused before it is sent, and the agent is told to ask an owner to add the system |
| `off` | No check |

A mandate with no `allowed_systems` limits nothing.

## Migrating existing agents

Every registered agent that has no owner is given the admin (`TICKETIQ_ADMIN_USER`) as its owner, and every registered agent without a mandate gets one seeded from what it does today: the MCP servers it is configured with and its current cap. Nothing an agent does changes, and every registered agent passes both checks.

This runs once by itself after an upgrade (`agent.mandate.migrated`, with the agents changed), and on demand with `POST /api/governance/mandates:migrate` (`agents.update` and `access.write`). A seeded mandate is marked `seeded: true` and has no purpose or success criteria: its owner should fill them in, and `gaps` lists them until they do. If the admin account is disabled, the upgrade pass writes nothing and tries again later. Send `{"owner": "<username or group:name>"}` to name someone else.

### Built-in agents

The built-in agents (Liya, the HR agents, the pipeline steps) are not part of the upgrade pass. Who owns them is your choice, so no upgrade assigns them. To give every unowned built-in an owner in one call:

```json
POST /api/governance/mandates:migrate
{"builtins": true, "owner": "<username or group:name>"}
```

`owner` is required with `builtins`, and must be someone who can act now: an enabled user, or a group with at least one known member. The response lists `builtins` (the agents that gained the owner) and `owners_window` (see below). Built-ins get no seeded mandate.

### What changes when an agent has an owner

- A write the agent holds for approval goes to its owners first. For `TICKETIQ_APPROVAL_OWNER_GRACE_MINUTES` (30 by default) only an owner may approve or edit it. After that any approver may. The admin account cannot override the window.
- Owners get the agent's alerts, including kill-switch detector warnings.
- With independent review on, an owner's own sample verdicts on the agent are refused.

If you are the only approver, name yourself. If several people approve, name a group they are all in, so the window does not shut the others out.
