If you’re building AI Agents, you probably spend a lot of time in two places: the LLM’s chat window and your terminal.
One of the most frustrating parts of Agent development is the "Black Box" problem. Your Agent calls a tool, the tool fails, and you’re left digging through logs to understand why. Was it the parameters? The environment? Or the tool logic itself?
At apcore, we believe that if a module is "AI-Perceivable," it should also be "Developer-Perceivable." This is why we prioritize terminal accessibility as a first-class citizen of our ecosystem.
In this fourth article of our series, we move from high-level vision to the terminal, showing how you can instantly transform any apcore module into a powerful CLI tool for human debugging and system interaction via apcore-cli.
Convention-over-Configuration (§5.14)
The "Zero Import" way to build CLI tools is one of the most powerful features of apcore-cli. By using the ConventionScanner from the apcore-toolkit, apcore-cli can turn a directory of plain Python files into a professional terminal application.
No base classes. No decorators. No imports from apcore. Just functions with PEP 484 type hints.
# commands/deploy.py
def deploy(env: str, tag: str = "latest") -> dict:
"""Deploy the app to the given environment."""
return {"status": "deployed", "env": env}
By dropping this file into a commands/ directory, apcore-cli automatically:
- Infers the
input_schemaandoutput_schemafrom the type hints. - Generates the CLI command:
apcore-cli deploy deploy --env prod. - Provides the
--helptext from the function's docstring.
Deep Dive: The Magic of Reflection
The apcore-cli tool uses the Registry to discover all available modules and their schemas. It then uses reflection to map Canonical IDs directly to subcommands.
For example, if you have a module with the ID executor.email.send_email, apcore-cli will automatically generate the following command structure:
$ apcore-cli executor email send-email --to "dev@example.com" --subject "Hello" --body "World"
Boolean Flag Pairs & Enum Choices
Because every apcore module must have an input_schema, the CLI doesn't guess. It uses that schema to:
- Generate
--verbose/--no-verbosepairs for boolean fields. - Provide shell-validated enum choices (e.g.,
--format json) from JSON Schemaenumproperties. - Enforce required fields, showing them as
[required]in the--helptext.
STDIN Piping (The Unix Way)
A module in apcore is a universal unit of functionality. By exposing your modules via a CLI, you gain the power of Unix pipes. You can pipe JSON input directly into a module, and CLI flags will override specific keys:
# Pipe JSON input and override a parameter
echo '{"a": 100, "b": 200}' | apcore-cli math.add --input - --a 999
# {"sum": 1199}
# Chain with other tools
apcore-cli sysutil.info | jq '.os, .hostname'
TTY-Adaptive Output
One of the most powerful features of apcore-cli is its ability to adapt its output based on the environment. If you’re in a terminal (TTY), it renders a rich, human-readable table. If you’re in a pipe, it outputs raw JSON for further processing.
This makes apcore-cli the perfect tool for developers to debug their Agent's skills and for sysadmins to automate their workflows.
Conclusion: Bridging the Gap
Reliable AI systems are built by developers who can "see" what their Agents are doing. apcore-cli bridges the gap between the terminal and the LLM, giving you a shared interface to inspect, test, and control your AI-Perceivable modules.
Now that we’ve mastered the terminal, it’s time to go back to the Agentic workforce. In the next article, we’ll dive into apcore-a2a: How Agents use these same modules to collaborate autonomously.
This is Article #4 of the **apcore: Building the AI-Perceivable World* series. Join us in making the terminal a first-class citizen of the Agentic Era.*
GitHub: aiperceivable/apcore-cli
Top comments (0)