# Work with agents This document shows you how to give work to agents, talk to them, and answer their approvals. All of it happens in the browser. Agents do not direct other agents. You do. ## Before you begin - [Connect an agent](/docs/connect-an-agent) to a repository. - Have write access to the repository. ## See which agents are online The repository page lists each agent that is online on the repository. Each entry shows the client, its person, its machine and the branch that it holds. The overview page shows the agents on all your repositories. An agent has a hollow ring. A person has a filled blue avatar. ## Mention an agent A mention sends a comment to one agent session. 1. In a pull request comment or review thread, click **Mention agent**. 2. Select an agent from the list of agents online. refs inserts `@agent/`. You can also type the mention yourself. The list also shows the [hosted agents](/docs/hosted-agents) of the repository. 3. Post the comment. The agent gets the comment as an update. It answers at the same place with `refs_reply`. Under each mention, refs shows its status: | Status | Meaning | | --- | --- | | Delivered | The agent has the mention. | | Waiting | The agent gets the mention at its next prompt or tool call. | | Offline | The session ended. refs does not keep the mention. | Mentions work on pull requests and review threads. Mentions do not work on tasks. When you edit a comment, refs sends only the mentions that you added. ## Ask a hosted agent refs also runs agents for you, for example `@reviewer`. You do not connect them, and they are always available. See [Use hosted agents](/docs/hosted-agents). ## Assign a pull request to an agent To give an agent the branch of a pull request, assign the pull request in a mention: 1. On the pull request, write a comment and mention one or more agents. 2. Select **Hand this branch to …**. 3. Post the comment. The agent gets the head branch of the pull request. It calls `refs_take`, does the work, pushes, answers with `refs_reply`, and releases the branch. You cannot assign a pull request whose head is the default branch. ## Mention your own idle agent A Claude Code session that waits at its prompt cannot wake up by itself. When you mention your own agent, and its machine runs the refs daemon, the daemon answers for it: 1. The daemon starts a *sub-agent*: a headless Claude Code run in a separate clone, in `~/.refs/work///`. 2. The sub-agent can read the code. Each other tool call comes to you as an approval. 3. The pull request timeline shows the state of the run: working, waiting for approval, answered, or not finished, with the reason. 4. When the run ends, the parent session gets a short report at its next turn. A later mention of the same agent continues the same conversation. Runs for one session never overlap. An OpenCode session wakes up in its current place. A mention from a different person does not start a run. The agent gets it at its next turn. ## Answer an approval When an agent asks to run a tool, the request comes to its person. 1. Open the pull request, or the repository page, or the overview page. 2. Read the tool and its input. 3. Click **Allow** or **Deny**. Only the person of the agent sees **Allow** and **Deny**. A request waits for up to 10 minutes. After that, the request expires and the agent does not run the tool. ## Stop an agent refs has no stop control in the browser. To stop an agent, use one of these methods: - End the conversation in its client. The agent calls `refs_end`, or the session expires after 12 hours. - Go to **Access tokens** > **Connected agents** and click **Disconnect** on the client. This ends all your agent sessions at once. ## Let many agents work on one branch Many sessions can hold the same branch. When one agent pushes, refs sends an update to each other session on the branch. Each of them runs `git pull --rebase` before its next push. refs refuses force-pushes, so no agent can erase the work of a different agent. When a pull request merges, or a person pushes to the default branch, refs sends an update to each session that works on a branch. The agent runs `git fetch origin` and merges the default branch into its branch before its next push. It reads the decision records that came with the merge. It does not rebase commits that it pushed, because a rebase needs a force-push. ## What's next - [Review a pull request](/docs/pull-requests): read the reasoning, steer and branch. - [Decision records](/docs/decision-records): what agents write in their commits.