Skip to main content
Turn a one-line request into a rich, actionable prompt with the PromptExpanderAgent.
The Prompt Expander Agent transforms short, brief prompts into detailed, comprehensive prompts for better task execution. Unlike the Query Rewriter (which optimizes for search/retrieval), the Prompt Expander focuses on enriching prompts for task execution. Agents: 1 — Specialized agent for prompt enhancement.

Quick Start

1

Simple Usage

Expand a short prompt with the default strategy.
2

With a Strategy

Choose how aggressively to expand.

How It Works

Workflow

  1. Receive short prompt
  2. Optionally gather context via tools
  3. Apply expansion strategy
  4. Return detailed, actionable prompt

Setup

Run — Python

Run — CLI

Run — agents.yaml

Serve API

Expansion Strategies

BASIC

Simple expansion with clarity improvements. Fixes ambiguity and adds minimal context.

DETAILED

Rich expansion with context, constraints, format guidance, and quality expectations.

STRUCTURED

Expansion with clear sections: Task, Format, Requirements, Style, Constraints.

CREATIVE

Expansion with vivid, inspiring language and creative direction.

Basic Usage

Using Specific Strategies

Using Tools for Context

Configuration Options

ExpandResult Properties

Convenience Methods

Key Difference from Query Rewriter

Example: Movie Script

Input:
Expanded (Creative Strategy):

Monitor / Verify

Features Demonstrated

Best Practices

Use BASIC to fix ambiguity, STRUCTURED for task specs, and CREATIVE for writing prompts. The wrong strategy over- or under-expands the request.
Creative strategies benefit from a higher temperature. Keep it low for structured, deterministic expansions where you want repeatable output.
Pass tools=[search_tool] so the agent pulls real context before expanding — useful when the prompt references current events or your own data.
This agent enriches prompts for task execution. To optimise text for retrieval and RAG, use the Query Rewriter Agent instead.
Optimise queries for search and retrieval.
Feed an expanded prompt into a research workflow.