> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Expander Agent • AI Agent SDK

> PromptExpanderAgent: Agent for expanding short prompts into detailed, comprehensive prompts.

# PromptExpanderAgent

> Defined in the [**Prompt Expander Agent**](../modules/prompt_expander_agent) module.

<Badge color="blue">AI Agent</Badge>

Agent for expanding short prompts into detailed, comprehensive prompts.

This agent transforms brief task descriptions into rich, detailed prompts
that provide better context and guidance for task execution.

Key difference from QueryRewriterAgent:

* QueryRewriterAgent: Optimizes queries for search/retrieval (RAG)
* PromptExpanderAgent: Expands prompts for detailed task execution

Attributes:
name: Name of the agent
model: LLM model to use for expansion (alias for llm=)
temperature: Temperature for LLM generation (higher = more creative)
tools: Optional tools for context gathering

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: PromptExpanderAgent"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Constructor

<ParamField query="name" type="str" required={false} default="'PromptExpanderAgent'">
  No description available.
</ParamField>

<ParamField query="model" type="str" required={false} default="'gpt-4o-mini'">
  No description available.
</ParamField>

<ParamField query="instructions" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="verbose" type="bool" required={false} default="False">
  No description available.
</ParamField>

<ParamField query="temperature" type="float" required={false} default="0.7">
  No description available.
</ParamField>

<ParamField query="max_tokens" type="int" required={false} default="1000">
  No description available.
</ParamField>

<ParamField query="tools" type="Optional" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="agent()" icon="function" href="../functions/PromptExpanderAgent-agent">
    Lazy initialization of internal Agent.
  </Card>

  <Card title="expand()" icon="function" href="../functions/PromptExpanderAgent-expand">
    Expand a prompt using the specified strategy.
  </Card>

  <Card title="expand_basic()" icon="function" href="../functions/PromptExpanderAgent-expand_basic">
    Convenience method for basic expansion.
  </Card>

  <Card title="expand_detailed()" icon="function" href="../functions/PromptExpanderAgent-expand_detailed">
    Convenience method for detailed expansion.
  </Card>

  <Card title="expand_structured()" icon="function" href="../functions/PromptExpanderAgent-expand_structured">
    Convenience method for structured expansion.
  </Card>

  <Card title="expand_creative()" icon="function" href="../functions/PromptExpanderAgent-expand_creative">
    Convenience method for creative expansion.
  </Card>
</CardGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
agent = PromptExpanderAgent(model="gpt-4o-mini")
    result = agent.expand("write a poem", strategy=ExpandStrategy.CREATIVE)
    print(result.expanded_prompt)
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/prompt_expander_agent.py#L63">
  `praisonaiagents/agent/prompt_expander_agent.py` at line 63
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
