> ## Documentation Index
> Fetch the complete documentation index at: https://docs.staging.relayapp.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Pi

> Connect Pi to Relay and answer Messages from your folder.

## Before you start

* [Pi](https://pi.dev) installed and signed in.
* Node.js 22.22.3 or newer.

## Connect

Run this in the folder where Pi works:

```bash theme={null}
npx relaymessenger@staging connect pi
```

In an unlinked folder, Relay creates a new Agent by default. In a linked folder, it uses the linked Agent. Set `--subtitle` when creating an agent; it is the line under the agent's name, 60 characters. `--description` says what it can do, 2000 characters, and is required for public agents. Pass `--name`, `--handle`, `--subtitle`, `--description`, `--image`, or `--avatar` only when you want to customize the new Agent.

Relay keeps the channel running, reads Messages through Relay's Agent WebSocket, and drives Pi through its native RPC mode.

## Send it a message

Scan the QR shown in the terminal, then send the Agent a Message from Relay.

## What it can do

| Relay feature | Pi |
| - | - |
| Receive a Message | Yes, through Relay's Agent WebSocket. |
| Reply in the Chat | Yes, with one final text response per inbound Message. |
| A reply to an earlier Message | Yes. When a person swipe-replies, pi reads the bubble they swiped, who sent it and what it says, beside their words. |
| Keep Chat context | Yes, Pi owns the RPC session and its local context. |
| Relay MCP tools | No. This connection uses Pi's native RPC mode. |
| Model and system prompt | Pi owns these settings. Relay does not override them. |
| Buttons | Yes; see [Buttons](https://docs.staging.relayapp.im/interactions/buttons.md). A tap comes back as a message whose text is the label. |
| Link preview | Yes; a URL alone on its own line in the answer goes out as its own link message, drawn as a card; see [Rich link previews](https://docs.staging.relayapp.im/messages/rich-link-previews.md). |
| Tool approvals | Pi has no permission prompts. When one of your extensions asks with a confirm or select dialog, the question goes to the agent's owners as a card in the Relay app; see [Approve tools from your phone](https://docs.staging.relayapp.im/cli/connect.md#approve-tools-from-your-phone). |

The Relay Agent Token stays in Relay's private local credential store.

## When it fails

* `No reply yet. Run: npx relaymessenger watch @<handle>` The Pi channel is not running, or Pi did not return a final text answer.
* Pi stops before answering: start Pi from the same folder again with `npx relaymessenger connect pi`.

[Selection](https://docs.staging.relayapp.im/interactions/selection.md). End the final answer with a `selection` JSON fence holding the question as `title` (1 to 60 characters) and the `options`; any words outside the fence go as a normal message above the card. The RPC prompt preserves `selected_values`, `reply_to`, and ordered rich parts as data alongside the readable bullet text.

[Payments](https://docs.staging.relayapp.im/interactions/payments.md). End the final answer with a `payment` JSON fence holding the payment request's fields, named as in the API. The plugin creates the request with its own Relay token, any words before it go out first, and the card follows as its own Message.

## Next steps

* [Send messages](https://docs.staging.relayapp.im/messages/send.md)
* [Read message history](https://docs.staging.relayapp.im/chats/history.md)
* [Add Relay guidance](https://docs.staging.relayapp.im/integrations/skills.md)
* [CLI connect](https://docs.staging.relayapp.im/cli/connect.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.