Skip to content
All agent resources

Set up the Prefect CLI for your agent

Install Prefect in your project and verify the environment your coding agent will use.

Setup

  1. Install in your project

    For an existing uv project, run the commands below. Use the installation guide if you use a different package manager. Do not install a second copy into a project that already has Prefect.

    Terminal · uv project
    uv add prefect
    uv run prefect version
    Prefect installation guide
  2. Choose your server

    For Prefect Cloud, run the login command and complete browser authentication. For a self-hosted server, configure its API URL and authentication instead of running Cloud login.

    Terminal · Prefect Cloud
    uv run prefect cloud login
    Cloud and self-hosted configuration
  3. Review commands before execution

    The CLI has write capabilities. Confirm the target workspace and review deployment, run, and deletion commands before allowing an agent to execute them.

Setup prompt

Paste this into your coding agent to walk through the setup.

Set up the Prefect CLI for this project using https://docs.prefect.io/v3/get-started/install. Inspect the existing Python environment, package manager, and Prefect installation first. Propose any dependency changes and ask before installing. Verify the CLI version in the same environment you will use. Ask whether I use Prefect Cloud or a self-hosted server, then guide me through the appropriate authentication without exposing secrets. Confirm the target workspace or API URL. Do not deploy, start runs, or modify remote resources.

Documentation & source

Prefect installation documentation