#!/usr/bin/env python3
"""
Generated test file for Vision Agent Test
Framework: pydantic-ai
Execution mode: async
Streaming: no"""

import os
import sentry_sdk
import asyncio

from pydantic_ai import Agent, ImageUrl, RunContext


sentry_sdk.init(
    dsn=os.environ.get("SENTRY_DSN"),
    traces_sample_rate=1.0,
    send_default_pii=True,
    stream_gen_ai_spans=True,
)



# Create Pydantic AI agent with system prompt
agent = Agent(
    "openai:gpt-4o-mini",
    system_prompt="You are a helpful assistant that can analyze images. Be concise.",
    name="vision_assistant"
)


async def main():
    # Turn 1: Run agent
    

    try:
        # Multimodal content - build message parts
        message_parts = []
        message_parts.append("What color is this image? Reply with just the color name.")
        message_parts.append(ImageUrl(url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mP8z8BQz0AEYBxVSF+FABJADveWkH6oAAAAAElFTkSuQmCC"))
        result = await agent.run(message_parts)

        # Print response
        print(f"Turn 1 Response: {result.output}")
    except Exception as e:
        print(f"Turn 1 Error: {type(e).__name__}: {e}")

if __name__ == "__main__":
    with sentry_sdk.start_transaction(op="test", name="Vision Agent Test"):
        asyncio.run(main())
    sentry_sdk.flush(timeout=5)
