# Agent sessions

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> An agent session is a run of a coding agent that Ringleader starts, supervises and records on a workstation.


An agent session is a run of a coding agent (Claude Code, Codex, Antigravity CLI, pi or OpenCode) that
Ringleader starts on a workstation, supervises and records. If you start the same agent in a
shell, its history lives in that terminal's scrollback. A session has a name, a
phase, a cost reading and a transcript that outlives the terminal. You can list it, follow it
from another computer, answer its questions, stop it when it spends too much and share it with a teammate.

Start one with `rl agentsession create`:

```bash
rl agentsession create fix-login --workstation my-agent-box --prompt "Fix the failing login test."
```

Ringleader writes the session and returns. The workstation starts the agent, and
`rl agentsession logs fix-login` follows its output. If that is all you need, you are done. The rest of
this page covers what each agent can do, the phases a session moves through, the limits that end one,
where its transcript is kept and who can read it. [AgentSession and AgentSessionConfig](https://docs-stg.ringleader.dev/reference/resources/agentsession/)
lists every field, and [Agent session commands](https://docs-stg.ringleader.dev/reference/cli/commands/agent-sessions/)
lists every command and flag.

## Agent session visibility

Agent sessions are hidden until the setting `agent-sessions.visible` is on for you. While it is off, the
`rl agentsession` group is missing from `rl --help`, the Ringleader desktop app and the console hide their
Sessions routes, and `rl tui` has no Sessions tab. The setting changes only what is shown. Every
`rl agentsession` command still works when you type it.

An administrator of your Ringleader deployment turns the setting on through a feature rule. To turn it on for
one device, see [Show agent sessions on your device](#show-agent-sessions-on-your-device).

## Supported agents and what each can do

A session runs one of five agents, set by `spec.agent` or `--agent`. Any other value is refused. This table
says what each agent supports in a session.

| Agent | Follow-up turns | Interrupt a turn | Resume | Permission questions reach you | Model | Effort |
|-------|-----------------|------------------|--------|-------------------------------|-------|--------|
| `claude` | Yes | Yes | Yes | No | Yes | Yes |
| `codex` | Yes | Yes | Yes | Yes | Yes | Yes |
| `agy` | No, it runs one turn | No | No | No | No | No |
| `pi` | Yes | Yes | Yes | No | Yes, with a model provider | Yes |
| `opencode` | Yes | Yes | Yes | No | Yes, with a model provider | No |

Codex is the only agent whose permission questions reach you, so it is the only one where
`rl agentsession approve` and `rl agentsession deny` have something to answer.

These conditions also apply:

- `pi` and `opencode` need `modelProvider` whenever you set `model`.
- `opencode` fails to start a session that sets an effort.
- `pi` and `opencode` start only with the permission mode `unattended`, or with none set.
- `claude` refuses the permission mode `unattended` together with an allow list.

[Supported agents](https://docs-stg.ringleader.dev/workstations/coding-agents/supported-agents/) says which agents Ringleader installs and configures on a workstation.
A session runs as the workstation's login user, never as root.

## Session phases

A session's `status.phase` says where it is. `rl agentsession get` shows it in the `PHASE` column, and
`WAITING FOR` says what a blocked session needs from you.

| Phase | Meaning |
|-------|---------|
| `Pending` | The session waits to start. `status.startWait` says what it waits on. |
| `Starting` | The agent is starting. |
| `Running` | The agent is working. |
| `WaitingForInput` | The agent is blocked on a person: a permission question or the next turn. |
| `Stopped` | A person stopped the session, or its workstation stopped. You can resume it. |
| `Failed` | The agent failed, or a one-shot session's turn failed. |
| `Done` | The agent finished, or a person marked the session done. You can resume it. |

A workstation that stops always leaves its sessions `Stopped`, never `Failed`.
`rl agentsession describe` prints the spec, the status and the events, including who stopped, finished or resumed
the session and why. When a declared limit ended the session, `status.endedBy` names it.

## Limits that end a session

A session with no limits runs until its agent finishes or you stop it. You can declare limits when you create it:

| Limit | Flag | What happens |
|-------|------|--------------|
| Idle time | `--idle-timeout` | The session stops after this long with no activity. |
| Run time | `--max-duration` | The session stops after this much agent run time. Time spent waiting for a workstation or stopped does not count. |
| Cost | `--max-cost` | The session stops once it has spent this many US dollars. A provider that reports no cost never trips it. |
| One turn | `--end-on-first-idle` | The session ends at the agent's first turn boundary: `Done`, or `Failed` if that turn failed. |
| Automatic resumes | `--max-auto-resumes` | A session that has an auto-resume prompt resumes itself up to this many times, five by default, and `0` never. |

Durations take the Go form (`90m`, `2h`) or whole days (`7d`). Without `--end-on-first-idle`, a finished turn
leaves the session waiting for your next one. Unless you set an idle timeout, it waits there indefinitely.

To continue a session that a limit ended, run `rl agentsession resume` with a higher ceiling, as
[Stop, finish, resume, restart or move a session](#stop-finish-resume-restart-or-move-a-session) shows.

## Transcript storage and retention

A session keeps a transcript: what you sent and who sent it, what the agent said, its tool calls and
their results, and the notes people add. The transcript can contain pasted credentials and your source
code. Ringleader chooses where it is kept when it creates the session, records the choice and the reason in
`status.transcript`, and never changes it afterward. `rl agentsession describe` shows it. You can name a store with
`--transcript-store`:

| Store | Held by | Survives deleting the workstation | Readable from |
|-------|---------|-----------------------------------|---------------|
| `box` | The workstation | No | Surfaces that can reach the workstation |
| `daemon` | Your own device | Yes | That device only |
| `plane` | The Ringleader control plane that holds the session | Yes | Anywhere you can reach Ringleader |

If you name a store that the workstation cannot reach, `rl agentsession create` refuses with a message that says
why. Choose another store, or use a namespace with a Storage.

A `plane` transcript is sealed into a [Storage](https://docs-stg.ringleader.dev/reference/resources/storage/) you own, a bucket in your cloud account.
The session uses the namespace's default Storage, or the one you name in `lifecycle.transcriptStorageRef`, and records
the choice in `status.transcript.storage`. A later change of the default does not move a session that already started.
[Several buckets and the default](https://docs-stg.ringleader.dev/cloud-accounts/storage-buckets/#several-buckets-and-the-default) says how the default is picked.

How long a transcript stays depends on where it is:

- Sealed transcripts in a Storage you own stay 90 days unless `lifecycle.transcriptRetention` says otherwise.
- With no Storage, Ringleader deletes the transcript 30 days after the session's last activity, as
  [Session transcripts and artifacts](https://docs-stg.ringleader.dev/organizations-teams/transcripts-artifacts/) explains.
- A transcript kept on the workstation ends with the workstation.
- A session that can no longer be resumed is deleted 90 days after its last activity, which `lifecycle.retention` changes.
  A session you can still resume is never deleted this way.

To keep a transcript from a workstation you plan to delete, export it first, as
[Read or export a transcript](#read-or-export-a-transcript) shows. To delete a session's stored records before
their retention ends, run `rl agentsession purge`. Purging needs the `purge` right, which
namespace administrators hold, and it cannot be undone.

## Who can read and send

You own every session you create. Reading its transcript or sending to it needs one of three things: owning it,
a share, or a role that names the right. A namespace administrator can create, edit and delete sessions, but does not by default
hold the right to read another member's transcript.

A share confers one of two rights:

| Right | What it allows |
|-------|----------------|
| `transcript-read` | Read the transcript and its export, follow the live output, and read notes. |
| `attach` | Everything `transcript-read` allows, and send turns, answer permission questions, interrupt a turn and add notes. |

Answering a question authorizes a command to run on the workstation as the session's identity, so `attach` is a write
right. Neither right lets the person you share with stop, resume, delete or edit the session.

Ringleader stamps each turn with who sent it, and `rl agentsession logs` and `attach` name the sender in a shared
session. A second person's turn is refused until the workstation has taken the first one.

## Start a session


### Use the application


In the Ringleader desktop app, open **Sessions** and choose **New session**. The form has two steps, **Session** and
**Review**. Fill in these fields, then check them on **Review** and start the session:

| Field | What it sets |
|-------|--------------|
| **Task** | The prompt. |
| **Namespace** | Where the session lives. |
| **Runs on** | A workstation or a pool. Type to search. |
| **If stopped** | Whether the session starts its workstation when the workstation's idle policy stopped it. |
| **Agent**, **Model provider**, **Model**, **Effort** | What runs the task. |
| **Spending limit**, **Run time** | The cost and run-time limits. Blank means no limit. |
| **If nobody answers** | **Stops after** a time you choose, or **Keeps waiting**. |
| **Transcript** | Where the transcript is kept. |
| **Name** | Blank generates a name from the workstation's name. |
| **Working directory** | Where the agent runs. Blank uses the directory a configuration says, else the first source checkout. |

If you do not see **Sessions**, see [Show agent sessions on your device](#show-agent-sessions-on-your-device).



### Use the command line


Run `rl agentsession create` with a workstation and a prompt. The name is optional. Without one, Ringleader
builds it from the workstation's name and a random suffix:

```bash
rl agentsession create fix-login --workstation my-agent-box --agent claude \
  --max-cost 5 --idle-timeout 2h --prompt "Fix the failing login test."
```

The command writes the session and returns. A name that is already taken is refused, so a repeated command never
writes over a running session. Pick another name, or use `rl agentsession send` or `rl agentsession resume` on the
existing one.

To run on a workstation that a [pool](https://docs-stg.ringleader.dev/workstations/lifecycle/pools-leases/) lends, use
`--workstation-pool` in place of `--workstation`. To work in a set of git worktrees, use
`--worktree-set`, as [Worktree sets](https://docs-stg.ringleader.dev/workstations/sessions/worktree-sets/) describes.

To start a session and wait for it in one command, run `rl agentsession exec`. It follows the output and exits with
the agent's status: `0` when the agent finished, and non-zero when it failed or stopped. Press Ctrl-C to detach. That
does not stop the agent.

To write the session as a file instead, add `--dry-run -o yaml`. That prints the object without creating it, and you
can create it with `rl apply -f`. [AgentSession and AgentSessionConfig](https://docs-stg.ringleader.dev/reference/resources/agentsession/)
shows the file.






The prompt is fixed once the session exists. To say something more, send a turn, as the next section shows.

## Follow a session and talk to it

Run `rl agentsession get` to list your sessions. Add `-w` to watch for changes.
`rl agentsession logs fix-login` follows the agent's live output. It returns when the agent comes to rest. A session
that waits on a person keeps following. If the command says no `rl` daemon is running on this device, run `rl daemon start`.

To send a follow-up turn, run:

```bash
rl agentsession send fix-login "Also add a test for the expired session case."
```

A turn you send while the agent is working steers the running turn. It does not interrupt it. To stop the current
turn and keep the session, run `rl agentsession interrupt fix-login`, then send the next instruction. `send` is
refused for a session started with `--takes-turns=false`, and for a session that is `Stopped` or `Done`. Resume it
first.

To follow along and answer in one place, use one of these:

- `rl agentsession chat fix-login` opens a full-screen terminal client. With no name, it opens a list of your sessions,
  most recent first, with the ones waiting on you at the top. Press `w` to jump to the next waiting session.
  A session that has rested opens read-only. Press Ctrl-C or Ctrl-D twice to leave. Leaving never stops the agent.
- `rl agentsession attach fix-login` is a two-way stream of JSON lines, for a script. It sends and receives one object per line.
- The Ringleader desktop app shows the same session in **Sessions**, with a count of sessions waiting on you.
  Alt+W jumps to the next waiting session.

To add a note for people that the agent never sees, run `rl agentsession note fix-login`. To label the session
in lists, run `rl agentsession set-display-name fix-login "Login fix"`. The display name holds up to 64 characters,
and an empty value clears it.

## Answer a permission question

When the agent asks permission to run a command, the session is `WaitingForInput` and `WAITING FOR` in
`rl agentsession get` says so. Only Codex sessions send these questions to you. Run one of these:

```bash
rl agentsession approve fix-login
rl agentsession deny fix-login
```

Each answer names the question that is pending at that moment. If the agent has moved on, Ringleader refuses the
answer, so run `rl agentsession get` and answer the current one. With nothing pending, the command says so and
suggests a turn instead. In the Sessions tab of `rl tui`, press `a` on the row to open a dialog with Approve and Deny.

Approving authorizes a command to run on the workstation as the session's identity. In a shared session, you need the
`attach` right to answer.

## Stop, finish, resume, restart or move a session


### Use the application


In the Ringleader desktop app, open the session in **Sessions** and choose a verb: **Mark done**, **Stop**,
**Resume** or **Restart**. A verb that does not apply is disabled, and hovering over it shows why. **Move** is on
the command line only.



### Use the command line


Name one or more sessions, or select them with `-l`:

```bash
rl agentsession stop fix-login --reason "Needs a different approach"
rl agentsession done fix-login
rl agentsession resume fix-login
rl agentsession restart fix-login
rl agentsession move fix-login --workstation my-other-box
```






Each verb does this:

| Verb | What it does |
|------|--------------|
| Stop | The session becomes `Stopped`, and no input is accepted until you resume it. Ringleader records who stopped it and why. |
| Mark done | The session becomes `Done`, and the chat list shows it below working sessions. `resume` reverses it. |
| Resume | The agent comes back and re-enters its conversation. After a limit ended a session, raise the ceiling in the same command. |
| Restart | Ringleader replaces the agent process with a new one in the same conversation, so it picks up refreshed sign-in, reconnected MCP servers and new tools. |
| Move | The session and its conversation move to another workstation, for Claude Code, Codex and pi, up to a 64 MiB conversation file. Working files stay behind. |

To resume a session that stopped on a limit, raise it with `--max-cost`, `--max-duration`, `--max-auto-resumes` or
`--start-deadline`. The command prints the working invocation if you leave it out. A resume turns off
`--end-on-first-idle` for that run. Resume is refused if the workstation was deleted. A session that never captured an
agent conversation rests where it is, and Ringleader does not run its prompt again. Restart is refused for a session a
declared limit ended and for a session with no conversation captured yet. Move is refused for pool sessions and for
sessions that a limit ended or that failed. A moved session leaves behind the earlier frames of a transcript that
the old workstation holds, so export it first.

## Share a session

You share a session at one of two levels: **Read** and **Write**. **Read** gives
`transcript-read`. **Write** gives `transcript-read` and `attach`.


### Use the application


In the Ringleader desktop app, open the session and choose **Share**. Enter the person's **Sign-in email**,
choose a level and choose **Share**:

- **Read**: they can read the conversation and watch it live. They cannot send messages.
- **Write**: they can send messages and answer the agent's questions. Commands they approve run as you.

The dialog warns that a workstation that takes input only from its own bound device cannot receive a guest's messages.



### Use the command line


Name the person with `--with` and a level with `--access`:

```bash
rl agentsession share fix-login --with user:alice@acme.com --access write
```

`--with` repeats for more people. To grant one right instead of a level, use `--right transcript-read` or
`--right attach`. `--all` shares every session in the namespace. `--admin` is the path for administrators. You must
give `--access` or `--right`.






Sharing again at another level changes the person's access. A change that would give someone more than you asked, through
a share that also names other people, is refused.

To see who can read a session and through which share, run `rl agentsession access fix-login`. To end a share, run
`rl agentsession unshare fix-login --with user:alice@acme.com`. [Roles and grants](https://docs-stg.ringleader.dev/organizations-teams/accounts-access/roles-grants/)
explains the grants behind a share.

## Read or export a transcript

Run `rl agentsession transcript fix-login` to print the stored transcript as JSON Lines, oldest first. Each line is
an event or a transition, positioned by its run and sequence number. A run is one agent process, and its
sequence restarts at 1 with each new process. `--last 50` prints the final 50 lines, and `--limit` caps the
count. If the store cannot be reached from this device, the command names the store and refuses. It never prints an empty
transcript in its place.

To keep or move a transcript, export it as one JSON document:

```bash
rl agentsession export fix-login -o fix-login.json
```

The file is created first and written whole or not at all. Add `--bundle` to export the whole record, which is the
transcript plus the session's owner and status, token usage and cost record, and the workstation's network and
credential records for the days the session ran. Ringleader writes `fix-login.json.sha256` beside it, which detects
accidental changes only.
To read an export offline, run `rl agentsession chat --replay fix-login.json`.

To find a session by what was said in it, run `rl agentsession grep -e "expired session"`. It searches messages, tool
input and output, and patches, and does not search the agent's thinking. It skips sessions kept on a workstation or on
your device, unless you add `--client`. A skipped session makes the exit status `2`, even with no match.

## Show agent sessions on your device

If the `rl agentsession` group is missing from `rl --help`, or the app has no **Sessions** route, set the
visibility setting for this device:

```bash
rl node settings set flag.agent-sessions.visible true
```

`rl featureflag mine` then shows `agent-sessions.visible: true (device override)`. To remove the override, run
`rl node settings unset flag.agent-sessions.visible`. The override changes only what you see. Ask an administrator of your
deployment to turn the setting on for you for good.

## Next steps

- [AgentSession and AgentSessionConfig](https://docs-stg.ringleader.dev/reference/resources/agentsession/): every field, the phases and how configuration layers merge.
- [Agent session commands](https://docs-stg.ringleader.dev/reference/cli/commands/agent-sessions/): every command and flag.
- [Terminal sessions](https://docs-stg.ringleader.dev/workstations/sessions/terminal-sessions/): plain shells that Ringleader keeps alive.
- [Worktree sets](https://docs-stg.ringleader.dev/workstations/sessions/worktree-sets/): git worktrees an agent session can work in.
- [Session transcripts and artifacts](https://docs-stg.ringleader.dev/organizations-teams/transcripts-artifacts/): what happens to transcripts with and without a Storage.
- [Supported agents](https://docs-stg.ringleader.dev/workstations/coding-agents/supported-agents/): which agents Ringleader installs and configures.

