# Agents and approvals

An agent is an automated tool with its own identity in an organization: its own tokens, bound to the repositories and branches you choose, its own limits, and an off switch that touches nothing else. What only an owner may do, an agent asks an owner to approve.

> **Beta:** Agents are in beta, free within the [published limits](https://rebasely.com/docs/limits#live).

## An identity of its own

An agent shows up as `<org>/<name>` in pushes, live edits, checkpoints, pull requests and the audit log. Owners of the organization create agents under Settings, Agents, after confirming with Google or a passkey. An agent never signs in and cannot administer anything.

- Tokens start with `dga_`. Each works only on the repositories you list for it, and can be limited per repository to ref patterns such as `refs/heads/agent/*` (`*` matches within one part of a ref, `**` across parts). Without patterns it may push wherever its role allows. Agent tokens last 30 days by default and at most 90.
- Scopes: `repo:read`, `repo:write`, `repo:create`, `actions:read`, `actions:write`, `statuses:write`, `live:read`, `live:write` and `sandbox:write`. An agent works in its own sandboxes whatever its ref patterns say.
- Each agent has its own limits (pushes an hour, API requests a minute, live edits a second and a day, open live sessions, sandboxes, Actions minutes and egress), which an owner can raise up to the plan's ceiling. The agent cannot change them.
- Disabling an agent stops its writes at once, closes its live connections, revokes every token and cancels its running jobs. Revoking one token leaves its other tokens working.
- An agent's approval of a pull request is recorded but never counts toward required approvals, and an agent counts as an established account only while its owner is.

Give an agent its token in `REBASELY_TOKEN`, never your own. At most 20 active agents per organization (100 on Team), and a person creates at most 10 a day.

## Asking an owner to approve

A token can ask for what only an owner may do: a new agent, or making a repository public. The request gets a short code; an owner opens [https://rebasely.com/approve](https://rebasely.com/approve), enters it, sees exactly what is asked, and approves after confirming with Google or a passkey.

*Diagram: 1. An agent asks Rebasely for something only an owner may do, such as a new agent or making a repository public. 2. Rebasely answers with a short code that expires after 10 minutes. 3. The agent shows the code and the approval page to its person. 4. An owner of the organization opens /approve, enters the code, sees exactly what is asked, and approves after confirming with Google or a passkey. 5. The agent polls every 5 seconds. 6. Once approved, the change is made, and a new agent's token goes to the terminal that asked, once.*

*The agent asks, an owner approves on /approve, and the agent's poll gets the answer.*

- Requests expire after 10 minutes, are used once, and only the token that asked can follow them.
- Making a repository public: the owner who approves needs an established account (7 days old, or verified), and a repository moderation keeps private stays private. Making one private works at once with an owner's token that has `repo:write`.
- A new agent: the owner who approves becomes its owner. Its token goes to the terminal that asked, once, never to the approval page.
- Every request, approval, denial and token handed out is in the organization's audit log.

CLI:

```sh
rebasely agent create --org <org> --name fixer --scopes repo:read,repo:write --repos app,web:refs/heads/agent/*
rebasely agent token <org>/fixer      # print it for REBASELY_TOKEN
rebasely repo visibility <org>/<name> public
```

API:

```sh
curl -fsS -X POST -H "Authorization: Bearer $REBASELY_TOKEN" -H "content-type: application/json" \
  -d '{"kind":"repo_visibility","org":"<org>","repo":"app","visibility":"public"}' https://rebasely.com/api/v1/approvals
# then every 5 seconds, until approved, denied or expired:
curl -fsS -X POST -H "Authorization: Bearer $REBASELY_TOKEN" https://rebasely.com/api/v1/approvals/<id>/poll
```

MCP:

```
agent.request      ask for a new agent
repo.visibility    ask to make a repository public
approval.status    follow the request
```

`rebasely agent create` also takes `--role`, `--description`, `--expires` and `--caps pushes_per_hour=60`. The CLI keeps the token in the system keychain.

## Creating repositories

A token with `repo:create` creates repositories, always private. `rebasely auth login` asks for it by default; an agent's token has it only when an owner grants it, and each repository it creates is added to the token. The usual rules apply: writers and owners, the reserved names, 100 repositories a day per person (an agent's count against its owner), plus 20 an hour per token and 60 an hour per organization from tokens.

```sh
rebasely repo create <org>/<name> --description "What it is" --default-branch main --readme
```

## The agent skill

`rebasely agent init` adds the [Rebasely agent skill](https://rebasely.com/docs/skills/rebasely/SKILL.md) to a repository (`.claude/skills/rebasely/`). It tells coding agents to work in one [sandbox](https://rebasely.com/docs/sandboxes) and one git worktree per task, to read the [knowledge base and architecture](https://rebasely.com/docs/dot-rebasely) first, and to keep them current.

---

Source: https://rebasely.com/docs/agents
