Agent setup · Exercise 03

CLI

Install and authenticate cf, Cloudflare's new CLI, and tell your agent to prefer it over Wrangler.

CLI

cf is Cloudflare’s new command-line interface. It’s generated directly from Cloudflare’s API schema, so it covers the whole platform (over 3,000 operations, compared to Wrangler’s roughly 280), returns JSON by default so agents can filter its output, and includes cf cli search so your agent can find the right command by describing what it wants to do. It’s in open beta as of September 2026 and is the recommended CLI for new projects.

This exercise is just installation and authentication. You’ll use cf to build and deploy something in Deploy a Worker, in the Workers basics course.

Why not Wrangler?

Wrangler was Cloudflare’s developer CLI for years, and most of the docs, tutorials, and blog posts about Workers you’ll find online use it. Language models learned from that same material, so because of their knowledge cutoffs, they tend to only know about Wrangler and will reach for it by default.

cf is much newer, so your agent won’t discover it on its own. It needs explicit instructions pointing it at cf, which is what the last step of this exercise adds. Wrangler still works, and projects that already use it (anything with a wrangler.jsonc, wrangler.json, or wrangler.toml) can keep using it, but cf is the way forward for new projects.

Install

cf requires Node.js 22 or newer. Install it globally:

npm i -g cf

Check that it worked:

cf --version

Log in

cf auth login

This opens a browser window where you sign in to your Cloudflare account and approve access. If you don’t have an account yet, you can create a free one there. Confirm you’re logged in:

cf auth whoami

Tell your agent to use cf

This is the pointer your agent needs to use cf instead of the Wrangler commands from its training data. Add this section to your agent’s global instructions file (the one from the Instructions exercise), replacing any existing guidance about Wrangler:

## Cloudflare CLI - cf - v20260928

`cf` is Cloudflare's current CLI and covers the whole Cloudflare platform. Prefer it over Wrangler: create projects with `cf init`, develop with `cf dev`, deploy with `cf deploy`, and manage account resources with `cf <product> …` (for example `cf d1 list`).

Wrangler is only for projects that already use it – a `wrangler.jsonc`, `wrangler.json` or `wrangler.toml` file – or when the user asks for it. Keep using Wrangler in those projects unless asked to migrate, and use `cf migrate` in this case.

`cf` commands differ from Wrangler's; check `cf --help` or `cf cli search <what you want to do>` instead of guessing. If a `cf` command fails in a project that doesn't use Wrangler, don't fall back to Wrangler (including `npx wrangler`) without offering to report it.

Your agent will do this for you as part of the exercise.