Skip to main content

CLI commands

Install the CLI:

pip install 10xscale-agentflow-cli

Verify:

agentflow version

agentflow init

Scaffold a new project with agentflow.json and a starter graph module.

agentflow init [OPTIONS]
OptionDefaultDescription
--path, -p.Directory to initialize files in
--force, -ffalseOverwrite existing files
--prodfalseAdd pyproject.toml and .pre-commit-config.yaml
--verbose, -vfalseEnable verbose logging
--quiet, -qfalseSuppress output except errors

Creates:

agentflow.json
graph/
__init__.py
react.py

With --prod:

agentflow.json
graph/
__init__.py
react.py
pyproject.toml
.pre-commit-config.yaml

Example:

# Initialize in the current directory
agentflow init

# Initialize in a specific folder
agentflow init --path ./my-agent

# Overwrite an existing project
agentflow init --force

agentflow api

Start the FastAPI server that serves your compiled graph.

agentflow api [OPTIONS]
OptionDefaultDescription
--config, -cagentflow.jsonPath to config file
--host, -H0.0.0.0Bind host (use 127.0.0.1 for localhost only)
--port, -p8000Bind port
--reload/--no-reload--reloadEnable auto-reload on file changes
--verbose, -vfalseEnable verbose logging
--quiet, -qfalseSuppress output except errors

Example:

# Start with defaults (binds to all interfaces)
agentflow api

# Start on localhost only
agentflow api --host 127.0.0.1 --port 8000

# Disable auto-reload for production
agentflow api --no-reload

# Use a different config file
agentflow api --config ./config/prod.json

agentflow play

Start the API server and open the hosted playground in a browser.

agentflow play [OPTIONS]

Accepts the same options as agentflow api. The --host and --port values are also used to build the backendUrl that is passed to the hosted playground.

Example:

agentflow play --host 127.0.0.1 --port 8000

The CLI prints the playground URL. If the browser does not open automatically, open the URL manually. The backendUrl query parameter tells the playground which local API to call.


agentflow build

Generate a Dockerfile (and optionally docker-compose.yml) for deployment.

agentflow build [OPTIONS]
OptionDefaultDescription
--output, -oDockerfileOutput Dockerfile path
--force, -ffalseOverwrite existing Dockerfile
--python-version3.13Python base image version
--port, -p8000Port to expose in the container
--docker-compose/--no-docker-compose--no-docker-composeAlso generate docker-compose.yml
--service-nameagentflow-cliService name in docker-compose.yml
--verbose, -vfalseEnable verbose logging
--quiet, -qfalseSuppress output except errors

Example:

# Minimal Dockerfile
agentflow build

# Dockerfile + docker-compose.yml
agentflow build --docker-compose --service-name my-agent

# Custom Python version
agentflow build --python-version 3.12

agentflow version

Print the CLI and library versions.

agentflow version [--verbose]

Global options

All commands accept --help (-h) for usage information:

agentflow --help
agentflow api --help
agentflow init --help