> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Agent manifest

> Schema, entry selection, auto-start behavior, and error codes for the .runtype/agents.yaml relay manifest.

An agent manifest stores the settings that `npx @runtypelabs/connect relay` uses to reach a local agent or Model Context Protocol (MCP) server. With a manifest in your repository, you can run `relay` without flags. If your local server isn't running, `relay` can start it and stop it again on exit.

## File location and discovery

By default, `relay` looks for `.runtype/agents.yaml` at your git repository root, then checks `.runtype/agents.yml`. Outside a git repository, `relay` looks for `.runtype/agents.yaml` and `.runtype/agents.yml` in the current directory. To load a manifest from another path, pass `--manifest PATH` relative to the current directory.

Only `relay` reads the manifest. You write the file yourself and commit it with your code.

## Example manifest

The following example defines a local `chat` agent in `.runtype/agents.yaml` with auto-start and a readiness check:

**`.runtype/agents.yaml`**

```yaml title=".runtype/agents.yaml"
agents:
  support-agent:
    agentId: AGENT_ID
    cwd: apps/support
    command: pnpm dev
    forwardTo: http://127.0.0.1:3030/chat
    protocol: chat
    healthPath: /health
    readyTimeoutMs: 30000
```

Replace `AGENT_ID` with the ID of your agent in Runtype.

From the repository root, start the relay with this manifest:

**`Start the relay`**

```bash title="Start the relay"
npx @runtypelabs/connect relay --connect
```

## Manifest fields

The `relay` command rejects a manifest that contains an unknown key. Every field after `agents.ENTRY_NAME` goes inside an entry under `agents`:

| Key                 | Type    | Required    | Default         | Rules                                                                                                                                                                                                                                                                |
| ------------------- | ------- | ----------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `agents`            | Object  | Yes         | None            | Must contain at least one entry.                                                                                                                                                                                                                                     |
| `agents.ENTRY_NAME` | Object  | Yes         | None            | A name of your choice that you select with `--entry`.                                                                                                                                                                                                                |
| `agentId`           | String  | Conditional | None            | Required when `protocol` is `a2a` or `chat`, unless you pass `--agent`. Not used when `protocol` is `mcp`.                                                                                                                                                           |
| `forwardTo`         | String  | Yes         | None            | Loopback URL that receives forwarded calls. For `a2a` and `chat`, must use `127.0.0.1`, `localhost`, or `::1` with no query string or fragment. For `mcp`, must use literal `127.0.0.1` or `[::1]` only (not `localhost`). Follows the same rules as `--forward-to`. |
| `protocol`          | String  | No          | `a2a`           | Must be `a2a`, `chat`, or `mcp`.                                                                                                                                                                                                                                     |
| `cwd`               | String  | No          | Repository root | Working directory for `command`, relative to the repository root. Must stay inside the repository.                                                                                                                                                                   |
| `command`           | String  | No          | None            | Shell command that starts the local server in `cwd` when the server isn't reachable.                                                                                                                                                                                 |
| `healthPath`        | String  | No          | None            | Readiness path resolved against the origin of `forwardTo`. Must start with `/`, must not start with `//`, and must contain no whitespace.                                                                                                                            |
| `readyTimeoutMs`    | Integer | No          | `15000`         | Wait time in milliseconds before startup times out. Must be an integer from `500` to `120000`.                                                                                                                                                                       |

## Entry selection and CLI flags

Run `relay` with manifest options:

**`relay manifest usage`**

```bash title="relay manifest usage"
npx @runtypelabs/connect relay [--entry ENTRY_NAME] [--manifest PATH] [FLAGS]
```

Replace the following:

* `ENTRY_NAME`: the key name of an entry under `agents`.
* `PATH`: the path to a manifest file, relative to the current directory.
* `FLAGS`: any other `relay` flags, such as `--connect` or `--no-start`.

### Manifest flags

Pass the following flags to `relay` to control how it loads and runs a manifest:

* `--manifest PATH`: loads the manifest from `PATH`, relative to the current directory.
* `--entry ENTRY_NAME`: selects one entry from `agents` by key name.
* `--no-start`: skips running `command` even when the local server isn't reachable.

### How `relay` loads and selects an entry

The `relay` command reads the manifest when any of the following conditions applies:

* You pass `--manifest` or `--entry`.
* You omit `--forward-to`.
* You omit `--agent` for a protocol other than `mcp`.

If the manifest defines one entry, `relay` selects it automatically. With more than one entry, you must pass `--entry ENTRY_NAME`. Without `--entry`, `relay` exits with code `2` and lists the available entries (`Multiple agents are defined in the manifest (a, b); pass --entry <name> to select one`). If you pass `--entry` when no manifest exists, `relay` exits with code `2` and prints `No .runtype/agents.yaml manifest found for --entry`.

Explicit `--agent`, `--forward-to`, and `--protocol` flags override the corresponding fields from the manifest.

## Auto-start and shutdown

When an entry defines `command` and you don't pass `--no-start`, `relay` checks and starts your local server in three steps:

1. `relay` sends an HTTP `GET` request to check readiness. When `healthPath` is set, `relay` resolves it against the origin of `forwardTo` and counts only a 2xx response as ready. Otherwise, `relay` sends `GET` to `forwardTo` and counts any HTTP response as ready.
2. If the local server is already reachable, `relay` leaves that process running and doesn't stop it on exit.
3. If the local server isn't reachable, `relay` runs `command` in `cwd` through a shell. It repeats the readiness check until the server responds or `readyTimeoutMs` passes, and prints `Started local target (COMMAND) in DIR.` when it starts the command.

If you pass `--no-start` or omit `command`, `relay` starts no process and pairs with `forwardTo` directly.

### Shutdown

When `relay` exits, it stops the process that it started, including that process's child processes. It never stops a server that was already running.

## Errors

The following table lists the manifest validation and auto-start errors that `relay` can return, with each error's `code` and `reason` fields:

| Code            | Reason                      | Exit code | Meaning and fix                                                                                                                                                                                                             |
| --------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config`        | `manifest_parse_error`      | `2`       | `relay` couldn't parse the manifest YAML (`Could not parse PATH: ...`). Fix the YAML syntax. The manifest doesn't support YAML anchors, aliases, or tab indentation.                                                        |
| `config`        | `manifest_invalid`          | `2`       | One or more manifest fields failed validation (`Invalid manifest in PATH: field: message; ...`). Fix the reported fields and remove any unknown keys.                                                                       |
| `config`        | `manifest_not_found`        | `2`       | `relay` found no file at the `--manifest` path, or you passed `--entry` and the repository has no `.runtype/agents.yaml`. Create `.runtype/agents.yaml` or pass a valid `--manifest` path.                                  |
| `config`        | `manifest_unreadable`       | `2`       | `relay` couldn't read the manifest file. Check file permissions and verify that the path points to a readable file.                                                                                                         |
| `invalid_value` | `manifest_entry_not_found`  | `2`       | `relay` found no entry matching `--entry` (`No agent named "NAME" in the manifest`). Select a name shown in the `Available agents` hint.                                                                                    |
| `usage`         | `manifest_entry_ambiguous`  | `2`       | The manifest defines multiple entries and `--entry` is missing (`Multiple agents are defined in the manifest (a, b); pass --entry <name> to select one`). Re-run with `--entry`.                                            |
| `config`        | `manifest_cwd_outside_repo` | `2`       | `cwd` is an absolute path or points outside the repository. Set `cwd` to a relative path inside the repository.                                                                                                             |
| `config`        | `relay_start_failed`        | `2`       | `relay` couldn't start `command` (`Could not start "CMD": ...`). Check `command` and `cwd` in `.runtype/agents.yaml`.                                                                                                       |
| `config`        | `relay_start_exited`        | `2`       | The start command exited before becoming ready (`Local target command "CMD" exited before becoming ready (exit code N)`). Inspect the captured output in the hint.                                                          |
| `timeout`       | `relay_start_timeout`       | `4`       | The local server didn't become ready before `readyTimeoutMs` elapsed (`Local target did not become ready at URL within Nms`). Increase `readyTimeoutMs` in `.runtype/agents.yaml` or verify that the server starts cleanly. |
| `interrupted`   | None                        | `130`     | A signal such as Ctrl-C interrupted startup before the server became ready.                                                                                                                                                 |

## Next steps

Continue with one of the following pages:

* [Test against your real agent](/simulate/test-against-your-real-agent): pair a local agent or MCP server and run simulations against it.
* [Connect CLI](/reference/connect-cli): look up all `relay` flags, global options, and CLI exit codes.
* [Troubleshooting](/reference/troubleshooting): resolve sign-in, ingest, and relay errors.