# Burn Your Flags: Interactive CLIs for Agents — Mark Lummus & Navinkumar Patil, PayPal

## Executive summary

This workshop addresses the challenge of making interactive Command Line Interfaces (CLIs) usable by AI agents. Traditional methods, like adding command flags, fail when the workflow is contextual, sequential, or depends on live API responses. The presentation introduces advanced techniques—including `tmux` sessions, IPC side channels, and context injection—to provide agents with the necessary structured context and state management, moving beyond simple screen scraping to enable robust, multi-step agentic workflows.

## Key takeaways

- Interactive CLI Limitations for Agents: Agents struggle with interactive CLIs because they may fail silently (e.g., seeing a redraw loop instead of a question) [0:00, 0:00]. Flags are insufficient when choices are contextual or depend on real-time API responses, unlike simple, independent command flows [4:35].
- Advanced Agentic CLI Techniques: Three key approaches were presented to improve agent interaction with CLIs: 1) Using `tmux` sessions for key sending and capturing terminal state [25:51]. 2) Implementing IPC side channels to expose structured JSON output instead of relying on screen scraping [28:28]. 3) Context injection, which explicitly provides constraints and options to the agent, mimicking human guidance [31:00].
- The Importance of Determinism: For a CLI to be reliably used by an LLM, it must be deterministic. The CLI should act as a 'small sharp instrument' that provides the same response every time a command is given, leaving the non-deterministic role to the LLM [42:00].

## Technical details

- Agentic Workflow Design: The goal is to adapt an interactive CLI (e.g., Barista 9000) so that agents can follow complex decision trees, which is superior to simple script automation [0:00].
- Terminal State Management: Using `tmux` sessions allows for key sending and capturing terminal state, enabling agents to manage multiple, long-running tasks and communicate across different sessions [25:51].
- Structured Communication: IPC side channels are recommended as an upgrade from screen scraping. They allow the CLI to expose structured JSON output, providing machine-readable data that agents can reliably parse, rather than relying on visual inference [28:28].
- Context Injection: This technique involves providing explicit context, constraints, and options (e.g., 'low on oat milk,' 'only two gallons left') to the agent, allowing the CLI to handle scenarios that are not visible in a standard human-facing flow [31:00].

## Practical implications

- When designing CLIs for AI agents, prioritize structured data output (JSON) over visual interaction.
- For complex, multi-step workflows, implement state management using tools like `tmux` or dedicated IPC side channels.
- Always provide explicit context and guardrails to the agent to guide its decision-making process, rather than assuming it can infer all necessary information.

## Topics

CLI Development, AI Agents, Developer Tools, Terminal Interfaces, LLM Integration, Barista 9000, PayPal cafe

Source: https://www.youtube.com/watch?v=aV_vgUSatqs
