# AI Assistant

Choose which accounts the AI assistant can use, link Telegram, and set limits on what you approve there.

> **In development, coming soon**
>
> The Assistant in the Polyester app is not available on Testnet yet.

The Polyester AI assistant answers questions about the markets and your accounts, and can trade for you once you approve each trade. **Settings > AI** decides what it can do: which accounts it can use, whether you approve its trades from Telegram, and how much you can approve there.

Open **Settings** from the gear in the top nav and choose **AI**, or go to [AI settings](https://testnet.polyester.com/account/settings/ai). Sign in first: these settings belong to your account. The page has two sections, **Telegram** and **Account access**.

## Account access

**Account access** sets what the assistant can do on each of your accounts. It can never withdraw or transfer funds, whatever you choose here.

Each account has its own level:

- **Off**: the assistant can't see or use the account. It can still chat about the markets and Polyester.
- **Read only**: it can see balances, orders, and history.
- **Trade with approval**: it can also place, change, and cancel orders and triggers, and swap. None of these happens until you approve it. It can also get a deposit address (it returns the existing one, or creates one when the network has none) and, on the Main Account, create, change and cancel your [price alerts](https://testnet.polyester.com/docs/user-docs/preferences/notifications#price-alerts). These run without an approval: they change no balance, order, or account setting.

The assistant trades only on a Subaccount. On the Main Account it reads your balances and history but places no orders. To let it trade, give a Subaccount **Trade with approval**.

The list always shows your Main Account and every account the assistant can already use. Your other Subaccounts wait under **Add account**. A Subaccount appears only where your role lets you manage its API keys. See [Members & Roles](https://testnet.polyester.com/docs/user-docs/subaccounts/members-and-roles).

### Give the assistant access to an account

1. Add the account

   Under **Account access**, select **Add account** and choose a Subaccount. Type in **Search accounts** to find it by name or ID. The account joins the list at **Read only**, marked **New**.

2. Choose the level

   Open the account's menu and choose **Read only** or **Trade with approval**. For your Main Account, open its menu in the list directly.

3. Save

   A bar at the bottom of the page counts your unsaved changes. Select **Save Changes**, or **Reset** to discard them.

4. Confirm it's you

   Polyester asks for MFA in a **Confirm it's you** dialog. Use your passkey, a code from your authenticator app, or a recovery code. The section shows **Access saved** when the change is done.

Giving access needs MFA on your account. Without it, saving stops with a prompt to set it up: select **Set up 2FA**, then save again. See [MFA & Recovery](https://testnet.polyester.com/docs/user-docs/account/access-and-security/mfa-and-recovery-codes).

### Change or remove access

- **Change a level**: choose another level in the account's menu and save. The row shows **Changed** until you do.
- **Remove one account**: choose **Off** and save. The row shows **Removing** until you do.
- **Remove every account**: select **Turn off everywhere** at the top of the section, then **Turn off**. The assistant can still chat. This needs no MFA check. To give access again later, add the accounts and save as before.

Access you give on a Subaccount is yours alone. It ends if you leave that Subaccount, or if your role there changes to one that can't manage its API keys.

### If an account shows a badge

- **Paused**: the assistant's key for this account is disabled on the [API Keys](https://testnet.polyester.com/account/api-keys) page. The assistant uses it again once you enable the key there.
- **Not finished**: setup didn't finish. Select **Finish setup** on the row and confirm with MFA. If you have other unsaved changes, **Save Changes** finishes it too.

If you changed the policy of the assistant's key on the API Keys page, the account's menu shows that policy's name as a **Custom policy**. Choosing **Read only** or **Trade with approval** replaces it. See [API Keys](https://testnet.polyester.com/docs/user-docs/account/access-and-security/api-keys).

## When the assistant lacks access

The assistant only uses the accounts and levels you set here. When a request needs an account set to **Off**, or more than **Read only**, it does nothing. It tells you which access is missing and points you to **Settings > AI > Account access**. Give the access there, then send the request again.

Each conversation works on one account. In the [Assistant](https://testnet.polyester.com/assistant), choose it in the account menu. In Telegram, send `/account`: it offers only the accounts the assistant can use. With no access to any account, the assistant still answers about the markets and Polyester.

## Approve trades

Every change the assistant proposes waits for your approval: an order, a trigger, a cancel, or a swap. The approval card shows what will happen, the account it acts on, and when it expires.

- **Approve** runs the action exactly as the card shows, once.
- **Reject** stops it. Nothing runs.

An approval expires after 10 minutes. If the assistant finishes or is stopped before you decide, its pending approval is canceled, unless it has already expired. In either case, the pending action does not run. Stopping the assistant does not undo an action you already approved. Your first decision stands.

You approve in the Assistant chat in Polyester. In Telegram, once it is linked, each card arrives as its own message: you can reject it, cancel orders, and pause triggers there. The card then updates to show the outcome.

> **In development, coming soon**
>
> Approving trades from Telegram is in development, coming soon. Until then, approve in Polyester.

The assistant never asks you to approve money leaving your account. Withdrawals, transfers, address book and whitelist changes, API keys, and account settings stay with you in Polyester.

## Link Telegram

Linking Telegram lets you chat with the assistant there and decide its approval cards from the Polyester bot.

1. Start linking

   Under **Telegram**, select **Link** next to **Account**. The **Link Telegram** dialog opens.

2. Open the Polyester bot

   On a computer, scan the QR code with your phone, or select **Open on this device**. **Copy link** copies the link instead. On a phone, tap **Open Telegram**. The dialog shows when the link expires.

3. Tap Start in Telegram

   In the bot, tap **Start**, then come back to Polyester. The dialog shows **Code received**.

4. Confirm your Telegram account

   The dialog shows the Telegram account that sent the code, with its name and ID. Select **Link account** if it's yours, or **Use a different account** if not.

5. Confirm it's you

   Polyester asks for MFA in a **Confirm it's you** dialog. When it's done, the dialog shows **Verified Telegram account**.

The **Account** row now shows your Telegram handle, and the approval limits appear below it. If you leave before confirming, the row shows **Finish linking** so you can continue.

- **Link expired**: the bot didn't receive your code in time. Select **Get a new link**.
- **Telegram already linked**: your Telegram is already linked to this account. Select **Done**.

Rejecting, canceling orders, and pausing triggers work in Telegram as soon as it is linked. Once approving from Telegram is available, it starts 24 hours after you link (or link again).

### Unlink Telegram

Select **Unlink** next to your Telegram handle, then **Unlink** to confirm. The bot stops acting for your account at once, and cards it already sent can no longer be decided there. Account access doesn't change; use **Account access** to change what the assistant can do.

## Approval limits for Telegram

> **In development, coming soon**
>
> Approving trades from Telegram is in development, coming soon. These limits apply once it is available.

Approval limits cap what you can approve from Telegram, in US dollars. They don't apply to approvals in Polyester itself. You set them only here, never from Telegram, and a change applies to your next approval.

- **Approve orders from Telegram**: turn it off to stop approving orders, swaps, and changes from Telegram. Canceling, pausing and rejecting always work.
- **Per-approval limit**: the largest order you can approve at once.
- **24-hour limit**: the total you can approve in any 24 hours. A bar shows what you have **Used**, the **Next approval up to** amount, and what is left.

To set a limit, turn on its switch, enter an amount in USD above 0, and select **Save**. To remove a limit, turn its switch off. The limit then shows **No limit**.

Limits count placing orders, swaps, changes to orders or triggers, and resuming a trigger. Stablecoins count one US dollar per unit; other Assets count at the current market price. While a limit is on, an approval that can't be valued is refused.

When an approval is over a limit, Telegram refuses it and shows its value and your limit. Approve it in Polyester instead, or change your limits here. For example, with a 24-hour limit of 2,000 USD and 1,800 USD already approved, a 300 USD order is refused in Telegram.

## For developers

The assistant acts through one assistant API key per account, bound to a policy that never allows money out. See [assistant keys](https://testnet.polyester.com/docs/developer-docs/authentication-security/api-key-lifecycle#assistant-keys), [API key policies](https://testnet.polyester.com/docs/developer-docs/account/api-key-policies#assistant-keys), and the [TypeScript SDK assistant reference](https://testnet.polyester.com/docs/sdk/typescript/reference/assistant).
