โ† Back to guides

OpenAI Agents SDK + Agent Media Tools

Updated July 13, 2026 ยท 5 min read

The OpenAI Agents SDK lets you build autonomous AI agents that use tools. By connecting it to Agent Media Tools, your agents can resize images, scrape websites, generate PDFs, transcribe audio, and run 70+ utility operations โ€” all from natural language instructions.

โšก Your agents become media-capable. Give them tools for images, PDFs, web scraping, AI generation, and data processing with 5 lines of code.
SDK preview: the agentmediatools package is not published to PyPI yet. The examples below document the reviewed source API for the upcoming release; use direct REST calls from the API reference in production today.

Installation (after publication)

# Preview for after the Agent Media Tools SDK is published:
pip install openai-agents agentmediatools

Basic Setup

from agents import Agent, Runner, function_tool
from agentmediatools import Client

client = Client(api_key="mt_your_key_here")

@function_tool
async def resize_image(image_path: str, width: int, format: str = "webp") -> str:
    """Resize an image to the given width and format."""
    with open(image_path, "rb") as f:
        result = client.image.resize(f, width=width, format=format)
    out_path = f"resized_{image_path}"
    with open(out_path, "wb") as f:
        f.write(result)
    return f"Resized to {width}px โ†’ {out_path}"

@function_tool
async def screenshot_page(url: str) -> str:
    """Take a screenshot of a web page."""
    result = client.web.screenshot(url, full_page=True)
    out_path = "screenshot.png"
    with open(out_path, "wb") as f:
        f.write(result)
    return f"Screenshot saved โ†’ {out_path}"

@function_tool
async def generate_qr(text: str) -> str:
    """Generate a QR code for the given text."""
    result = client.qrcode.generate(text)
    with open("qrcode.png", "wb") as f:
        f.write(result)
    return "QR code saved โ†’ qrcode.png"

@function_tool
async def scrape_webpage(url: str) -> str:
    """Scrape a web page and return its content as markdown."""
    return client.scrape(url)

# Create an agent with these tools
agent = Agent(
    name="Media Assistant",
    instructions="You help users with media tasks. Use the available tools.",
    tools=[resize_image, screenshot_page, generate_qr, scrape_webpage],
)

# Run it
result = await Runner.run(agent, "Take a screenshot of example.com and save it")
print(result.final_output)

Using the Python SDK Directly

You can also skip the tool wrapping and let your agent code call the SDK directly:

from agentmediatools import Client

client = Client(api_key="mt_your_key_here")

# ๐Ÿ–ผ๏ธ Image processing
client.image.resize("photo.jpg", width=1024, format="webp")
client.image.convert("photo.jpg", format="png")
client.image.compress("photo.jpg", quality=70)

# ๐Ÿ“„ PDF operations
client.pdf.merge(["report1.pdf", "report2.pdf"])
text = client.pdf.to_text("document.pdf")

# ๐ŸŒ Web tools
screenshot = client.web.screenshot("https://example.com")
article = client.web.article_extract("https://example.com/blog")

# ๐ŸŽจ AI generation
result = client.ai.generate_image("a cat in a spaceship", wait=True)
print(result["result"]["images"][0]["url"])

# ๐ŸŽ™๏ธ Transcription
transcript = client.ai.transcribe(url="https://example.com/audio.mp3")

# ๐Ÿ” Intel tools
dns_info = client.intel.dns_lookup("example.com")
ssl_info = client.intel.ssl_check("example.com")

OpenAI Codex (ChatGPT Code Interpreter)

For Codex/Code Interpreter, use the Python SDK with inline pip:

# Preview for after registry publication:
!pip install agentmediatools -q

from agentmediatools import Client
client = Client(api_key="mt_your_key_here")

# Generate a QR code
qr = client.qrcode.generate("https://agentmediatools.com")
with open("/mnt/data/qrcode.png", "wb") as f:
    f.write(qr)

# Resize an uploaded image
with open("/mnt/data/photo.jpg", "rb") as f:
    result = client.image.resize(f, width=800, format="webp")
with open("/mnt/data/resized.webp", "wb") as f:
    f.write(result)

# Scrape a web page
content = client.scrape("https://example.com")
print(content[:500])

Available Tools for OpenAI Agents

CategoryTools
๐Ÿ–ผ๏ธ Imageclient.image.resize, convert, compress, analyze, crop, batch_process
๐Ÿ“„ PDFclient.pdf.merge, split, compress, rotate, to_text, to_images, from_images
๐ŸŒ Webclient.web.screenshot, html_to_pdf, article_extract
๐ŸŽจ AI Genclient.ai.generate_image, generate_video, transcribe, ocr, remove_bg
๐Ÿ” Intelclient.intel.dns_lookup, ssl_check, og_preview, regex_test, text_stats
๐Ÿ“ฆ Dataclient.tools.csv_convert, case_convert, slugify, zip_files, unzip
๐Ÿ”— Utilityclient.qrcode.generate, client.pastebin.create, client.shortener.shorten
๐Ÿ› ๏ธ Devclient.dev.uuid, password, hash, base64, ip, timestamp
๐Ÿ”‘ Get your free API key โ†’ agentmediatools.com
SDK source previews are available now; registry installation is pending.