diff --git a/agents-api/agents_api/routers/sessions/chat.py b/agents-api/agents_api/routers/sessions/chat.py index fdca52f27..b8bbf85eb 100644 --- a/agents-api/agents_api/routers/sessions/chat.py +++ b/agents-api/agents_api/routers/sessions/chat.py @@ -99,11 +99,12 @@ async def chat( if isinstance(model_response, ModelResponse): total_tokens = model_response.usage.total_tokens + job_id = uuid4() + if ( chat_context.session.token_budget is not None and total_tokens >= chat_context.session.token_budget ): - job_id = uuid4() if chat_context.session.context_overflow == "adaptive": await run_summarization_task(session_id=session_id, job_id=job_id) elif chat_context.session.context_overflow == "truncate":