MotherDuck

YouTube

Agent Interfaces: designing a CLI for agents

2026-10-06 07:57 UTC
Length: 17:56

Aditya explains how to design a command‑line interface that is friendly for AI agents, describing evaluation methods, token‑efficiency metrics, and design principles like minimal schemas, structured errors, and discovery. He shows how MotherDuck’s CLI and MCP server let agents bring data or bring the agent to data, and how A/B testing and grading help improve the interface. The talk is useful for data engineers building tools that will be used by LLM agents, and it highlights patterns that also apply to human‑centric UIs.

Insights

1. Agent‑First CLI Design
1.1 Design the CLI around the tasks agents will perform, not the underlying APIs; expose only the commands needed for common agent workflows.
1.2 Use a backward‑design approach: start with agent use cases, list required capabilities, then build the command hierarchy.
1.3 Tradeoff: fewer commands simplify agent learning but may limit advanced user flexibility; balance by grouping related actions into subcommands.

2. Evaluation Framework for CLI
2.1 Use A/B testing with multiple CLI versions to measure agent success on defined tasks.
2.2 Grade outcomes by token efficiency (input+output tokens) and step count; lower tokens and steps indicate better design.
2.3 Pitfall: evaluating only success rate ignores cost; include token metrics to guide optimization.

3. Minimal Schemas and Structured Outputs
3.1 Provide commands with a small set of required fields and sensible defaults; avoid exposing every API option.
3.2 Return results in structured JSON to enable agents to pipe outputs to subsequent commands.
3.3 Tradeoff: minimal schemas reduce error surface but may require additional commands for advanced use.

4. Discovery and Context Disclosure
4.1 Expose feature descriptions and usage examples in command help; use subcommands to surface related actions.
4.2 Include a "getting started" guide within the CLI so agents can learn capabilities without external docs.
4.3 Mistake: overloading help text can confuse agents; keep it concise and consistent across subcommands.

5. Non‑Interactive Authentication and Setup
5.1 Implement a one‑step command (e.g., motherduck new) that creates an account and returns a temporary token.
5.2 Avoid browser‑based logins that require user interaction; agents need deterministic, scriptable authentication.
5.3 Benefit: agents can bootstrap access in sandboxed environments without human intervention.

6. Structured Errors and Instruct Errors
6.1 Return errors in a consistent JSON schema that includes error code, message, and suggested next steps.
6.2 When an error occurs, provide guidance on how to correct the command or adjust parameters.
6.3 Common mistake: generic error messages that force agents to retry blindly; structured guidance reduces wasted steps.

Watch on YouTube