Azure AI Assistant Service freezes during file creation and upload operations

I’m following the Microsoft Azure AI documentation to set up an agent, but I’m running into a problem when I try to work with files.

The basic functionality works fine. When I send simple messages like “Tell me a funny story”, everything runs smoothly. But as soon as I ask the assistant to create files or upload content, the whole thing gets stuck.

Here’s what happens with my code:

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

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

The status stays at RunStatus.IN_PROGRESS for exactly 10 minutes, then switches to expired. This matches what the docs say about the 10 minute timeout limit.

I tested this with different prompts. “Create a funny story” works perfectly. But “Create a funny story and save it to story.txt” causes the freeze every time. Same issue happens when I try to upload files through the assistant.

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

Has anyone else experienced this file handling issue with Azure AI agents? What could be causing this timeout problem?

The timeout issue you’re experiencing is likely related to the Azure AI service trying to initialize a sandboxed execution environment for file operations. When you request file creation or uploads, the service needs to provision additional resources behind the scenes, which can be resource-intensive and time-consuming.

In my experience, this problem often stems from regional capacity constraints or service throttling. The 10-minute timeout suggests the service is queuing your request but cannot allocate the necessary compute resources within the allowed timeframe. Try switching to a different Azure region that might have better availability for AI services, particularly one of the primary regions like East US or West Europe.

Another factor could be your Azure subscription limits. File operations consume more resources than simple text generation, and if you’re on a free tier or have hit usage quotas, the service might struggle to process these requests. Check your Azure portal for any throttling warnings or quota limitations on your AI services.

The fact that it works consistently with simple text but fails with file operations suggests this is specifically about resource allocation for the code execution environment rather than a general connectivity issue.

i hear ya! that happened to me too. sometimes it’s just about the service permissions. double-check your storage setup in azure, that could be the issue. mine went smoothly after fixing access rights.

This sounds like a code interpreter tool configuration issue. When you ask the assistant to create and save files, Azure AI agents need the code interpreter tool enabled and properly configured in your assistant setup. The timeout occurs because the agent is trying to execute file operations but cannot complete them due to missing tool permissions or configuration. Check your assistant configuration and make sure you’ve explicitly enabled the code_interpreter tool when creating your agent. Also verify that your Azure subscription has the necessary quotas for file operations. I ran into similar issues until I realized I hadn’t properly configured the tools array in my agent creation call. The documentation mentions this briefly but it’s easy to miss.

ran into this myself last week. try creating your agent with explicit tool configuration first, then test with smaller files. the enviroment provisioning can be flaky - sometimes restarting the whole session helps too.

Had this exact problem about 6 months ago when we were rolling out AI assistants for our internal tools. The freeze happens because the code interpreter environment takes time to spin up and initialize, especially for file operations.

What fixed it for me was adding polling with shorter intervals instead of waiting for the full execution to complete. Try breaking it down like this:

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

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

Also make sure your assistant has enough compute resources allocated. File operations need more juice than simple text responses. In our case, we had to bump up the pricing tier to handle the code interpreter workload properly.

This tutorial covers the code interpreter setup really well and shows the polling approach:

One more thing - check if your region supports all the file operations. Some Azure regions have limited AI services capabilities, and file handling might not be fully available everywhere yet.