Skip to main content
Generate images from natural language descriptions with PraisonAI Image Agents — sync or async, with DALL-E integration out of the box.
The user describes an image; the image agent calls the generation API and returns a URL.

How It Works

Quick Start

1

Simple Usage

Set OPENAI_API_KEY in your environment before running.
2

With Configuration

3

Async

achat() is genuinely non-blocking as of PR #5219 — the image round-trip runs on a worker thread, not the event loop. See Non-blocking async below.
Install with LLM support: pip install "praisonaiagents[llm]"

Non-blocking async (PR #5219)

ImageAgent.agenerate_image, agenerate, aedit, avariation, and (transitively) achat now offload the synchronous image call via asyncio.to_thread, so awaiting one no longer freezes the event loop for the 10–60 second image round-trip. Reference: PR #5219, fixes #5162. Run an ImageAgent and a text-only Agent side by side — the text agent keeps streaming while the image generates:
This fix landed for ImageAgent only. VideoAgent (astart, adownload) and AudioAgent (atranscribe) still run their synchronous call inline on the event loop as of PR #5219 and will block a concurrent gather. If a follow-up PR offloads them, this warning will be updated.

Features

DALL-E Integration

Seamless integration with DALL-E for high-quality image generation.

Async Support

Asynchronous operations for better performance in concurrent environments.

Natural Style

Generate images with natural, realistic styling options.

Verbose Mode

Detailed output logging for better debugging and monitoring.

Best Practices

Read OPENAI_API_KEY from the environment — never hardcode keys in source files.
Use dall-e-3 for quality; switch models via the llm parameter when cost or speed matters more.
Use achat() when serving multiple concurrent image requests from a FastAPI or gateway handler.
Pass style="natural" or include style cues in the prompt for consistent visual output across runs.

Multimodal

Text, image, and audio processing with agents

Outbound Media Delivery

Deliver generated images to users via messaging bots

Async Safety

How blocking calls are offloaded to keep the event loop responsive