This article follows the official documentation. We haven’t tested this tool for a hands-on review.
If you give a coding agent shell access to your DigitalOcean account, it can use doctl to query resources such as Droplets, databases, Kubernetes clusters, domains, and firewalls. doctl is DigitalOcean’s official command-line client. It sends requests to DigitalOcean’s API, the service interface that receives requests and returns account data, and prints the results in the terminal.
For example, an agent can list Droplets and summarize their names, regions, and statuses without changing them. You install and authenticate doctl on the machine where the agent runs, then let the agent call it from the shell. These are documentation-based instructions; no installation or live account query was performed.
Install and authenticate doctl
Follow DigitalOcean’s installation instructions for your operating system. On macOS with Homebrew, the documented install command is:
brew install doctl
Check that the command is available locally:
doctl version
Authentication uses a DigitalOcean API token, a secret that lets doctl make requests on your behalf. Create a token on the Applications & API page of the DigitalOcean Control Panel, then run:
doctl auth init
The command prompts you for the token and saves it for later commands. Enter the token in the terminal or another approved way to enter secrets, not in the agent prompt or repository. The token’s permissions determine which account data doctl can access. DigitalOcean lets you create a token with read-only access or with custom scopes, so you can grant only the access the agent needs. The doctl auth init reference also describes named contexts for several accounts, and doctl auth login signs you in through the browser instead. To confirm that the token works, run doctl account get.
List Droplets as JSON
A useful first task is to inventory the account’s Droplets, DigitalOcean’s virtual machines. Run:
doctl compute droplet list --output json
The command makes a read request to DigitalOcean and prints the Droplet records as JSON, a structured format that an agent can inspect and summarize. --output json selects JSON output; it does not change the resource. The Droplet list reference documents the command and its filters, like --region and --tag-name. The doctl reference covers the wider command set.
You install doctl and check its version on the local machine. doctl auth init stores credentials there. The list command contacts DigitalOcean and returns account data, but it does not create, update, or delete a Droplet. The exact records depend on the account and the token’s permissions, so an agent should report only fields present in the returned JSON.
A realistic prompt for an agent with shell access is:
Use
doctl compute droplet list --output jsonto inspect the DigitalOcean Droplets available to this account. Summarize each record’s name, ID, region, status, and tags when those fields are present. Do not create, update, or delete resources.
Know what the command covers
The Droplet list command returns Droplets; it does not provide a complete inventory of databases, Kubernetes clusters, domains, or other DigitalOcean resources. To inspect those, use the corresponding doctl command group and check its reference page. The official repository contains the CLI source and project information.
Keep write commands separate from inventory work. Commands that create or change resources send requests that alter the DigitalOcean account. Before asking an agent to run one, identify the exact resource and change, and review the command’s documented arguments. The read-only listing example above makes no resource changes, so it needs no preview step.
If you want an agent to inspect one kind of resource, start with that resource’s list command and JSON output. For a broader account review, run a separate command for each resource type, then ask the agent to summarize the returned data. See the Awesome CLI directory for other shell tools that coding agents can use.