Skip to content
CLI tool · Cloud & deploy

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.

flyby Fly.io
What it is

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

Install flyctl

The install commands from the official docs. Check it worked with fly version.

Homebrew
brew install flyctl
Install script (macOS, Linux)
curl -L https://fly.io/install.sh | sh
Auth

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.

Check the sign-in (read-only)
fly auth whoami
Interactive sign-in (human)
fly auth login
Create a deploy token for one app
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.

Common agent tasks

What agents use flyctl for

Example commands with placeholder names. Swap in your own project, app, or file names.

  1. Check app and machine status

    fly
    fly status -a my-app
  2. Read recent logs without streaming

    fly
    fly logs -a my-app --no-tail
  3. List releases

    fly
    fly releases -a my-app
  4. List secret names

    fly
    fly secrets list -a my-app

    Shows names and digests, not values.

Safety

Safety rules for agents

Safe to run without asking

  • fly auth whoami
  • fly status
  • fly logs --no-tail
  • fly releases
  • fly secrets list

Ask a human first

  • 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.
Agent instructions

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.

AGENTS.md
## 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.
CLI or MCP server?

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.

Same category
All Cloud & deploy tools
FAQ

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.