Prompt Expander Agent • AI Agent SDK
PromptExpanderAgent: Agent for expanding short prompts into detailed, comprehensive prompts.
PromptExpanderAgent
Defined in the Prompt Expander Agent module.
AI Agent
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
Constructor
strNo description available.
strNo description available.
Optional[str]No description available.
boolNo description available.
floatNo description available.
intNo description available.
OptionalNo description available.
Methods
Lazy initialization of internal Agent.
expand()Expand a prompt using the specified strategy.
expand_basic()Convenience method for basic expansion.
expand_detailed()Convenience method for detailed expansion.
expand_structured()Convenience method for structured expansion.
expand_creative()Convenience method for creative expansion.
Usage
agent = PromptExpanderAgent(model="gpt-4o-mini")
result = agent.expand("write a poem", strategy=ExpandStrategy.CREATIVE)
print(result.expanded_prompt)Source
View on GitHubpraisonaiagents/agent/prompt_expander_agent.py at line 62