1from kern.agent import Agent
2from kern.models.openai import OpenAIResponses
3from kern.tools.dalle import DalleTools
4
5image_agent = Agent(
6 model=OpenAIResponses(id="gpt-5.2"),
7 tools=[DalleTools()],
8 description="You are an AI agent that can generate images using DALL-E.",
9 instructions="When the user asks you to create an image, use the `create_image` tool to create the image.",
10 markdown=True,
11)
12
13image_agent.print_response("Generate an image of a white siamese cat")
14
15images = image_agent.get_images()
16if images and isinstance(images, list):
17 for image_response in images:
18 image_url = image_response.url
19 print(image_url)