Skip to Content
PyoDocs

For AI agents

The commands a coding agent runs to deploy an app to Pyo, and what to ask the person first.

This page is written for AI coding agents. If someone asked you to deploy an app to Pyo, follow it from top to bottom. It's also plain Markdown at https://pyo.dev/md/ai-agents.md.

Pyo is a platform a person runs on their own servers, or uses hosted as Pyo Cloud. Every Pyo has its own address, like https://pyo.example.com. The pyo CLI deploys a folder to it.

Before you start

  • Find the Pyo's address. Run pyo whoami. If it prints an account, you're signed in and can skip to Deploy. If not, ask the person for their Pyo's address. Pyo Cloud's is https://cloud.pyo.dev. Don't guess one.
  • Don't install Pyo itself. https://pyo.dev/install.sh turns a server into a Pyo. Run it only when the person asks to install Pyo on that machine. Deploying an app needs only the CLI.

1. Install the CLI

On Linux and macOS:

curl -fsSL https://pyo.dev/cli.sh | sh
pyo --version

It installs to /usr/local/bin when that's writable, and to ~/.local/bin otherwise. If pyo isn't found afterwards, add ~/.local/bin to PATH. For Windows, see the CLI page.

2. Sign in

pyo login --url https://your-pyo

It prints a code and a link, then waits up to 10 minutes. Show both to the person. They open the link in a browser, type the code and approve. It needs no terminal input, so it works from an agent's shell.

With an API key there's no browser step. The person makes the key under API keys in Pyo. Making a new service needs a key with full access. Set these in the environment, and don't write the key to a file in the repository:

export PYO_URL=https://your-pyo
export PYO_API_KEY=<api-key>

3. Deploy

From the app's folder:

pyo deploy

In a folder with no pyo.jsonc, it makes a service named after the folder, links the folder by writing pyo.jsonc, uploads the folder and builds it. It builds with the folder's Dockerfile, or without one by detecting the language. Then it follows the deployment to the end and exits with an error when the build or the deploy fails.

In a folder that has a pyo.jsonc, it deploys the service that file names.

ToPass
Name the new service--name web
Choose its project, made when there's none by that name--project shop
Choose the team or the cluster--team acme, --cluster home
Deploy to a service that exists alreadypyo link shop/api, then pyo deploy

.gitignore and .pyoignore decide what's uploaded. .env files aren't sent. Set variables with pyo env set KEY=value, with --secret for secrets, or send a .env file's with pyo env push.

4. Check it

pyo status          # state, live version and domains
pyo logs            # the service's logs
pyo logs --build    # the latest deployment's build and deploy log

Add --json to a read command for JSON and nothing else.

When a command stops

It saysDo this
Not signed in. Run: pyo loginSign in as in step 2.
Say which project with --project.The team has more than one project. Run pyo deploy --project <name>.
This team has no cluster to deploy to. Add a server first.Ask the person to add a server in Pyo. See Clusters.
Deploying a folder needs a builder. Add one in Builders, then deploy again.Ask the person to add a builder in Pyo. See Builders.
The build or the deploy failsRead pyo logs --build, fix the cause in the code or in pyo.jsonc, and run pyo deploy again.

Settings and domains

A service's port, health check, replicas, resources and variables go in pyo.jsonc, next to the code. pyo deploy applies the file each time.

pyo domain add app.example.com

This serves the service on a hostname without a redeploy. pyo domain list shows each domain's status.

Ask the person first

  • Before you delete a service, a database, a volume or a domain.
  • Before you change a service you didn't make in this session.
  • Before you put an API key or another secret in a file.

pyo rollback puts the previous version back when a deploy you made breaks the service.

Set the folder up for next time

pyo agents --client claude --yes

This writes a Pyo section in AGENTS.md with the Pyo's address, the linked service and the commands above. --client also adds Pyo's MCP server to that client's project config: claude, cursor, vscode or codex. The MCP server is at https://your-pyo/api/mcp, and the client signs in with OAuth, so no key goes in a file.

More to read

On this page

Edit page