# One Liya app for every agent

Add one Liya app to Microsoft Teams or Google Chat for the whole organisation. Each person sees the agents they may use, picks one, and talks to it with buttons, steps and approvals in the chat.

With one Liya app, nobody has to install a bot per agent. An administrator adds Liya once for the whole organisation. Each person opens Teams or Google Chat, writes to Liya, and picks the agent they need from a list of the agents they are allowed to use.

## What people see

- **The agent list.** The first message, or typing `agents`, shows a card with the agents this person may use. Each agent has a **Talk to …** button. The question that opened the list is answered by the agent they pick.
- **Staying with one agent.** After the pick, every message goes to that agent until the person types `switch` (pick another) or `new` (start fresh and pick again). Typing an agent's name also picks it.
- **Choices as buttons.** When an answer asks the person to choose between a few options, or ends with a yes or no question, the options are buttons. In a one-to-one chat they show as suggested replies. In a group chat or a space they show on a small card.
- **Steps.** Under an answer that used tools, a short card says how many tools were used. **Show steps** opens one line per tool with its result. In Google Chat this is a section you expand. The lines are kept the same way the console keeps a session: credentials are removed and a result the provider does not keep is not shown.
- **Approvals.** When an agent asks to make a change that needs approval, the person who asked gets a card that says whom it is waiting for. The card changes to the decision once someone decides. The approver gets the request card with a reason box, **Approve** and **Reject**, in Teams or in Google Chat.

## Who sees which agent

A person sees an agent only when all of these hold:

1. The app's access setting lets them in (everyone in the tenant or domain, a list of people, a group, or people with a Liyagent account).
2. They have an enabled Liyagent account. Liya matches their Entra sign-in name (Teams) or their Workspace email (Google Chat) to the account name.
3. Their role holds **Chat with agents** (`agents.chat`) or **Operate agents** (`agents.operate`).
4. The agent is a chat assistant, not a ticket pipeline or oversight step.
5. No policy forbids them to `invoke` it.

This is the same rule the employee workspace uses for its agent list. An agent a policy forbids is not on the card, and its name is never shown. Every message is checked again, so a person who loses access is told so and shown the list, and the agent does not answer them.

People without a Liyagent account are told to ask their administrator, and see no agents.

## Turn it on

The app is a normal Teams or Google Chat trigger with **One app for every agent** turned on. The trigger's own agent is used for the welcome message only.

```http
PUT /api/triggers/liya
{ "agent": "copilot", "kind": "teams", "mode": "bot",
  "bot_app_id": "<app id>", "bot_tenant_id": "<tenant id>",
  "bot_app_secret_ref": "TEAMS_BOT_SECRET", "chat_router": true }
```

For Google Chat, add `"chat_router": true` to the Google Chat trigger from [Google Chat app](/docs/connect/google-chat).

Single-agent triggers keep working as before. You can keep them next to the Liya app.

## Roll it out in Microsoft Teams

1. Set up the bot and the trigger as in [Microsoft Teams app](/docs/connect/teams), with `chat_router` on.
2. Build the package from the trigger (`GET /api/triggers/{name}/teams-app`), or offline with `python deploy/teams/build-package.py --router …`. The package lists the commands `agents`, `switch`, `new` and `help`.
3. In the **Teams admin center**, go to **Teams apps → Manage apps → Upload new app** and upload the zip. Check that the app is **Allowed**.
4. Go to **Teams apps → Setup policies → Global (Org-wide default)**. Under **Installed apps**, add Liya. Under **Pinned apps**, add Liya so it shows in the Teams app bar. Save.
5. People get Liya within a few hours. They open it and start writing.

Approval cards reach an approver in their one-to-one chat with Liya. An approver who has written to Liya at least once can decide from Teams.

## Roll it out in Google Chat

1. Set up the Chat app and the trigger as in [Google Chat app](/docs/connect/google-chat), with `chat_router` on.
2. In the Google Cloud console, under **Google Chat API → Configuration**, set **Visibility** to your whole domain.
3. In the **Google Workspace Admin console**, go to **Apps → Google Workspace → Google Chat → Manage Chat apps** (or **Chat apps settings**). Allow users to install Chat apps, and add Liya to the allowlist if you use one.
4. To install Liya for everyone, open the app in **Apps → Google Workspace Marketplace apps** (for a private app, **Apps → Google Workspace → Google Chat → Chat apps**) and install it for the organisation or for chosen organisational units.
5. People find Liya under **Apps** in Google Chat, open a direct message, and start writing.

Approval cards reach an approver in their direct message with Liya. In a space, Liya shows the waiting card in the thread but sends the approval card only to the approver.

## Audit

Each pick is audited as `teams.router.picked`. A refused pick is `teams.router.refused`, a lost agent is `teams.router.lost`, and someone without an account is `teams.router.no_account`. Approvals decided from Google Chat are audited as console decisions are, with `via: googlechat`.
