Azure AI Assistant Service gets stuck during file operations and times out

I’m working with the Azure AI Agent Service and running into a frustrating problem. When I try to use the assistant for basic text tasks like generating jokes or simple responses, everything works fine. But as soon as I ask it to do anything with files, the whole thing just hangs.

execution = client.agents.create_and_process_run(
    thread_id=chat_thread.id, 
    assistant_id=my_assistant.id
)

print(f"Execution status: {execution.status}")
print(f"Details: {execution}")

The status stays stuck at RunStatus.IN_PROGRESS for exactly 10 minutes, then switches to expired. This happens whether I’m asking it to create a file with some content or trying to upload something.

For example, a message like “Tell me a funny story” works perfectly. But “Tell me a funny story and save it to story.txt” causes the timeout issue every time.

I’ve tested this with different models including gpt-4o-mini and gpt-4o in various regions, but get the same result. My environment is using Python 3.12.8 with azure-ai-projects version 1.0.0b4.

Has anyone else experienced this file handling issue with Azure AI agents? The 10-minute timeout seems to be the default expiration time, but I can’t figure out why file operations specifically cause this problem.

yeah, sounds like you might need to look into your assistant’s settings. make sure code_interpreter and file_search are turned on, otherwise it’ll get stuck when dealing with files.

Had the same headaches a few months ago. Turned out to be a vector store config issue with file operations. Even with tools enabled, there’s usually a mismatch between the assistant’s vector store settings and what gets created during file processing.

I fixed it by explicitly creating and attaching a vector store to the assistant before running file operations. Without this step, the service gets confused about where to put processed files and hangs forever.

Also check your subscription limits - file operations eat up more resources and if you’re hitting quota limits, Azure won’t tell you clearly. It’ll just time out. Try running the same file operation during off-peak hours and see if that helps.

I’ve hit this exact issue before. Azure AI gets confused when it’s trying to handle file operations and generate responses in the same thread at the same time. What fixed it for me: spin up a separate thread just for file operations, then merge the results back into your main conversation thread. Stops the blocking completely. Also check your region setup - some Azure regions handle files way better than others. I switched from East US to West Europe and saw a huge improvement in file operation speeds. One more thing - that beta version (1.0.0b4) has known file operation bugs. Try the latest stable release if you can, though I get that project requirements don’t always make that possible.

I’ve hit this exact issue before - it’s usually a polling problem with the run status. Azure AI service can be pretty slow with file operations, and the default polling interval might not be frequent enough.

Try adding a custom polling loop instead of relying on the default behavior:

import time

run = client.agents.create_run(
    thread_id=chat_thread.id,
    assistant_id=my_assistant.id
)

while run.status in ['queued', 'in_progress', 'requires_action']:
    time.sleep(2)  # Poll every 2 seconds
    run = client.agents.get_run(thread_id=chat_thread.id, run_id=run.id)
    print(f"Current status: {run.status}")

Also check if your assistant has the file_search tool enabled properly. Sometimes the tool configuration gets messed up and causes these hanging issues.

File operations in Azure AI can take way longer than regular text generation. I’ve seen simple file creation take 3-4 minutes sometimes, especially with gpt-4o. Your 10 minute timeout might actually be hitting a real processing limit rather than a bug.