Skip to content

API Reference parrot.setup.wizard

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.setup.wizard

View source

Wizard data models and base abstractions for parrot setup.

This module defines the three core dataclasses used throughout the setup wizard pipeline, the BaseClientWizard abstract base class that all provider wizards inherit from, and the WizardRunner that orchestrates the full setup pipeline.

Class AgentConfig

Collected configuration for agent scaffolding.

Parameter Type Default Description
name str
agent_id str
provider_config ProviderConfig
file_path str

Fields:

Field Type Default Description
name str Human-readable agent name (e.g. "My Research Agent").
agent_id str URL-safe hyphenated slug derived from name (e.g. "my-research-agent").
provider_config ProviderConfig The LLM provider configuration for this agent.
file_path str Absolute path where the generated agent .py file will be written.

Class BaseClientWizard

Abstract base class for provider-specific credential wizards.

To add support for a new LLM provider:

  1. Subclass BaseClientWizard in parrot/setup/providers/<provider>.py.
  2. Set display_name, provider_key, and default_model as class-level string attributes.
  3. Implement collect() with provider-specific click.prompt calls (use hide_input=True for API keys).

No changes to the wizard core are required — new subclasses are discovered automatically via __subclasses__().

Example::

class MyProviderWizard(BaseClientWizard):
    display_name = "My Provider"
    provider_key = "myprovider"
    default_model = "my-model-v1"

    def collect(self) -> ProviderConfig:
        model = click.prompt("Model", default=self.default_model)
        key = click.prompt("MY_API_KEY", hide_input=True)
        return ProviderConfig(
            provider=self.provider_key,
            model=model,
            env_vars={"MY_API_KEY": key},
            llm_string=f"{self.provider_key}:{model}",
        )

Attributes:

Attribute Type Description
display_name str Human-readable name shown in the provider selection menu.
provider_key str Provider key passed to LLMFactory (e.g. "anthropic").
default_model str Default model identifier offered as the prompt default.

Method BaseClientWizard.collect

Run interactive prompts and return collected provider config.

collect() -> ProviderConfig

Returns: ProviderConfig — ProviderConfig with provider, model, env_vars, and llm_string populated.

Method BaseClientWizard.all_wizards

Return instances of all registered provider wizard subclasses.

Deduplicates by provider_key so that re-importing provider modules in tests (which creates new class objects) does not produce duplicate entries.

all_wizards() -> List[BaseClientWizard]

Returns: List[BaseClientWizard] — List of instantiated BaseClientWizard subclasses, one per unique provider_key, in registration order.

Class ProviderConfig

Collected configuration for a single LLM provider.

Parameter Type Default Description
provider str
model str
env_vars Dict[str, str]
llm_string str

Fields:

Field Type Default Description
provider str Provider key used by LLMFactory (e.g. "anthropic").
model str Model identifier (e.g. "claude-sonnet-4-6").
env_vars Dict[str, str] Environment variable name → value pairs to write to the .env file.
llm_string str Combined string for LLMFactory in "provider:model" format (e.g. "anthropic:claude-sonnet-4-6").

Class WizardResult

Full result of a completed setup wizard run.

Parameter Type Default Description
provider_config ProviderConfig
environment str
env_file_path str
agent_config Optional[AgentConfig] None
app_bootstrapped bool False

Fields:

Field Type Default Description
provider_config ProviderConfig Provider and credentials that were collected during the wizard session.
environment str Target environment string (e.g. "dev", "prod").
env_file_path str Path to the .env file that was written.
agent_config Optional[AgentConfig] None Agent scaffolding result. None if the user chose not to create an agent.
app_bootstrapped bool False True if app.py and run.py were generated successfully.

Class WizardRunner

Orchestrates the full parrot setup wizard pipeline.

Pipeline steps:

  1. Import provider package to trigger subclass registration.
  2. Present a numbered provider selection menu.
  3. Run the chosen provider wizard to collect credentials.
  4. Ask for the target environment name (default: "dev").
  5. Check the target .env for existing keys; offer per-key overwrite.
  6. Write credentials to the env file via scaffolding.write_env_vars.
  7. Optionally prompt for agent creation and scaffold it.
  8. Optionally prompt for app bootstrap (app.py / run.py).
  9. Return a WizardResult summarising everything that was created.
Parameter Type Default Description
force bool False When True, overwrite existing app.py / run.py without prompting.
cwd Optional[Path] None Project root directory. Defaults to the current working directory.

Method WizardRunner.run

Execute the full setup wizard and return results.

Handles KeyboardInterrupt by printing a cancellation message and re-raising so the CLI layer can exit cleanly.

run() -> WizardResult

Returns: WizardResult — WizardResult describing everything that was created.

Raises:

  • KeyboardInterrupt — Propagated after printing a cancellation message, so the caller can exit with code 0.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally