The --expand-prompt flag expands short prompts into detailed, actionable prompts using the PromptExpanderAgent.
Quick Start
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
- Analyze: PromptExpanderAgent analyzes the short prompt
- Strategy: Selects appropriate expansion strategy
- Expand: Generates detailed, actionable prompt
- 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.