Two Forms of LLM CLI Tools: Interactive Agents and Stateless APIs

    LLM command-line tools fall into two designs: interactive agents for people and stateless APIs for programs. This article explains why both exist, the engineering benefits of stateless subcommands, model routing trade-offs, cloud sandboxes, and how to choose or combine the two.

    1. Why Two Kinds of Command-Line Tools Exist

    Many developers are puzzled the first time they use these tools. Both invoke a large language model from the terminal, yet some stay open for an ongoing conversation while others answer once and exit.

    The reason is that they are built for different goals:

    • Interactive agent tools are meant for people. After you open the terminal, you enter a continuous session. The model can ask follow-up questions, keep context, and gradually take on work in a code repository—batch refactors, cross-file edits, or running tests automatically. It behaves like a pair-programming partner sitting beside you.
    • Stateless API-style tools are meant to be called by programs. They are often compiled into a single executable, run across platforms, and use a permissive open-source license. Each invocation is independent: you pass arguments and input, receive a result, and the process ends without keeping session state.

    In short, the first is a cockpit; the second is an engine part. The value of a stateless tool is that any host agent can orchestrate and compose it.

    2. Engineering Advantages of a Stateless Design

    Wrapping model capabilities as stateless subcommands has several practical benefits.

    2.1 Clear responsibilities, with context owned by the host

    In a stateless architecture, session memory, task planning, and execution pace all stay with the host agent. The subcommand only “calls once and does one thing.” That means:

    • The host agent can decide when to call each capability.
    • Capabilities do not interfere with each other, so debugging paths stay short.
    • The tool itself does not maintain complex session state, so crash recovery is cheap.

    2.2 Single-file distribution with almost no integration cost

    Static binaries produced by languages such as Go do not depend on a runtime environment. Download them and run them. Teams that want to embed model capabilities in their own agent pipelines do not need an SDK or dependency conflict resolution. One executable is enough. That matters especially in CI/CD, where environment consistency is strict.

    2.3 Capabilities as subcommands, invoked and paid for only when needed

    Typical subcommands follow a “capability domain” split:

    1. # List available models
    2. llm-api models
    3. # Text and reasoning (defaults to the fastest reasoning model)
    4. llm-api prompt "Summarize this changelog"
    5. # Switch to a heavier model with a flag
    6. llm-api prompt -m heavy-model "Refactor this code and explain why"
    7. # Document understanding: PDF, images, audio, and video
    8. llm-api analyze ./report.pdf
    9. # Transcribe audio or video to subtitles
    10. llm-api transcribe ./meeting.mp4

    The pattern of “verb + input + optional model parameter” turns multimodal abilities—text reasoning, image understanding, speech transcription, and content generation—into atomic operations. A host agent can combine them like building blocks.

    3. Model Tiers: Trading Speed for Capability

    Stateless tools usually include a model routing table that maps tasks to different model tiers:

    • A lightweight, fast model is the default for text and reasoning, favoring latency and cost.
    • A mid-tier model fits everyday coding tasks that need stronger reasoning and can be selected with -m.
    • A flagship model is reserved for heavy work such as complex architecture analysis and long-context understanding.

    Different modalities often have their own default models—for example, image generation, speech synthesis, music creation, and video generation—so they work out of the box while remaining overridable. The philosophy of “sensible defaults, parameters when you need them” is useful for any team building an AI toolchain.

    4. Cloud Sandboxes: Letting Agents Run Code Safely

    Another direction for stateless tools is hosted agent tasks. A subcommand such as agent run can hand two kinds of work to the cloud:

    1. Deep research. A cloud agent spends a longer time gathering sources, cross-checking them, and writing a report. The local terminal can close first.
    2. Code execution. Code runs in a cloud Linux sandbox, which isolates risk from the local machine.

    Sandbox execution addresses the concern of running unfamiliar code locally and removes dependence on local compute and environment. It is a natural step from a stateless architecture toward “hosted as a service.”

    5. Practical Advice: How to Choose and Combine Them

    Three concrete recommendations follow from the above:

    1. Use an interactive agent for human–machine pairing. Exploratory day-to-day development, learning an unfamiliar codebase, and tasks that need repeated clarification are a better fit for an interactive tool.
    2. Use a stateless tool in automated pipelines. Batch document processing, image or subtitle generation, and integration into your own agent framework are more controllable and easier to test with stateless subcommands. Call them from a shell script or any language as an external process. Retries and log collection are standard engineering practice.
    3. Mix the two. An interactive agent can call stateless tools during a session and treat them as part of its toolbox. The host decides; the subcommand executes. That split is a mainstream pattern in current agent engineering.

    6. Conclusion

    Command-line tools look plain, but they are a clear window into how AI is being engineered. LLM tooling is moving from “a terminal that can chat” to “a set of atomic capabilities that can be orchestrated,” and from a consumer experience toward a production architecture. Understanding the design trade-off between interactive and stateless forms matters more than memorizing any single product name. Tools will change. The engineering direction—giving agents a reliable tool ecosystem—will keep shaping developer workflows for years. For organizations that want to build similar capabilities in the cloud, Baidu AI Cloud offers infrastructure across categories such as model services, containers, and function computing, which can serve as a base for a private agent toolchain.