#!/usr/bin/env python3
"""
Generated test file for Long Input Agent Test
Framework: langgraph
Execution mode: sync
Streaming: no"""

import os
import sentry_sdk

from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage, SystemMessage


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

# Initialize ChatOpenAI for LangGraph
llm = ChatOpenAI(
    model="gpt-4o-mini",
    api_key=os.environ.get("OPENAI_API_KEY"),
)

# Define tools for the agent
def get_word_count(text):
    """Count the number of words in a text"""
    return 2400

tools = [get_word_count]

# Create react agent
agent = create_react_agent(llm, tools=tools, name="summarizer_assistant")

def main():
    # Turn 1: Run agent
    messages = [
        HumanMessage(content="Please summarize the following text in one sentence. You may use the get_word_count tool first if needed: This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. This is a test message that will be repeated many times to create a very long input. "),
    ]

    result = agent.invoke({"messages": messages})

    # Extract the AI's response from the result
    response_text = result["messages"][-1].content

    # Print response
    print(f"Turn 1 Response: {response_text}")

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