flyctl for AI agents
flyctl, the Fly.io CLI, for coding agents: check app status, read logs, list secrets, and deploy, with the commands an agent should leave to a human.
What flyctl does for an agent
flyctl is Fly.io's official command-line tool. It launches and deploys apps, shows machine status and logs, manages secrets and scaling, and opens SSH consoles on running machines. The binary is available as both flyctl and fly.
Most day-to-day agent work is read-only: status, logs, and releases. Deploys, secret changes, and scaling change what users see and belong behind approval.
Official site: fly.io
Install flyctl
The install commands from the official docs. Check it worked with fly version.
brew install flyctl
curl -L https://fly.io/install.sh | sh
Signing in flyctl for an agent
A human signs in with fly auth login. For CI and agents, create a scoped token (for example a deploy token for one app) and set it as FLY_API_TOKEN.
fly auth whoami
fly auth login
fly tokens create deploy -a my-app
Environment variables: FLY_API_TOKEN. Set them in the agent's environment; never paste values into prompts or commit them.
What agents use flyctl for
Example commands with placeholder names. Swap in your own project, app, or file names.
Check app and machine status
fly status -a my-app
Read recent logs without streaming
fly logs -a my-app --no-tail
List releases
fly releases -a my-app
List secret names
fly secrets list -a my-app
Shows names and digests, not values.
Safety rules for agents
Safe to run without asking
fly auth whoamifly statusfly logs --no-tailfly releasesfly secrets list
Ask a human first
fly deployfly secrets setfly scale countfly machine destroyfly apps destroy
- Always pass -a with the app name so commands never run against the wrong app.
- Setting secrets restarts machines; treat it like a deploy.
- Prefer an app-scoped deploy token over a personal token in agent environments.
AGENTS.md or CLAUDE.md snippet
Paste this into the instruction file your agent reads at the start of every session, then adjust the rules to your setup.
## flyctl (fly) Use `fly` for inspecting, deploying, and debugging apps on Fly.io. - Check it is installed with `fly version`. If it is missing, ask before installing it. - Auth: a human signs fly in. Check with `fly auth whoami`; if it fails, stop and ask. Never run the login flow yourself, and never print tokens (FLY_API_TOKEN). - Run without asking (read-only): `fly auth whoami`, `fly status`, `fly logs --no-tail`, `fly releases`, `fly secrets list`. - Ask a human first (changes or deletes things): `fly deploy`, `fly secrets set`, `fly scale count`, `fly machine destroy`, `fly apps destroy`. - Always pass -a with the app name so commands never run against the wrong app. - Setting secrets restarts machines; treat it like a deploy. - Prefer an app-scoped deploy token over a personal token in agent environments. - Prefer JSON output where the command supports it, and keep output short.
flyctl or an MCP server?
No official MCP server. MCPpedia has not confirmed a Fly.io MCP server it can recommend as official. Search the directory for community servers, or let the agent use flyctl's read-only commands.
Rule of thumb: in a terminal agent that a human has signed in, the CLI is usually faster and cheaper in context. In a chat client without a shell, or when you want a fixed set of typed tools, use an MCP server.
Other Cloud & deploy tools
flyctl questions
How do I install flyctl?
Homebrew: brew install flyctl. Other official options: Install script (macOS, Linux). Check the install with fly version, and see the Fly.io docs for other platforms.
How does an AI agent authenticate flyctl?
A human signs in with fly auth login. For CI and agents, create a scoped token (for example a deploy token for one app) and set it as FLY_API_TOKEN. The agent can check the sign-in with fly auth whoami and should stop and ask if it fails.
Which flyctl commands are safe for an agent to run?
Commands that only read state are safe to run without asking: fly auth whoami; fly status; fly logs --no-tail; fly releases; fly secrets list. Ask a human before anything that changes or deletes something: fly deploy; fly secrets set; fly scale count; fly machine destroy; fly apps destroy.
Is there an MCP server for flyctl?
MCPpedia has not confirmed a Fly.io MCP server it can recommend as official. Search the directory for community servers, or let the agent use flyctl's read-only commands.