Image Transformation Team

Pair a style-advisor agent with an image-transformer agent that uses FalTools to restyle an image via image_to_image.

Transform images with a team: a style advisor recommends transformations and an image transformer applies them.

Code

from agno.agent import Agent
from agno.media import Image
from agno.models.openai import OpenAIResponses
from agno.team import Team
from agno.tools.fal import FalTools

style_advisor = Agent(
    name="Style Advisor",
    role="Analyze and recommend artistic styles and transformations",
    model=OpenAIResponses(id="gpt-5.2"),
    instructions=[
        "Analyze the input image and transformation request",
        "Provide style recommendations and enhancement suggestions",
        "Consider artistic elements like composition, lighting, and mood",
    ],
)

image_transformer = Agent(
    name="Image Transformer",
    role="Transform images using AI tools",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[FalTools(enable_image_to_image=True)],
    instructions=[
        "Use the `image_to_image` tool to generate transformed images",
        "Apply the recommended styles and transformations",
        "Return the image URL as provided without markdown conversion",
    ],
)

# Create a team for collaborative image transformation
transformation_team = Team(
    name="Image Transformation Team",
    model=OpenAIResponses(id="gpt-5.2"),
    members=[style_advisor, image_transformer],
    instructions=[
        "Transform images with artistic style and precision.",
        "Style Advisor: First analyze transformation requirements and recommend styles.",
        "Image Transformer: Apply transformations using AI tools with style guidance.",
    ],
    markdown=True,
)

image_url = "https://fal.media/files/koala/Chls9L2ZnvuipUTEwlnJC.png"
transformation_team.print_response(
    f"Analyze the image at {image_url}, then transform it into a cat dressed as a wizard in a mystic forest.",
    images=[Image(url=image_url)],
    stream=True,
)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install required libraries

uv pip install agno openai fal-client

Set environment variables

export OPENAI_API_KEY=****
export FAL_KEY=****

Run the agent

Save the code above as image_to_image_transformation.py, then run:

python image_to_image_transformation.py