The ansible_creator.api module provides a programmatic Python interface to ansible-creator's scaffolding capabilities. This is intended for internal Ansible ecosystem tooling (such as the ansible-dev-tools server, VS Code extensions, or MCP servers) rather than general end-users.
The API is dynamic and schema-driven, meaning it introspects the command tree at runtime. When new subcommands or resources are added to the CLI, they are automatically available via the API without requiring code changes in the consuming tool.
from ansible_creator.api import V1
api = V1(verbosity=1)
# Scaffold a collection
result = api.run("init", "collection", collection="testns.testcol")
print(result.status) # "success"
print(result.path) # Path to temp dir with scaffolded content