Azure AI Assistant Service freezes during file creation or file upload operations

I’m working with Azure AI Assistant Service and running into a frustrating issue. When I attempt to use the assistant for basic text generation without involving file operations, everything functions smoothly. However, as soon as I request it to generate files or upload anything, the entire process gets stuck.

Here’s the situation with my code:

execution = client.assistants.create_and_run_thread(thread_id=conversation.id, assistant_id=my_assistant.id)

print(f"Execution status: {execution.status}\nExecution info: {execution}")

The status remains at RunStatus.IN_PROGRESS for exactly 10 minutes before switching to expired, which aligns with the documented timeout behavior.

For instance, if I send a message like “Tell me a funny story”, it processes right away. However, if I modify it to “Tell me a funny story and save it to story.txt”, it hangs entirely.

I’ve tested this using different GPT models across various regions and consistently encounter the same outcome. My environment is set up with Python 3.12.8 and azure-ai-projects 1.0.0b4.

Has anyone else experienced this file handling problem with Azure AI Assistant Service? Any suggestions for troubleshooting would be greatly appreciated.

I hit this exact timeout issue when migrating from REST API to Python SDK. It’s usually the assistant config, not your code.

Check your model deployment settings in Azure OpenAI Studio first. Some model versions are flaky with code interpreter - I’d switch to gpt-4-turbo if you’re using something else.

The default 10-minute timeout isn’t enough for file operations, especially with backend latency. Bump up the timeout in your client config.

That azure-ai-projects version (1.0.0b4) has known file handling bugs. Either upgrade to the latest beta or just use the openai library directly with Azure endpoints for file stuff.

For debugging, turn on verbose logging to see where it’s actually stalling. Log the full request/response cycle for file operations vs regular text generation - that’s what finally helped me nail down the issue.

Had this exact problem last month building a document processing pipeline. It’s not your code or config - it’s how Azure handles the handoff between the assistant and file system backend. What fixed it for me: use a polling mechanism instead of relying on single execution calls. After creating the run, poll status every 30 seconds and check for intermediate states. Sometimes the assistant actually finishes the file operation but the status never updates. Also, file operations trigger extra security validations on Azure’s side, especially on shared tenants. Try running the same file creation request during off-peak hours - I saw way better response times outside business hours. One reliable workaround: split file requests into two separate operations. First ask the assistant to generate the content, then in a follow-up request ask it to save that content to a file. This bypasses whatever causes the initial hang in combined operations.

Been there, dealt with this exact headache about 6 months ago when we were implementing file operations with Azure AI Assistant.

You’re hitting a common issue - Azure AI Assistant has separate execution paths for text responses versus file operations. When you ask it to create or save files, it invokes the code interpreter tool in the background, which is where things get stuck.

First thing to check: make sure your assistant actually has the code interpreter tool enabled. Go to your assistant configuration and verify it’s listed in the tools array. Without it, the assistant will just hang when trying to do file operations.

Second issue I ran into was permissions. The assistant needs proper storage access to create files. Check your Azure resource group permissions and make sure the AI service has contributor access to the storage account.

Also try this - instead of using create_and_run_thread, break it down into separate steps. Create the thread first, add your message, then run it. This gives you better visibility into where exactly it’s failing.

One more thing that helped us: explicitly specify the file operations in your assistant instructions. Something like “You can create and save files using the code interpreter tool when requested.”

This video covers the setup process really well and shows how to properly configure the tools:

Let me know if you’re still stuck after checking the tool configuration.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.