CLIs Are for Agents
AI agents need proper interfaces to business infrastructure. Not SDK wrappers. Real CLIs. That's why I built polar-cli.
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:
- Structured output — JSON, YAML, or tables that machines parse reliably
- Self-documenting —
--helpflags describe the entire API surface - Composable — pipe outputs, chain commands, integrate into any workflow
- Stateless — no sessions to manage, no UI state to track
- 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

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 jsonThe 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 jsonThe 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.