CLI Reference

Overview of the agentmetal CLI tool, installation, global flags, and available subcommands.

CLI Reference

Overview

The agentmetal CLI is the primary command-line interface for managing infrastructure resources on the AgentMetal platform. It provides direct access to all resource types and supports both interactive and scriptable workflows.

Installation

Install the CLI using the official install script:

curl -fsSL https://get.agentmetal.dev/cli | sh

Or build from source:

git clone https://github.com/agentcloud/agentcloud.git
cd agentcloud
make build-cli
sudo mv bin/agentmetal /usr/local/bin/

Verify the installation:

agentmetal version

Authentication

The CLI requires an API key for all operations. You can provide credentials in two ways:

Global Flags

FlagDescriptionDefault
--api-urlBase URL of the AgentMetal API serverhttp://localhost:8080
--api-keyAPI key for authentication(none)
--outputOutput format: json or tabletable
### Environment Variables
VariableDescription
AGENTMETAL_API_URLBase URL of the AgentMetal API server
AGENTMETAL_API_KEYAPI key for authentication
Environment variables are overridden by flags when both are set.
export AGENTMETAL_API_URL=http://localhost:8080
export AGENTMETAL_API_KEY=ak_live_abc123
agentmetal instance list

Available Subcommands

SubcommandDescription
instanceManage compute instances (create, list, get, delete, ssh)
databaseManage managed databases (PostgreSQL, MySQL)
vpcManage Virtual Private Clouds
subnetManage subnets within VPCs
security-groupManage security groups and firewall rules
bucketManage object storage buckets
lbManage load balancers (HTTP, TCP)
dnsManage DNS zones and records
k3sManage lightweight Kubernetes clusters
redisManage Redis clusters
queueManage message queues (RabbitMQ, NATS)
functionManage serverless functions
iacInfrastructure as Code operations (validate, plan, apply, destroy)
audit-logView audit logs for all operations
## Usage Pattern

All subcommands follow the same pattern:

agentmetal <resource> <operation> [flags]

Use --help on any subcommand for detailed usage:

agentmetal instance --help
agentmetal instance create --help

Output Formats

The --output flag controls how results are displayed:

# Table format (default, human-readable)
agentmetal instance list

JSON format (machine-readable, ideal for scripts)

agentmetal instance list --output json

Pipe JSON output to jq for filtering

agentmetal instance list --output json | jq '.[].id'