Agentstr CLI

The agentstr.cli module provides a command-line interface (CLI) for managing and running Agentstr services, primarily for deploying agents to cloud providers.

Overview

The CLI offers commands for the entire lifecycle of an agent deployment, from scaffolding a new project to deploying, monitoring, and destroying it. It supports multiple cloud providers (AWS, GCP, Azure, Docker) and manages configurations and secrets.

CLI Commands

  • agentstr init <project_name>: Creates a new agent project skeleton.

  • agentstr deploy <file_path>: Deploys an application to the configured cloud provider.

  • agentstr list: Lists active deployments.

  • agentstr logs <name>: Fetches logs for a specific deployment.

  • agentstr destroy <name>: Removes a deployment and its resources.

  • agentstr relay start: Runs a local Nostr relay for development purposes.

CLI Usage

# Get help on all commands
agentstr --help

# Choose Cloud provider
export AGENTSTR_PROVIDER=aws # or gcp, azure, docker

# Create a new agent project
agentstr init my-new-agent

# Deploy the agent to the cloud
agentstr deploy -f my-new-agent/deploy.yml

# List active deployments
agentstr list

# View logs for the deployment
agentstr logs -f my-new-agent/deploy.yml

# Destroy the deployment when no longer needed
agentstr destroy -f my-new-agent/deploy.yml

Note

Make sure your cloud provider credentials are set up before running these commands. See Cloud & CI/CD for details.

Reference

agentstr

agentstr-cli – lightweight cli for deploying agentstr apps to cloud providers.

agentstr [OPTIONS] COMMAND [ARGS]...

Options

--provider <provider>

Cloud provider to target (default taken from $AGENTSTR_PROVIDER).

Options:

aws | gcp | azure

--config <config>

Path to YAML config file.

deploy

Deploy an application file (server or agent) to the chosen provider.

agentstr deploy [OPTIONS] [FILE_PATH]

Options

-f, --config <config>

Path to YAML config file.

--name <name>

Deployment name

--secret <secret>

Secret in KEY=VALUE format. Can be supplied multiple times.

--env <env>

Environment variable KEY=VALUE to inject. Can be supplied multiple times.

--pip <dependency>

Additional Python package (pip install) to include in the container. Repeatable.

--cpu <cpu>

Cloud provider vCPU units (e.g. 256=0.25 vCPU).

--memory <memory>

Cloud provider memory (MiB).

Default:

512

Arguments

FILE_PATH

Optional argument

destroy

Destroy a deployment.

agentstr destroy [OPTIONS] [NAME]

Options

-f, --config <config>

Path to YAML config file.

Arguments

NAME

Optional argument

list

List active deployments on the chosen provider.

agentstr list [OPTIONS]

Options

-f, --config <config>

Path to YAML config file.

--name <name>

Filter by deployment name

logs

Fetch logs for a deployment.

If NAME is omitted, it will be resolved from the config file’s ‘name’ field or derived from the ‘file_path’ stem.

agentstr logs [OPTIONS] [NAME]

Options

-f, --config <config>

Path to YAML config file.

Arguments

NAME

Optional argument

put-secret

Create or update a cloud-provider secret and return its reference string.

VALUE may be provided directly or via –value-file.

agentstr put-secret [OPTIONS] KEY [VALUE]

Options

-f, --config <config>

Path to YAML config file.

--value-file <value_file>

Read secret value from file (overrides VALUE argument).

Arguments

KEY

Required argument

VALUE

Optional argument

put-secrets

Create or update multiple secrets from a .env file.

ENV_FILE should contain KEY=VALUE lines (comments with # allowed). Each secret is stored via the provider’s secret manager and the resulting reference printed.

agentstr put-secrets [OPTIONS] ENV_FILE

Options

-f, --config <config>

Path to YAML config file.

Arguments

ENV_FILE

Required argument

See Also

  • Cloud & CI/CD — for details on deploying agents using the CLI.