CLI Reference
The Anvil CLI provides commands for project setup, tool management, and system diagnostics.
Installation
Section titled “Installation”The CLI is installed automatically with the package:
pip install anvil-agentanvil --helpGlobal Options
Section titled “Global Options”anvil --version # Show versionanvil --help # Show helpanvil init
Section titled “anvil init”Initialize a new Anvil project.
anvil init [OPTIONS]Options
Section titled “Options”| Option | Short | Default | Description |
|---|---|---|---|
--dir | -d | . | Directory to initialize. |
--tools-dir | anvil_tools | Name of the tools directory. | |
--force | -f | Overwrite existing files. | |
--skip-keys | Skip interactive API key setup. |
What It Does
Section titled “What It Does”- Creates the tools directory structure
- Sets up
.gitignoreto protect API keys - Prompts for API keys (optional)
- Creates a
.envfile - Generates an example script
Examples
Section titled “Examples”# Initialize current directoryanvil init
# Initialize a specific directoryanvil init --dir ./my-project
# Custom tools directoryanvil init --tools-dir my_tools
# Non-interactive modeanvil init --skip-keys
# Overwrite existing filesanvil init --forceanvil doctor
Section titled “anvil doctor”Check system requirements and configuration.
anvil doctorWhat It Checks
Section titled “What It Checks”- Python version (requires 3.10+)
- Docker availability
- API key configuration
.envfile existence- Tools directory status
Example Output
Section titled “Example Output”🩺 System Health Check
┌───────┬─────────────────────────────┬───────────╮│ ✓ │ Python │ 3.12.0 ││ ✓ │ Docker │ 24.0.7 ││ ✓ │ Rich CLI │ enabled │╰───────┴─────────────────────────────┴───────────╯
🔑 API Keys
┌───────┬────────────────────────┬──────────────────────╮│ ✓ │ ANTHROPIC_API_KEY │ sk-ant-...1234 ││ ○ │ FIRECRAWL_API_KEY │ not set (optional) │╰───────┴────────────────────────┴──────────────────────╯
╭──────────────────────────────────────────────────────╮│ All checks passed! │╰──────────────────────────────────────────────────────╯anvil list
Section titled “anvil list”List all cached tools.
anvil list [OPTIONS]Options
Section titled “Options”| Option | Short | Default | Description |
|---|---|---|---|
--dir | -d | ./anvil_tools | Tools directory. |
--json | Output as JSON. |
Examples
Section titled “Examples”# List toolsanvil list
# Custom directoryanvil list --dir ./my_tools
# JSON output (for scripting)anvil list --jsonExample Output
Section titled “Example Output”📦 Anvil Tools (3 total)
┌────────┬──────────────────┬─────────┬─────────────────────────────────┐│ Status │ Name │ Version │ Intent │├────────┼──────────────────┼─────────┼─────────────────────────────────┤│ ● │ search_github │ v1.0 │ Search GitHub repositories ││ ● │ get_weather │ v1.2 │ Get current weather for a city ││ ○ │ custom_tool │ v1.0 │ Custom implementation │╰────────┴──────────────────┴─────────┴─────────────────────────────────╯Status Icons
Section titled “Status Icons”| Icon | Meaning |
|---|---|
| ● (green) | Active, working tool |
| ● (red) | Failed tool |
| ○ (yellow) | Ejected (user-controlled) |
JSON Output
Section titled “JSON Output”{ "tools": [ { "name": "search_github", "file": "./anvil_tools/search_github.py", "version": "1.0", "intent": "Search GitHub repositories", "status": "active", "size_bytes": 1234, "modified": "2025-01-18T10:00:00" } ]}anvil clean
Section titled “anvil clean”Clear the tool cache to force regeneration.
anvil clean [OPTIONS]Options
Section titled “Options”| Option | Short | Default | Description |
|---|---|---|---|
--dir | -d | ./anvil_tools | Tools directory. |
--force | -f | Skip confirmation prompt. | |
--keep-ejected | Keep user-controlled tools. |
What It Does
Section titled “What It Does”- Removes all managed tool files
- Updates the tool registry
- Clears
__pycache__ - Optionally preserves ejected tools
Examples
Section titled “Examples”# Interactive confirmationanvil clean
# Skip confirmationanvil clean --force
# Keep user-edited toolsanvil clean --keep-ejected
# Clean specific directoryanvil clean --dir ./my_tools --forceExample Output
Section titled “Example Output”🧹 Anvil Clean
Managed tools to remove: 5 - search_github - get_weather - send_email ... and 2 more
Ejected tools (keeping): 1
Proceed with cleanup? [y/N]: y✓ Removed 5 tools.ℹ Tools will be regenerated on next use.anvil verify
Section titled “anvil verify”Verify a tool’s code in the sandbox.
anvil verify <TOOL_NAME> [OPTIONS]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
TOOL_NAME | Name of the tool to verify. |
Options
Section titled “Options”| Option | Short | Default | Description |
|---|---|---|---|
--dir | -d | ./anvil_tools | Tools directory. |
What It Does
Section titled “What It Does”- Loads the tool’s source code
- Runs static security analysis
- Executes in sandbox (if Docker available)
- Reports violations or success
Examples
Section titled “Examples”# Verify a toolanvil verify search_github
# Verify tool in custom directoryanvil verify my_tool --dir ./custom_toolsExample Output (Success)
Section titled “Example Output (Success)”🔍 Verifying: search_github
Sandbox: docker
✓ Code passed verification! Duration: 45.2msExample Output (Failure)
Section titled “Example Output (Failure)”🔍 Verifying: dangerous_tool
Sandbox: docker
✗ Code failed verification!
Error: Security violation detected
Security violations: - Blocked import: subprocess - Dangerous function call: os.systemExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error or verification failure |
Environment Variables
Section titled “Environment Variables”The CLI respects these environment variables:
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Anthropic API key |
OPENAI_API_KEY | OpenAI API key |
XAI_API_KEY | Grok API key |
FIRECRAWL_API_KEY | FireCrawl API key |