# agents.md: working with plori (for AI agents)

Plori runs AI agents in cloud Workspaces. Give an agent a task and keep its files for the
next run. Several agents can work together when a task needs them.

A Workspace holds a project's files under `/workspace`, saved versions of those files, a
main conversation and the run history. Its agents work on the files with a shell and network
access. Only the files under `/workspace` are kept between runs.

## Start here

For Claude Code, send this in the conversation:

> Set up https://plori.ai/SKILL.md

Claude Code reads the connection instructions, adds the MCP server and pairs the account
with a short code. The account owner signs in and approves in a browser, also on a phone. If
the client blocks the pairing request, the instructions fall back to Claude Code's browser
OAuth. No plugin is required. If a newly added server has not loaded, ask the user to type
`/reload-plugins` in the same conversation, then continue. Confirm the MCP connection
before you start work. First task:

> Create a Workspace on plori, have its agent clone github.com/lukeed/clsx and run its tests, and show me the result. Then check
> the account balance with get_credits.

Credentials and OAuth: https://plori.ai/auth.md

## From a terminal

The `plori` CLI uses the same account and the same agents:

```sh
curl -fsSL https://plori.ai/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
plori login
plori attach <agent-name>
```

The installer writes one binary to `~/.local/bin` and edits no shell rc file; add the
`export` line to the rc file to keep it. On Windows, `irm https://plori.ai/install.ps1 | iex`
installs to `%LOCALAPPDATA%\plori\bin` and sets the user PATH itself.

`plori attach` opens a live session: history, a prompt and streaming output, on the same
thread the web app shows. The CLI approves in the terminal with either sign-in, except
in a run that an MCP client started; those approvals open in the web app. It expects a
human at the keyboard; for scripted use stay on the one-shot commands (`plori run`, `result`, `inputs`,
`answer`), which print JSON when stdout is not a terminal. Attach itself always prints
plain text, and with stdin or stdout redirected it drops the prompt and only tails the
session. Attaching gives the agent no access to the local machine: its shell and files
are in its cloud Workspace. Command reference: https://plori.ai/docs/cli

## Direct REST integration

If you are writing code rather than operating an MCP client, use `https://api.plori.ai/v1` with
the same bearer credentials. Key endpoints:
  `POST /v1/agents` (create), `POST /v1/agents/{id}/runs` (invoke, returns
  `202 {run_id, session_id}`, accepts `Idempotency-Key` and `max_turn_tokens`),
  `GET /v1/agents/{id}/runs` (history),
  `POST /v1/agents/{id}/runs/{run_id}/cancel` (stop),
  `POST /v1/agents/{id}/schedules` (deferred runs), `GET /v1/users/{id}/credits`.

Capability index: https://plori.ai/llms.txt. The public docs, blog and product pages are also
Markdown (append `.md` or send `Accept: text/markdown`). Skill catalog:
https://plori.ai/.well-known/skills/index.json

## The tools

Workspaces: `list_workspaces` lists them (pass `workspace_id` for one). `create_workspace`
makes one with its own agent; pass an `idempotency_key` so a retry returns the same
Workspace. Names are not unique, so reuse one Workspace instead of creating new ones.
`delete_workspace` permanently deletes a Workspace's files, saved versions, copies and
conversations.

Tasks: `send_workspace_message` sends a task to a Workspace and by default waits for the
reply. For work that can be split, send the whole task: the Workspace's own agent splits it
between several agents, merges their changes and fixes conflicts itself. If the result is
`running`, call `get_run_result` after `poll_after_seconds`. Set `max_turn_tokens` for an
optional token ceiling on a turn, and call `cancel_run` to stop a run. `get_run_result`, `cancel_run`, `list_runs`,
`list_pending_inputs` and `schedule_run` take the `workspace_id`. `read_workspace_file`
reads a file of a saved version. `upload_workspace_file` writes a file: text up to 262144
bytes as `content`, or a larger or binary file of up to 32 MiB through the returned
one-time upload URL and `curl` command. A file named `AGENTS.md` at the Workspace root holds
instructions for the Workspace's agents, and each run reads it when the run starts. Writing the
file replaces its text. Instructions for a single run belong in that run's message.

Approvals: a run started through MCP or a schedule pauses before each action outside the
Workspace (connected-account writes, outbound HTTP writes, git push, publishing, deploys,
email, public tunnels, irreversible browser actions, workflow activation) until the account
owner approves that one action in the web app, through the item's `approve_url`. You cannot
approve or grant `always_allow`. `list_pending_inputs` lists the queue, and
`answer_pending_input` can deny a request or answer a question. `schedule_run` defers a
run (delay or RFC3339 time); it is queued only after the owner opens the returned
`confirm_url` and confirms.

Running agents yourself (only when your client manages them): `create_workspace_worker`
starts an agent on its own copy. Plori submits changed files when its run completes normally
and accepts a clean comparison. Check `get_workspace_worker` (`save_state`, `change_status`,
`changeset_id`), then `get_workspace_changeset` or `list_workspace_changesets` for the result.
Use `submit_workspace_changeset` only for saved, unsubmitted work after an error, cancellation
or stop, or after `recompare_required`. Accept `review_ready` with
`accept_workspace_changeset` and evidence of your checks, or discard with `reject_workspace_changeset`.
For `needs_resolution`, ask the Workspace's agent to combine files with `send_workspace_message`,
or reject and start another worker. `list_workspace_workers` lists workers,
`steer_workspace_worker` messages one, and `stop_workspace_task_group` stops a group.
On 409 `current_revision_conflict`, submit again.

Account: `get_credits` reports the balance and `get_workspace_costs` what a Workspace's
runs cost. `list_workspaces`, `list_runs` and `get_credits` are free reads. The MCP server
does not list workflow tools, usage and disk reads, trash emptying, or connection status. Use
the web app, the REST API or the CLI for those.

## Retries and concurrency

A run is nondeterministic and billable, so retry with a key, never blindly. Send
`Idempotency-Key: <your key>` on `POST /v1/agents/{id}/runs`, or pass `idempotency_key` to
`send_workspace_message`: a retry with the same key returns the original run for 24 hours.
The same key with a different message is a 422. A retry while the first is still submitting
is a 409.

Registered accounts have no limit on concurrent agent runs across their agents.
Anonymous trials allow at most 2 concurrent agent runs.
A third run returns 429 with `Retry-After` and advice to register free to remove the limit.
Plans limit active workflows, not concurrent workflow runs.
Turns on one agent are not queued for you. Wait for each run to finish if you need order.

## Costs

Running an agent spends the account's credits. Awake compute is $0.01 per minute,
billed by the second, on every plan. Model usage always draws
credits, billed at the model's real provider cost, at cost with no markup ($0 when the
account brings its own model key).
The Plori Router picks one model per request from a pool shared by every plan; it does not
read your task to choose. Idle agents sleep and stop billing for compute;
plan-included disk is free and extra disk is $0.10 per GB per month. A workflow run
is $0.01 with 90 seconds of runtime included, then $0.01 per started minute
(5-minute safety stop), plus each AI step's model usage. Discovery and read tools are
free. Check `get_credits` before taking on long work. Rate cards:
https://api.plori.ai/v1/pricing/models (model token rates), https://api.plori.ai/v1/pricing/tools (tools
and workflows), and https://plori.ai/pricing

## More

- Connect guide (per-client setup): https://plori.ai/mcp
- Full agent skill (tool order, errors): https://plori.ai/SKILL.md
- CLI and terminal attach: https://plori.ai/docs/cli
- Credentials and OAuth detail: https://plori.ai/auth.md
- Site index for agents: https://plori.ai/llms.txt
- Questions from your human: agent@plori.ai
