---
type: email
from: RAÚL MARCANO REIMUNDEZ  <notifications@github.com>
subject: Re: [openai/openai-agents-python] Agent responses are repeated

 multiple times (Issue #1814)
received: 2026-03-06 07:47:18
date_header: Tue, 30 Sep 2025 01:56:01 -0700
priority: normal
status: awaiting_approval
uid: 31611
---

## Email Content

**From:** RAÚL MARCANO REIMUNDEZ  <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] Agent responses are repeated

 multiple times (Issue #1814)
**Date:** Tue, 30 Sep 2025 01:56:01 -0700

### Body (preview)

raul-marcano-reimundez left a comment (openai/openai-agents-python#1814)



### Agent Initialization



```python

def create_agent_for_role(role: str):

    agent = Agent(

        name="Main Agent",

        instructions=Main_instructions,

        model=LLM_DEFAULT_MODEL,

        input_guardrails=[],

        tools=[

            FileSearchTool(

                max_num_results=3,

                vector_store_ids=[VS_GLOBAL],

                include_search_results=True

            )

        ],

        model_settings=ModelSettings(top_p=1, temperature=0.25)

    )

    available_functions = AvailableFunctions()

    allowed_functions = available_functions.get_functions(role)

    agent.tools.extend(allowed_functions)

    return agent

```



### Message Processing Method



```python

async def process_message(message: str, conv_id: str = None, role: str = Role.USER, context: dict = None):

    try:

        if conv_id:

            session = OpenAIConversationsSession(

                conversation_id=conv_id,

                openai_client=AsyncOpenAI(api_key=settings.OPENAI_API_KEY)

            )

        else:

            session = OpenAIConversationsSession(

                openai_client=AsyncOpenAI(api_key=settings.OPENAI_API_KEY)

            )

            conv_id = await session._get_session_id()



        dynamodb_service = DynamodbService()

        conversation = dynamodb_service.get(conv_id, ConversationDB)

        input_message = Message(

            role="user",

            createdAt=int(time()),

            text=message

        )

        if not conversation:

            conversation = ConversationDB(

                id=conv_id,

                Messages=[input_message]

            )

            success = dynamodb_service.save(conversation)

            if not success:

                logger.error(f"Error al guardar la conversación en tabla '{ConversationDB.table_name()}'.")

            else:

                logger.info(f"Men

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
