Skip to main content
The --expand-prompt flag expands short prompts into detailed, actionable prompts using the PromptExpanderAgent.

Quick Start

Expand Prompt Adds Detail

Usage

Basic Expansion

Expected Output:

With Verbose Output

With Tools for Context

--expand-tools now accepts any name reachable by praisonai tools list โ€” the same resolver chain used by praisonai research --tools and --rewrite-tools. See Tool Resolution for the full chain.

Combine with Query Rewrite

Key Difference

Expansion Strategies

Examples

Content Creation

Expanded to: โ€œWrite a comprehensive blog post about Artificial Intelligence that includes: an engaging introduction, key concepts explained for beginners, current trends and applications, future predictions, and a conclusion with actionable takeaways. Use headers, bullet points, and examples.โ€

Code Generation

Expanded to: โ€œCreate a REST API with the following specifications: endpoints for CRUD operations, proper HTTP methods (GET, POST, PUT, DELETE), error handling with appropriate status codes, input validation, authentication middleware, and documentation comments.โ€

Research Task

Expanded to: โ€œResearch quantum computing covering: fundamental principles (qubits, superposition, entanglement), current hardware implementations, major players and their approaches, practical applications, challenges and limitations, and future outlook.โ€

Choosing the expanderโ€™s model

The CLIโ€™s --expand-prompt step honours the standard cascade โ€” CLI flag wins, env vars next, gpt-4o-mini fallback last:
To keep a cheap expander regardless of the main model, pin it explicitly with OPENAI_MODEL_NAME=gpt-4o-mini while --llm drives the main agent โ€” but the recommended pattern is running the expander and main agent on the same model.

Programmatic Usage

The model= kwarg on PromptExpanderAgent is unchanged โ€” the cascade above applies only to the CLI path.

How It Works

  1. Analyze: PromptExpanderAgent analyzes the short prompt
  2. Strategy: Selects appropriate expansion strategy
  3. Expand: Generates detailed, actionable prompt
  4. Execute: Uses expanded prompt for the task

Best Practices

Use --expand-prompt for content creation and coding tasks where detailed instructions improve output quality.
Prompt expansion adds an LLM call. Use --metrics to monitor token usage.