Building CLIs for AI Agents: Design Principles from Google's gws CLI

✍️ OpenClawRadar📅 Published: March 7, 2026🔗 Source
Building CLIs for AI Agents: Design Principles from Google's gws CLI
Ad

Why Agent-First CLI Design Matters

Human developer experience (DX) optimizes for discoverability and forgiveness, while agent DX requires predictability and defense-in-depth. The article argues that retrofitting human-first CLIs for agents is ineffective, and demonstrates this through Google's gws CLI for Google Workspace, which was designed from day one with AI agents as the primary consumers.

Key Design Principles

Raw JSON Payloads Over Bespoke Flags: Humans prefer simple flags like --title "My Doc", but agents work better with direct JSON payloads that map to API schemas without translation loss.

Example comparison:

Human-first (10 flags, flat namespace):
my-cli spreadsheet create --title "Q1 Budget" --locale "en_US" --timezone "America/Denver" --sheet-title "January" --sheet-type GRID --frozen-rows 1 --frozen-cols 2 --row-count 100 --col-count 10 --hidden false

Agent-first (one JSON flag): gws sheets spreadsheets create --json ' { "properties": {"title": "Q1 Budget", "locale": "en_US", "timeZone": "America/Denver"}, "sheets": [{"properties": {"title": "January", "sheetType": "GRID", "gridProperties": {"frozenRowCount": 1, "frozenColumnCount": 2, "rowCount": 100, "columnCount": 10}, "hidden": false}}] }'

The gws CLI uses --params and --json flags for all inputs, accepting full API payloads directly. The recommended approach is to support both paths in the same binary rather than maintaining separate tools.

Ad

Additional Considerations

The article outlines several other design considerations for agent-first CLIs:

  • Schema Introspection: Self-describing schemas that agents can introspect at runtime
  • Context Window Discipline: Managing output to fit within agent context limits
  • Input Hardening: Protection against agent hallucinations
  • Agent Skills: Shipping capabilities rather than just commands
  • Multi-Surface Support: Working with MCP, extensions, and environment variables
  • Safety Rails: Dry-run modes and response sanitization

CLIs are becoming the lowest-friction interface for AI agents to interact with external systems, requiring deterministic, machine-readable output rather than human-oriented interfaces.

📖 Read the full source: HN AI Agents

Ad

👀 See Also

Headless OpenClaw Setup with Discord via Docker Scripts
Tools

Headless OpenClaw Setup with Discord via Docker Scripts

A GitHub repository provides scripts to run OpenClaw with Discord in a headless Docker container, avoiding the TUI/WebUI. It includes a management script with commands like claw init, start, and stop, plus preconfigured support for OpenAI Responses API, Chromium, and various tools.

OpenClawRadar
Krasis: Hybrid CPU/GPU Runtime for Large MoE Models Achieves 3,324 tok/s Prefill on RTX 5080
Tools

Krasis: Hybrid CPU/GPU Runtime for Large MoE Models Achieves 3,324 tok/s Prefill on RTX 5080

Krasis is a hybrid CPU/GPU runtime that runs large MoE models by handling prefill on GPU and decode on CPU, achieving 3,324 tokens/second prefill on an RTX 5080 with Qwen3-Coder-Next 80B Q4. It requires ~2.5x model size in system RAM but enables running models too large for VRAM.

OpenClawRadar
Codebook Lossless LLM Compression: 10-25% RAM Reduction with Bitwise Packing
Tools

Codebook Lossless LLM Compression: 10-25% RAM Reduction with Bitwise Packing

A developer's proof-of-concept code demonstrates lossless LLM compression by packing fp16 weights into blocks, achieving 10-25% RAM reduction with a trade-off of approximately halved inference speed. The approach identifies that most models only use 12-13 bits of unique values despite fp16's 16-bit representation.

OpenClawRadar
FFF - Fast File Finder claims 100x speed advantage over ripgrep
Tools

FFF - Fast File Finder claims 100x speed advantage over ripgrep

FFF (Fast File Finder) is a web-based file search tool that claims to be 100x faster than ripgrep, positioning itself as a next-generation alternative to regex-based search methods. The tool requires JavaScript to run and was recently discussed on Hacker News with 36 points and 17 comments.

OpenClawRadar