Code
Copy
Ask AI
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.fal import FalTools
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
id="image-to-image",
name="Image to Image Agent",
tools=[FalTools()],
markdown=True,
debug_mode=True,
instructions=[
"You have to use the `image_to_image` tool to generate the image.",
"You are an AI agent that can generate images using the Fal AI API.",
"You will be given a prompt and an image URL.",
"You have to return the image URL as provided, don't convert it to markdown or anything else.",
],
)
agent.print_response(
"a cat dressed as a wizard with a background of a mystic forest. Make it look like 'https://fal.media/files/koala/Chls9L2ZnvuipUTEwlnJC.png'",
stream=True,
)
Usage
1
Set up your virtual environment
Copy
Ask AI
uv venv --python 3.12
source .venv/bin/activate
2
Set your API key
Copy
Ask AI
export OPENAI_API_KEY=xxx
export FAL_KEY=xxx
3
Install dependencies
Copy
Ask AI
uv pip install -U openai fal agno
4
Run Agent
Copy
Ask AI
python cookbook/agent_basics/multimodal/image_to_image_agent.py