---
related_nodes: [on_coding_agent_event, relay_filesystem, relay_status]
---

# Relay Coding Agent

Drives the coding sessions of a Verdalia Relay: OpenCode, Oh My Pi and Claude Code work in the
relay's filesystem mounts, and Paseo runs agents in its own projects. List the connection's
coding sessions, find or import a provider's session, start or open one, read it, send it a
prompt, answer permissions and questions, cancel a turn, change settings, or close the session.
For Paseo, the node also archives workspaces and lists or removes worktrees.

Every session is named by its Verdalia coding-session id, the `id` the Coding Agents page, the
agent tools and `on_coding_agent_event` use for it. One node can start a session and later nodes
prompt it by that id. Use `find_session_by_provider_id` to go from a provider's own session id
to its Verdalia id. Use `import_session` for a stored mount session that is not in Verdalia.

A mount session runs in a process the relay starts for it. Closing the session, including an
idle close after five hours, recycling at the session cap or relay shutdown, stops that
process and the processes it started. At the cap, the relay closes its longest-idle session.
A Paseo session is an agent Paseo runs: the relay only observes it, so it counts toward no cap,
never idles out, and closing it stops observing while the agent keeps running in Paseo.
`send_prompt`, `open_session` and `read_session` reopen a session that is not running, with its
history. The Coding Agents page shows the same sessions live; `on_coding_agent_event` starts a
workflow from what a session reports.

## Configuration

**connection** — Verdalia Relay connection: pick one, or write a template such as
`{{ input.connection_id }}` that resolves to a connection id from `input` on each run. The node
fails, naming the template and what it resolved to, when the input has no value for it, the value
is not a connection id, no Verdalia Relay connection has that id, or that relay is offline. The
agent runs with the relay machine's own agent config, login, and user permissions.

**operation** — `op`-tagged union, default `list_coding_sessions`:

- `list_coding_sessions` — the coding sessions of this connection, running or not. Fields:
  `project_id`, optional, narrows the list to one Paseo project's sessions.
- `list_importable_sessions` — one page of the sessions a mount provider stores for exactly
  one directory (not its subdirectories), each marked with the coding session it is already
  imported as. Fields: `provider`, `mount`, `path`, `cursor`.
- `find_session_by_provider_id` — the coding session that holds a provider's own session on this
  connection, or `null` when none does. Fields: `provider`, `provider_session_id`.
- `import_session` — add a stored mount session, including one started in the provider's
  terminal app. Fields: `provider`, `mount`, `path`, `provider_session_id`. A session already
  imported fails, naming the coding session it is.
- `start_session` — start a new session. For `opencode`, `omp` or `claude`, the agent runs
  in a mount directory. Fields: `mount`, `path`, `provider`. For `paseo`, in a Paseo project, placed as
  `placement_kind` says. Fields: `provider`, `project_id`, `placement_kind`, `workspace_id`,
  `worktree_mode`, `new_branch`, `base`, `branch`, `pr_number`, `forge`, `slug`,
  `agent_provider`, `model`, `mode`, `thinking`. The session starts unclaimed.
- `open_session` — the session and the events the relay holds for it, reopening it first when
  it is not running. A mount session resumes with the same provider session id; opening a
  Paseo session starts observing its agent again. Fields: `session_id`.
- `read_session` — the session's state and the events of its last `limit` items (500 when
  `limit` is empty), opening the session first when it is not running. See
  [Reading a session](#reading-a-session). Fields: `session_id`, `limit`.
- `send_prompt` — send the agent a prompt, and return as soon as the relay has accepted it,
  reopening the session first when it is not running. What follows (the turn ending or failing, a
  permission or a question) arrives as events: see [Acting on the reply](#acting-on-the-reply).
  In a Paseo session, a question still waiting is declined first, as **Dismiss** does, and folds
  to **Declined**; answer it with `answer_question` before sending when its answer matters.
  If it can't be declined, the prompt fails with the reason and the question stays open.
  The message is sent as from a workflow; a Relay without the newer send route refuses it as
  needing an update. Fields: `session_id`, `text`.
- `answer_permission_request` — answer a permission request with one of its options. Fields:
  `session_id`, `request_id`, `option_id`.
- `answer_question` — answer a question request, one answer per question. Fields: `session_id`,
  `request_id`, `answers`.
- `decline_question` — decline a question request without answering it. Fields: `session_id`,
  `request_id`.
- `cancel_running_prompt` — stop the running prompt. Fields: `session_id`.
- `set_config_option` — change one of the session's settings, such as its model or mode.
  Fields: `session_id`, `config_id`, `value`.
- `close_session` — stop running the session on the relay. A mount session stays stored and
  can be opened again; a `paseo` agent keeps running in Paseo. Fields: `session_id`.
- `archive_paseo_workspace` — archive a Paseo workspace with its agents and terminals. A worktree
  workspace's worktree directory is removed too when Paseo made it and no other workspace uses
  it; any other workspace's checkout is left as it is. The coding sessions of its agents are gone
  when the op answers. Fields: `project_id`, `workspace_id`, `discard_changes`.
- `list_paseo_worktrees` — every Paseo worktree of a Paseo project, with the workspaces on each.
  Fields: `project_id`.
- `remove_paseo_worktree` — remove a Paseo worktree of a Paseo project, named by exactly one of
  `branch` or `worktree_path`, archiving every workspace on it. Fields: `project_id`, `branch`,
  `worktree_path`, `discard_changes`.

Neither Paseo cleanup op deletes a branch: Paseo keeps it.

The ops that act on a session take only its id; the provider comes from the coding session.
`answer_permission_request`, `answer_question`, `decline_question`, `cancel_running_prompt`,
`set_config_option` and `close_session` go straight to the relay, which refuses them for a
session that is not running (`session_not_running`).

**provider** — `opencode` (OpenCode), `omp` (Oh My Pi), `claude` (Claude Code), or `paseo`.
Leave empty to use the relay's only available mount provider. With none or more than one,
the run fails with "provider required". Name `paseo` explicitly; it does not support import.

A mount provider is available only when enabled and its command is found on the relay's
user PATH. The `relay_list` agent tool shows both available providers and `unavailable`
entries for enabled providers whose commands are missing. Starting, importing or reopening
a session of a missing provider gives `CODING_SESSION_PROVIDER_NOT_FOUND` on the coding-session
API, with the same message the node shows: for example, “`claude` was not found on your PATH
(environment.d); run `verdalia-relay config set coding_agents.claude.command <full path>`”.
Disabled providers give `CODING_SESSION_PROVIDER_DISABLED` on the API; Paseo must also be
connected (`paseo_unavailable`).

Claude Code 2.1.330 or later is required. An older version can appear as available but fails
to start or open (`agent_outdated`): “Claude Code X is older than 2.1.330, the oldest this Relay
supports; run `claude update`”. See [Relay setup](/guides/relay-setup#coding-agents).

**mount** — the relay filesystem mount the agent works in, by the name the relay's config gives
it. Required for `opencode`, `omp` and `claude`.

**path** — directory inside the mount, relative and `/`-separated. Empty (the default) is the
mount root.

**cursor** — the `next_cursor` an earlier `list_importable_sessions` returned. Empty (the default)
is the first page.

**limit** — how many of the session's latest items `read_session` reads every event of: a whole
number of at least 1, with no upper bound. An item is a message, a thought, a tool call, a plan,
a permission request or question, a notice, a compaction, or another agent's message. Empty (the
default) reads 500.

**session_id** — the coding session's Verdalia id, as `start_session`, `open_session` and
`read_session` (`session.id`), `list_coding_sessions` (`sessions[].id`),
`find_session_by_provider_id` and `import_session` (`session_id`), and `on_coding_agent_event`
(`session_id`) report it. Required. A value that is not a coding-session id fails the node with
"expected ULID coding session id: …; find_session_by_provider_id gives the coding session of a
provider's session id".

**provider_session_id** — the provider's own id for a session, as `list_importable_sessions`
(`sessions[].provider_session_id`) reports it for a mount provider, or a Paseo agent id.

**project_id** — the Paseo project, as the Coding Agents page and Relay Request's Paseo directory
name it. Required for a Paseo `start_session`, `archive_paseo_workspace`, `list_paseo_worktrees`
and `remove_paseo_worktree`.

**workspace_id** (archive) — the Paseo workspace to archive, as a Paseo session's
`project_workspace` gives it. Required. A workspace the relay does not list in that project,
including one already archived, is refused (`paseo_workspace_not_found`).

**branch** / **worktree_path** (remove) — the worktree to remove, by its branch or by its path as
`list_paseo_worktrees` gives it; a detached worktree has only its path. Set exactly one. A
worktree that is not one of the project's Paseo worktrees, including one already removed, is
refused (`paseo_worktree_not_found`); one Paseo did not make is refused (`paseo_rejected`,
starting `NOT_ALLOWED`).

**discard_changes** — default `false`: a worktree with uncommitted changes is refused
(`worktree_dirty`, naming its directory) and nothing is archived. `true` archives or removes it,
losing the changes. Archiving a workspace that is not a worktree is never refused for changes.

**placement_kind** — where a Paseo session runs, default `new_local`:

- `existing_workspace` — in the Paseo workspace `workspace_id` (required).
- `new_local` — in a new local workspace at the project's root.
- `new_worktree` — in a new git worktree, made as `worktree_mode` says, named `slug` (empty lets
  Paseo choose).

**worktree_mode** — how a new worktree gets its branch, default `branch_off`:

- `branch_off` — a new branch `new_branch` (required), off `base` (empty is the default branch).
- `checkout_branch` — the existing branch `branch` (required).
- `checkout_pr` — pull request `pr_number` (required, a whole number), on `forge` (empty is the
  project's own).

**agent_provider** — the provider Paseo runs the agent with, such as `claude` or `codex`.
Required for a Paseo `start_session`. **model**, **mode**, and **thinking** pick that provider's
model, mode, and thinking level; empty is the provider's default.

**text** — what to ask the agent. Required.

**request_id** / **option_id** — from a `permission_requested` event (`on_coding_agent_event`):
its `request_id` and one of its `options[].option_id`. Claude Code offers allow and deny,
and always allow when it offers a rule to save. Pass the option id from the request.

**request_id** (questions) — the `request_id` of a `question_requested` event from Claude Code
or Paseo. Claude Code sends this event for its own questions (`AskUserQuestion`) and for MCP
server requests (elicitations). See [On Coding Agent Event](/docs/nodes/on_coding_agent_event#output)
for `intro`, `detail` and `link`. The session's state is `question` while a question waits.

**answers** — a JSON array with one answer per question, in the request's order, or a reference
to such an array such as `{{ input.answers }}`. Each answer is `{"selected": [labels], "custom":
"text"}`: `selected` lists the labels of the options picked, exactly as offered (at most one
unless the question is `multi_select`); `custom` is an answer in the user's own words, taken when
the question has no options or `allow_other` is set. A question with `allow_empty` may be
answered `{"selected": []}`. For an MCP form, each answer must fit the server's field; for
example, a whole number field takes `{"selected": [], "custom": "42"}`. The relay refuses an
invalid answer with `invalid_question_answer` and names what is needed (for example,
“question 2 needs a whole number”). The question stays open. A request that is no longer
pending gives `question_not_found`. A form Verdalia cannot display or a link that is not
HTTP(S) is cancelled with a notice naming the server.

**config_id** — an option id from the session's `config_options`. For Claude Code,
`set_config_option` changes `mode`, `model` or `effort`.

### value

`type`-tagged union, default `{"type": "value_id", "value": ""}`:

- `{"type": "value_id", "value": "..."}` — a select option's choice, by one of the value ids
  its `control.choices` list.
- `{"type": "boolean", "value": "true"}` — a switch option, `true` or `false`.

### Values from the workflow

Every text field takes a value or a template, rendered against `input`. Chain `start_session`
into `send_prompt` with `{{ input.session.id }}`. Set `"provider": "claude"` to start Claude Code:

```json
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "start_session", "provider": "claude", "mount": "work", "path": "" } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "send_prompt", "session_id": "{{ input.session.id }}", "text": "Summarise {{ input.topic }}" } } }
```

A templated connection follows the relay whose event started the run. Chain it from
`on_coding_agent_event`, whose output carries `connection_id`:

```json
{ "relay_coding_agent": { "connection": { "content": "{{ input.connection_id }}", "mode": "template" }, "operation": { "op": "send_prompt", "session_id": "{{ input.session_id }}", "text": "Continue" } } }
```

In a workflow started by a `question_requested` event, answer the questions, picking `main` for
the first and giving own words for the second, or decline them:

```json
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "answer_question", "session_id": "{{ input.session_id }}", "request_id": "{{ input.envelope.event.request_id }}", "answers": "[{\"selected\": [\"main\"]}, {\"selected\": [], \"custom\": \"Tag it v2\"}]" } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "decline_question", "session_id": "{{ input.session_id }}", "request_id": "{{ input.envelope.event.request_id }}" } } }
```

Start a Paseo session with Claude in a new worktree branched off `main`, or with Codex on a pull
request:

```json
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "start_session", "provider": "paseo", "project_id": "proj_...", "placement_kind": "new_worktree", "worktree_mode": "branch_off", "new_branch": "fix/{{ input.issue }}", "base": "main", "agent_provider": "claude" } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "start_session", "provider": "paseo", "project_id": "proj_...", "placement_kind": "new_worktree", "worktree_mode": "checkout_pr", "pr_number": "{{ input.pr }}", "agent_provider": "codex", "thinking": "high" } } }
```

Find the coding session of a Paseo agent id an earlier step holds, then prompt it:

```json
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "find_session_by_provider_id", "provider": "paseo", "provider_session_id": "{{ input.agent_id }}" } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "send_prompt", "session_id": "{{ input.session_id }}", "text": "Rebase on main and rerun the tests." } } }
```

Archive the workspace a Paseo session ran in, list the project's worktrees, and remove a detached
one by its path:

```json
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "archive_paseo_workspace", "project_id": "proj_...", "workspace_id": "{{ input.session.project_workspace }}" } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "list_paseo_worktrees", "project_id": "proj_..." } } }
{ "relay_coding_agent": { "connection": "01J...", "operation": { "op": "remove_paseo_worktree", "project_id": "proj_...", "worktree_path": "{{ input.worktree_path }}", "discard_changes": true } } }
```

A required field left empty, a removal naming neither or both of `branch` and `worktree_path`, a
typed `pr_number` that is not a whole number, a typed `limit` that is not a whole number of at
least 1, or typed `answers` that are not a JSON array of answers is reported before the workflow
runs. A template that renders empty where a value is required, or as something no number, switch
or answer list reads from, fails the run and names the field; a `limit` also names what it
rendered to.

## Inputs

**input** — JSON value used as the interpolation context.

## Output

**output** — one object per operation. Relay refusals fail the node with the relay's code: a
relay at its cap with no idle agent to close (`capacity_reached`), a provider not enabled
(`provider_disabled`), a relay not connected to Paseo (`paseo_unavailable`), a Paseo project or
agent Paseo does not have (`paseo_project_not_found`, `paseo_agent_not_found`), Paseo's own
refusal (`paseo_rejected`), or the agent's own refusal (`agent_error`). OpenCode and Oh My Pi
take a message sent mid-turn as the next turn. Claude Code takes it into the running turn
after its current tool calls finish, or starts a new turn if the previous one ends first.
Paseo can take it in either turn. A relay too old to host coding sessions fails every operation
with "needs updating" before any is sent; update `verdalia-relay` on that machine.

A coding session, as `list_coding_sessions`, `find_session_by_provider_id`, `import_session`,
`start_session`, `open_session` and `read_session` give it:

```json
{
  "id": "01JSESSION0000000000000000",
  "connection_id": "01JCONNECTION00000000000000",
  "project_id": "01JPROJECT00000000000000000",
  "project_workspace": null,
  "location": { "kind": "mount", "directory": "" },
  "provider": "opencode",
  "provider_session_id": "ses_f21af0c5affeXDLbos1Pv8SITT",
  "title": "Pong",
  "agent_claim": "01JAGENTSESSION000000000000",
  "state": "ready",
  "created_at": "2026-09-26T12:00:00Z",
  "updated_at": "2026-09-26T12:00:00Z"
}
```

- `id` — the coding session's Verdalia id, the `session_id` every op takes.
- `project_id` — the Coding Agents project it belongs to. `project_workspace` is the Paseo
  workspace id of a Paseo session, `null` for a mount session.
- `location` — `{"kind": "mount", "directory"}` inside the mount (`""` is its root), or
  `{"kind": "paseo", "branch", "workspace_name", "agent_provider", "model"}`, where
  `agent_provider` and `model` are what Paseo runs the agent with.
- `provider` — `opencode`, `omp`, `claude`, or `paseo`. `provider_session_id` is the provider's
  own session id; for Paseo it is the agent id.
- `agent_claim` — the agent session that receives the session's results, absent when none does.
- `state` — `off` (not running, or its relay is offline), `ready`, `working`, `permission` (waiting
  on a permission answer), `question` (waiting on an answer to a question), or for Paseo `error`
  or `idle` (Paseo stopped the agent's process; the next message or setting change starts it).

The coding-session REST and stream responses and agent tools use the same `location` kind.
Change workflow conditions that match `location.kind == "acp"` to match
`location.kind == "mount"`.

`list_coding_sessions` gives `{ "sessions": [<coding session>, ...] }`, most recently changed
first.

`list_importable_sessions`:

```json
{
  "sessions": [
    {
      "provider_session_id": "ses_f21af0c5affeXDLbos1Pv8SITT",
      "title": "Pong",
      "updated_at": "2026-09-26T12:00:00.000Z",
      "imported": "01JSESSION0000000000000000"
    }
  ],
  "next_cursor": "..."
}
```

`imported` is the coding session it already is, absent when it is not imported. `next_cursor` is
the agent's own, absent on the last page; OpenCode answers its most recent sessions in one page.

`find_session_by_provider_id` gives `{ "session_id": "01J...", "session": <coding session> }`, or
`{ "session_id": null, "session": null }` when no coding session holds that provider session.
`import_session` gives `{ "session_id": "01J...", "session": <coding session> }`.

`start_session`, `open_session` and `read_session` give `{ "session": <coding session>, "read":
<read> }`, where `read` is what the relay holds of the running session:

```json
{
  "session_id": "ses_f21af0c5affeXDLbos1Pv8SITT",
  "location": { "scope": "mount", "mount": "work", "path": "" },
  "agent_kind": "opencode",
  "older": null,
  "status": "idle",
  "open_mode": "load",
  "agent": { "name": "OpenCode", "version": "1.18.31" },
  "capabilities": { "load": true, "list": true, "close": true, "images": false, "reload": false, "rewind_conversation": false, "rewind_files": false, "rewind_both": false, "fork": false, "interrupt": false, "attachments": false, "find": false },
  "title": "Pong",
  "config_options": [
    {
      "id": "model",
      "name": "Model",
      "category": "model",
      "control": {
        "type": "select",
        "current_value": "opencode/big-pickle",
        "choices": { "kind": "ungrouped", "options": [{ "value": "opencode/big-pickle", "name": "Big Pickle" }] }
      }
    }
  ],
  "usage": { "used": 1234, "size": 200000 },
  "available_commands": [],
  "pending_permissions": [],
  "pending_questions": [],
  "waiting": [],
  "events": [
    { "at": "2026-09-26T12:00:00Z", "event": { "type": "history_replay_started" } },
    { "at": "2026-09-26T12:00:00Z", "event": { "type": "user_message_chunk", "item_id": "01JITEM00000000000000000000", "offset": 0, "message_id": "msg_1", "content": { "type": "text", "text": "Reply with exactly: pong" } } },
    { "at": "2026-09-26T12:00:00Z", "event": { "type": "history_replay_finished" } },
    { "at": "2026-09-26T12:00:00Z", "event": { "type": "session_opened", "session_id": "ses_f21af0c5affeXDLbos1Pv8SITT", "mode": "load", "capabilities": { "load": true, "list": true, "close": true, "images": false, "reload": false, "rewind_conversation": false, "rewind_files": false, "rewind_both": false, "fork": false, "interrupt": false, "attachments": false, "find": false }, "config_options": [] } }
  ]
}
```

- `session_id`, `location` and `agent_kind` — the provider's session id, where it runs
  (`{"scope": "mount", "mount", "path"}` for mount providers, or `{"scope": "paseo",
  "project_id", "workspace_id", "branch", "provider", "model"}`), and its provider.
- `older` — `null` when the relay holds the whole history; for Claude Code or Paseo with
  earlier turns, a cursor for history before the relay's first event.
- `status` — `idle`, `prompting`, `exited` (the agent ended on its own), or `closed`.
- `open_mode` — `new` for a started session, `load` for an opened one.
- `capabilities` — what the session supports now: `load`, `list`, `close`, `images`, `reload`,
  `rewind_conversation`, `rewind_files`, `rewind_both`, `fork`, `interrupt`, `attachments` and
  `find`, as `on_coding_agent_event` describes for `session_opened`, updated by each
  `capabilities_update` since.
- `pending_permissions` — the permission requests not yet answered.
- `pending_questions` — the question requests not yet answered, each as `question_requested`
  carries it.
- `waiting` — the messages the relay holds until the agent takes them, in arrival order, each
  `{message_id, sender}` as `prompt_queued` carries it.
- `config_options` — what `set_config_option` changes: a `select` control offers the value ids
  in `choices` (`ungrouped` `options`, or `grouped` `groups[].options`), a `boolean` control
  takes a switch. A Paseo session offers `mode`, `model`, `thinking`, and its provider's
  `feature.<id>` settings.
- `events` — the session's events, in the shapes `on_coding_agent_event` documents, oldest first;
  the chunks of one message that follow each other are joined into one entry, with the `offset`
  of the first. `start_session` and `open_session` give the events held by the relay;
  `read_session` limits those events to the requested window. OpenCode and Oh My Pi replay
  the whole history; Claude Code and Paseo open with the most recent turns.

`send_prompt` gives the id of the user message it sent, once the relay has it:

```json
{ "session_id": "01JSESSION0000000000000000", "message_id": "01JMESSAGE0000000000000000" }
```

- `session_id` — the coding session prompted, the same id `on_coding_agent_event` reports.
- `message_id` — the message's id. Its `user_message_chunk` events carry it as `item_id`, and its
  `prompt_queued`, `prompt_started`, `prompt_steered`, `cancel_requested`, `prompt_finished`
  and `prompt_failed` events as `message_id`. See [Acting on the reply](#acting-on-the-reply).

`answer_permission_request`, `answer_question` and `decline_question` answer once the agent has
taken the answer, with how the request ended, in the shape `permission_resolved` and
`question_resolved` carry it:

```json
{ "resolved": true, "resolution": { "outcome": "answered", "answers": ["main", "Tag it v2"], "given": [{ "selected": ["main"] }, { "selected": [], "custom": "Tag it v2" }] } }
{ "resolved": true, "resolution": { "outcome": "selected", "option_id": "once" } }
```

When another answer reached the agent first, such as one given in another Paseo client,
`resolution` is that answer. A relay of an earlier version answers `{ "resolved": true }` alone,
before the agent has taken it. Paseo refusing the answer fails the node (`paseo_rejected`, with
Paseo's reason), and so does Paseo not confirming it within 30 seconds (`agent_timeout`).

`cancel_running_prompt` gives `{ "message_id": "01JMESSAGE0000000000000000" }`, the message whose
turn it stopped, or `{ "message_id": null }` when nothing was running; that turn then ends with
`stop_reason: cancelled`. Every prompt not yet taken by the agent fails with `error.kind`
`dropped`. `set_config_option` gives `{ "config_options": [...] }`, the full set after the
change. `close_session` gives `{ "closed": true }`.

`archive_paseo_workspace` gives the archived workspace; `worktree_removed` says whether a
worktree workspace's directory is gone, and is `null` for any other kind:

```json
{
  "connection_id": "01JCONNECTION00000000000000",
  "workspace_id": "wks_...",
  "archived_at": "2026-11-17T10:00:00Z",
  "kind": "worktree",
  "directory": "/home/me/.paseo/worktrees/abc/feat-login",
  "worktree_removed": true
}
```

`list_paseo_worktrees` gives the project's worktrees in Paseo's order. `branch` is `null` for a
detached worktree; `workspace_ids` lists the workspaces the Coding Agents page shows on it, and
is empty when it shows none:

```json
{
  "connection_id": "01JCONNECTION00000000000000",
  "worktrees": [
    {
      "worktree_path": "/home/me/.paseo/worktrees/abc/feat-login",
      "branch": "feat/login",
      "head": "4f2a9c1",
      "created_at": "2026-11-16T09:30:00Z",
      "workspace_ids": ["wks_..."]
    }
  ]
}
```

`remove_paseo_worktree` gives the worktree removed, whether its directory is gone (`removed`), and
the Paseo agent ids archived with it:

```json
{
  "connection_id": "01JCONNECTION00000000000000",
  "branch": "feat/login",
  "worktree_path": "/home/me/.paseo/worktrees/abc/feat-login",
  "removed": true,
  "archived_agents": ["agent_..."]
}
```

An archive or removal that takes Paseo longer than 50 seconds fails with `agent_timeout`, and
Paseo finishes it regardless; `list_paseo_worktrees` or `list_coding_sessions` then shows the
outcome. Repeating it once it is done is refused not found, which a cleanup can treat as done. A
directory Paseo failed to delete is still listed, so `remove_paseo_worktree` can retry it.

### Reading a session

`read_session` is a window onto the end of the session: every event of its last `limit` items
(500 when `limit` is empty), from the first event of the earliest of them on, together with the
events in that range that belong to no item, such as `prompt_started` and `prompt_finished`. The
session's whole state (`status`, pending requests, `config_options`, and a Paseo session's
`delegates` and `background`) comes with it, whatever the window. `delegates` lists the subagents,
the agents the coding agent handed work to, and `background` its background work, each in the shape of
`on_coding_agent_event`'s `activity_update`; both are empty for other coding agents.

- A session with fewer items than `limit` is read whole.
- A read larger than the relay connection's 10 MiB fails naming its size and the limit, such as
  "The relay … could not answer: The relay's response is 13.5 MiB (14203511 bytes), over the
  relay connection's 10 MiB (10485760 bytes) limit." A smaller `limit` is how such a session is
  read.

### Acting on the reply

The reply, a failed turn, and a permission or question the agent asks arrive as events. Start a
workflow from them with `on_coding_agent_event`: leave its `session_id` unset (`null`) when the workflow
starts the session itself, and pick the `event_types` it acts on:

```json
{ "on_coding_agent_event": { "connection": "01J...", "session_id": null, "event_types": ["prompt_finished", "prompt_failed", "prompt_steered", "permission_requested", "question_requested"] } }
```

Keep the `session_id` (S) and `message_id` (M) the `send_prompt` returned where the workflow
keeps its state, such as a table row, and match each event against them:

- `prompt_finished` with `session_id` S and `envelope.event.message_id` M — the turn ended, with
  `stop_reason` `end_turn`, `max_tokens`, `max_turn_requests`, `refusal` or `cancelled`.
- `prompt_failed` with the same match — the turn failed, or the prompt was never delivered.
  `error.kind` says how: `provider` (with `message` and optional `code`: Paseo refused it, the
  provider failed, or it was not delivered within 30 minutes), `rpc` (the agent's own error),
  `agent_exited`, `dropped` (stopped with `cancel_running_prompt` before it was delivered), or
  `undecodable`.
- `prompt_steered` with the same match (Claude Code or Paseo) — the prompt joined the running turn and
  gets no end of its own. It ends with that turn: the `prompt_finished` or `prompt_failed` whose
  `message_id` is that of the turn's `prompt_started`, the latest one in S before the steer.
- `permission_requested` or `question_requested` with `session_id` S — the running turn waits on
  someone. These carry no `message_id`: a session runs one turn at a time. Answer with
  `answer_permission_request`, `answer_question` or `decline_question`, passing
  `envelope.event.request_id`.
- `agent_exited` with `expected: false` and `session_id` S — add it to `event_types` to notice a
  session that dies between turns. A prompt it ends still ends with its own `prompt_failed`
  (`agent_exited`).

To read the reply, follow the event with `read_session` on `{{ input.session_id }}`: the reply is
the text of the `agent_message_chunk` events in `read.events` between the `prompt_started` and the
`prompt_finished` that carry M, in order. Every tool call, thought and message of the turn is an
item, so set `limit` high enough that the user message M is among the last `limit` items. The
reply never contains Paseo's errors: a turn's error is its `prompt_failed`, or, read from
replayed history, an error `notice` among the turn's events.

A turn can end within a second of being sent, so the listening run may start before the sending
run has finished its later nodes. A workflow that keeps state across the two orders them itself,
for example with a semaphore both take; `message_id` matches them whichever runs first. Events
travel from the relay separately from the prompt's answer: a static relay posts them to the app's
URL, so the relay machine must reach it, and events sent while the Relay is disconnected are lost;
see [On Coding Agent Event's delivery behavior](/docs/nodes/on_coding_agent_event#delivery-behavior).
