Agent Same Run Image Analysis

Legacy DalleTools example that generates and analyzes an image in one agent run.

This legacy example generates an image with DALL-E and analyzes it in the same run.

DALL-E models are deprecated. This DalleTools example is retained as a legacy reference and no longer runs against the current OpenAI API. Use OpenAITools with GPT Image 2 in Image Generation Agent.

Code

agent_same_run_image_analysis.py
from agno.agent import Agent
from agno.tools.dalle import DalleTools

# Create an Agent with the DALL-E tool
agent = Agent(tools=[DalleTools()], name="DALL-E Image Generator", markdown=True)

response = agent.run(
    "Generate an image of a dog and tell what color the dog is.",
    debug_mode=True,
)

if response.images:
    print("Agent Response", response.content)
    print(response.images[0].url)

Current Alternative

The source above uses removed DALL-E models and is preserved for reference. Follow Image Generation Agent for the current OpenAITools and GPT Image 2 pattern before rebuilding the same-run analysis flow.