#!/usr/bin/env python3
"""
Generated test file for Tool Call Agent Test
Framework: openai-agents
Execution mode: async
Streaming: no"""

import os
import sentry_sdk
import asyncio

from agents import function_tool, Agent, Runner


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

# Define tool functions using @function_tool decorator
@function_tool
def add(a: str, b: str):
    """Add two numbers together"""
    return 8

@function_tool
def multiply(a: str, b: str):
    """Multiply two numbers together"""
    return 32

# Create agent with tools
agent = Agent(
    name="math_assistant",
    instructions="A math assistant that can perform basic arithmetic",
    tools=[add, multiply],
    model="gpt-4o-mini",
)

async def main():
    # Turn 1: Build prompt from messages
    prompt = "Calculate (3 + 5) * 4. First use the add tool to add 3 and 5, then use the multiply tool to multiply the result by 4."
    
    # Run agent
    result = await Runner.run(agent, input=prompt)
    
    # Print result
    print(f"Turn 1 Agent result: {result.final_output}")

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