agent (CLI command group)
What it is
- A
clickcommand group that provides anagent listsubcommand. - It loads the Naas ABI
Engine, reads available agents from loaded modules, and prints them as a table usingrich.
Public API
agent()- Click command group registered under the name
agent.
- Click command group registered under the name
list()- Click subcommand
agent list. - Loads the engine and outputs a table of available agents grouped by module.
- Click subcommand
Configuration/Dependencies
- Dependencies
click(CLI framework)naas_abi_core.engine.Engine.Engine(Engineused to load modules/agents)rich(Console,Tablefor formatted terminal output)
- Runtime expectations
Engine().load()populatesengine.moduleswhere:- Keys are module names (strings)
- Values expose an
.agentsiterable of agent objects/classes with a__name__attribute
Usage
Minimal example integrating this command group into a CLI:
import click
from naas_abi_cli.cli.agent import agent
@click.group()
def cli():
pass
cli.add_command(agent)
if __name__ == "__main__":
cli()
Then run:
python app.py agent list
Caveats
- The subcommand name is
list, which shadows Python’s built-inlistwithin this module. - Output depends on
Engine.load()successfully discovering modules and agents; if no modules/agents are loaded, the table will be empty.