> ## 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.

# expand • AI Agent SDK

> expand: Expand a prompt using the specified strategy.

# expand

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**PromptExpanderAgent**](../classes/PromptExpanderAgent) class in the [**prompt\_expander\_agent**](../modules/prompt_expander_agent) module.

Expand a prompt using the specified strategy.

All operations go through an internal Agent which automatically handles
tool calling when tools are provided. The agent decides when to use tools
based on the prompt context.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def expand(prompt: str, strategy: ExpandStrategy, context: Optional[str]) -> ExpandResult
```

## Parameters

<ParamField query="prompt" type="str" required={true}>
  The original user prompt
</ParamField>

<ParamField query="strategy" type="ExpandStrategy" required={false} default="ExpandStrategy.AUTO">
  Expansion strategy to use
</ParamField>

<ParamField query="context" type="Optional" required={false}>
  Additional context to help with expansion
</ParamField>

### Returns

<ResponseField name="Returns" type="ExpandResult">
  ExpandResult containing the expanded prompt
</ResponseField>

## Uses

* `debug`
* `strftime`
* `datetime.now`
* `ExpandResult`

## Used By

* [`PromptExpanderAgent.expand_basic`](../functions/PromptExpanderAgent-expand_basic)
* [`PromptExpanderAgent.expand_detailed`](../functions/PromptExpanderAgent-expand_detailed)
* [`PromptExpanderAgent.expand_structured`](../functions/PromptExpanderAgent-expand_structured)
* [`PromptExpanderAgent.expand_creative`](../functions/PromptExpanderAgent-expand_creative)

## 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#L302">
  `praisonaiagents/agent/prompt_expander_agent.py` at line 302
</Card>
