back

February 26, 2026

CLIs Are for Agents

CLIs Are for Agents

A tweet from Andrej Karpathy caught my attention:

"CLIs are great. AI agents love CLIs."

Simple observation. But it crystallized something I had been thinking about for a while.

The Interface Problem

AI agents can write code, browse the web, manage files, send emails. But when it comes to business operations—managing products, handling customers, processing subscriptions—they hit a wall. The options are clunky SDK wrappers buried in function calls, or worse, asking humans to click buttons in dashboards.

This is a bottleneck. If agents are going to run businesses autonomously, they need proper interfaces to business infrastructure.

Why CLIs Win

CLIs aren't just convenient for power users. They're the ideal interface for AI agents:

  1. ·Structured output — JSON, YAML, or tables that machines parse reliably
  2. ·Self-documenting--help flags describe the entire API surface
  3. ·Composable — pipe outputs, chain commands, integrate into any workflow
  4. ·Stateless — no sessions to manage, no UI state to track
  5. ·Predictable — same input, same output, every time

When you give an agent a CLI, you give it a complete, documented, scriptable interface. No browser automation. No screenshot parsing. No fragile selectors.

polar-cli

I built polar-cli as a command-line interface for Polar. It covers the full API surface:

  • ·Products, customers, subscriptions
  • ·Orders, checkouts, refunds
  • ·Webhooks, events, benefits
  • ·License keys, usage meters
  • ·Discounts, files, organizations

polar-cli help
polar-cli help

Everything an agent needs to manage monetization for any application.

A Concrete Use Case

Imagine you're building an AI agent that handles customer success for your SaaS. A user emails asking why their subscription failed. Here's what the agent can do:

# Find the customer polar customers list --email "user@example.com" --output json # Check their subscription status polar subscriptions list --customer-id cust_xxx --output json # Look at recent orders for payment issues polar orders list --customer-id cust_xxx --output json # If needed, create a discount for retention polar discounts create --name "Retention Offer" --percent 20 --duration 3 # Generate a new checkout link polar checkouts create --product-id prod_xxx --discount-id disc_xxx --output json

The agent reads structured JSON, makes decisions, takes actions. No human in the loop clicking through dashboards. The customer gets a response in minutes with a personalized discount link.

Or consider an agent monitoring your business health:

# Stream events in real-time polar events stream --output json # Check subscription metrics polar subscriptions list --status active --output json | jq 'length' # Monitor failed payments polar orders list --status failed --output json

The agent can alert you when churn spikes, automatically reach out to at-risk customers, or adjust pricing based on conversion data. All through a scriptable interface.

Building for the Agentic Future

We're entering an era where AI agents don't just assist with tasks—they run entire business operations. The tools that thrive will be the ones designed for both humans and agents from the start.

A good CLI serves both. Fast for engineers who live in the terminal. Perfect for agents that need reliable, composable interfaces.

polar-cli is open source. If you're building with Polar and want your agents to handle monetization, it's ready.

share