Azure AI Assistant Service freezes during file operations and generation tasks

I’m working with Azure AI Assistant Service and following the official Microsoft tutorial. Everything runs smoothly when I don’t involve file operations, but I hit a major roadblock when trying to generate or upload files.

process_run = ai_client.agents.create_and_process_run(
    thread_id=current_thread.id, 
    assistant_id=my_agent.id
)

print(f"Process status: {process_run.status}")
print(f"Details: {process_run}")

The code above gets stuck with RunStatus.IN_PROGRESS for exactly 10 minutes, then times out with an expired status. This matches the documented behavior where runs expire after 10 minutes if no tool outputs are submitted.

I monitored the status in the operations_patch.py file and confirmed this behavior. Simple requests like “Tell me a funny story” work perfectly. But if I modify it to “Tell me a funny story and save it to story.txt”, the service hangs completely.

The same freezing happens with file uploads too. I tested with both gpt-4o-mini and gpt-4o models in different regions but got identical results.

My setup uses Python 3.12.8 with azure-ai-projects 1.0.0b4. Has anyone encountered this file handling issue before?

I hit this exact issue with Azure AI Assistant Service last month. It’s not the polling - it’s incomplete tool configuration. When you enable file operations, the assistant tries to use the code interpreter tool automatically. But if your agent wasn’t created with proper tool permissions, it just hangs there. Check your agent creation code. You need to explicitly enable tools like {“type”: “code_interpreter”} when you initialize the assistant. I assumed file operations would work automatically - they don’t. You need specific tool declarations upfront. Also make sure your Azure subscription has permissions for file storage operations. That timeout you’re seeing? The service is waiting for tool authorization that never comes through because of missing config.

This is definitely a tool execution issue, not a general service problem. When you ask for file operations, the assistant uses specific tools (like code interpreter for creating files). These tool calls aren’t getting handled properly in your setup. The 10-minute timeout happens because the assistant’s waiting for tool outputs that never get processed. You need to add a polling mechanism that checks for required actions while the run executes. When the run status shows tools need to execute, you’ve got to handle those calls and submit the outputs back. Without this tool handling loop, any file request will hang forever. Double-check that your tool execution handlers are configured correctly in your code.