new_agent (Agent Generator CLI)
What it is
- A small CLI-backed utility that scaffolds a new “agent” project/module from a template.
- Exposed as a
clicksubcommand:new agent <agent_name> [agent_path].
Public API
new_agent(agent_name: str, agent_path: str = ".", extra_values: dict = {})- Converts
agent_nameto PascalCase. - Resolves/creates the destination directory (
agent_path). - Copies template files from the package’s
cli/new/templates/agentinto the destination usingCopier. - Ensures
extra_values["module_name_snake"]defaults to"your_module_name"if not provided. - Passes template values including:
agent_name_pascal: PascalCase agent name- any additional
extra_values
- Converts
CLI entrypoint:
_new_agent(agent_name: str, agent_path: str = ".")- Registered via
@new.command("agent"). - Delegates to
new_agent(...).
- Registered via
Configuration/Dependencies
- Dependencies
clickfor CLI command/argument parsing.naas_abi_clito locate the installed package path for templates.Copier(naas_abi_cli.cli.utils.Copier.Copier) to perform template copying.to_pascal_case(naas_abi_cli.cli.new.utils) for name normalization.
- Filesystem
- If
agent_path == ".", it usesos.getcwd(). - Creates
agent_pathdirectory if it does not exist.
- If
Usage
From Python
from naas_abi_cli.cli.new.agent import new_agent
new_agent(
"my_agent",
agent_path=".",
extra_values={"module_name_snake": "my_module"},
)From CLI
naas-abi-cli new agent my_agent .Caveats
extra_valueshas a mutable default ({}); repeated calls in the same process may share and mutate the same dict instance.