Code
image_to_image_agent.py
Usage
1
Set up your virtual environment
2
Install dependencies
3
Export your API keys
4
Run Agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Transform an existing image into a new one with FalTools(enable_image_to_image=True).
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(enable_image_to_image=True)],
markdown=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,
)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno openai fal-client
Export your API keys
export OPENAI_API_KEY="your_openai_api_key_here"
export FAL_KEY="your_fal_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
$Env:FAL_KEY="your_fal_api_key_here"
Run Agent
python image_to_image_agent.py
Was this page helpful?