# Agents

Every AI chat's agent runs in its owner's sandboxed runtime, on a workspace runtime host or on the owner's own machine ([Machines](https://spyria.dev/docs/machines)). On Pi, each prompt runs on the prompter's key and accounts ([Chats and sharing](https://spyria.dev/docs/chats-and-sharing)).

## Harnesses

| Harness | Runs on | Model paid by | Model chosen by |
|---|---|---|---|
| **Pi** | a workspace runtime host | the prompter's API key, through Spyria's gateway | Spyria's routing |
| **Claude Code** | the owner's machine | the owner's Claude subscription | the owner |
| **Codex** | the owner's machine | the owner's ChatGPT plan | the owner |

The owner picks **Runs on** before the first prompt; fork the chat to change it later. Subscription sign-ins never reach Spyria, so sessions on a member's machine take prompts from the owner only and are not routed, metered or budgeted.

## Models and routing

On Pi, the model is chosen once, at the first prompt, among the models the prompter's keys reach and the workspace's AI providers allow. A classifier on the prompter's cheapest model reads the first message and may pick a large or small model; otherwise the prompter's best medium model is used. Owners and Editors can switch the model and effort afterwards. A later prompter whose keys cannot reach the session's model is refused.

## Tool management

The agent has Spyria's own tools (browser, screenshots, web search, public chats, posting in channels, delegation, GitHub in a dev chat) and the workspace's tools catalogue, which also works from the runtime's shell through `spyria`. Every call goes through Spyria with the prompter's access and is audited; a server switched off in the chat's **Connected tools** tab is refused.

Each member sets which calls wait for their approval in **Profile > Connections** (**Approvals** in a server's **⋯** menu), per tool:

| Tools | Default |
|---|---|
| Read | **Never** |
| Marked destructive | **Always** |
| Others, on servers each member signs in to and GitHub | **Never** |
| Others, on shared-login servers | **On a guest's prompt** |

Only the member whose account answers for the call approves it: the prompter, or the owner on shared-login servers. An unanswered call expires after 5 minutes.

## Budgets and usage

Admins set daily, weekly and monthly AI budgets per workspace role, each member getting the full amount. **Profile > Usage** shows your budget and spend; a notice appears at 80%, and at 100% your model calls are refused until the period ends or the budget is raised. A call in flight can overshoot by a few cents.

## Keys

LLM keys are added per workspace in **Profile > LLM keys** and stored in the gateway only; Spyria keeps a reference and the last four characters. Without one you can read AI chats but not prompt on Pi. **Profile > Connections** links your GitHub account and your sign-ins to the catalogue's servers.