I’m working with Azure AI Agent Service and running into a frustrating problem. When I try to use the Assistant for basic text tasks, everything works fine. But as soon as I ask it to do anything with files like creating or uploading them, the whole thing just freezes.
Here’s what happens with my code:
execution = client.agents.create_and_process_run(thread_id=my_thread.id, assistant_id=my_agent.id)
print(f"Execution status: {execution.status}\nExecution info: {execution}")
When I send simple requests like “Tell me a funny story”, it responds immediately. But if I change it to “Tell me a funny story and save it to story.txt”, the status gets stuck on IN_PROGRESS for exactly 10 minutes before timing out with an expired status.
I’ve tested this with different models including gpt-4o-mini and gpt-4o in various regions, but the same issue occurs every time. I’m using Python 3.12.8 with azure-ai-projects version 1.0.0b4. Has anyone else encountered this file handling timeout issue with Azure AI Agents?
Yes, this issue is commonly encountered within the Azure AI Agent Service in relation to file operations. I experienced a similar situation recently while working on document processing. The 10-minute timeout you’re observing is the standard limit for agent executions, indicating that the task isn’t completing successfully. This often occurs when the agent attempts file operations that aren’t correctly configured in your Azure setup. To resolve this, ensure that file operations are explicitly enabled in your agent’s configuration and that the necessary tools are attached to your assistant. Depending on your needs, you might need to include either “file_search” or “code_interpreter” tools when you create the assistant. If these tools aren’t properly set up, the agent can freeze while trying to execute commands lacking the necessary permissions. Additionally, it’s worth checking your Azure subscription limits regarding file operations and permissions for storage access.
had the exact same issue last week! my agent was missing the code_interpreter tool completely. make sure you added tools=[{“type”: “code_interpreter”}] when creating your assistant. without it, the agent just hangs on file tasks even tho regular chat works fine.
Check your execution monitoring first. create_and_process_run doesn’t show you what’s happening during those 10 minutes.
I hit this exact issue 6 months ago building a report generator. The agent was working on the file operation but kept hitting internal errors that weren’t surfacing.
Switch to polling instead:
run = client.agents.create_run(thread_id=my_thread.id, assistant_id=my_agent.id)
while run.status in ['queued', 'in_progress']:
time.sleep(2)
run = client.agents.get_run(thread_id=my_thread.id, run_id=run.id)
print(f"Status: {run.status}")
This shows you exactly where it fails. For me, the agent was trying to create files in a directory that didn’t exist in the sandbox.
Check if you’re using the right file path format too. Azure’s code interpreter expects specific path patterns. If you just say “save to story.txt” without being explicit about the working directory, it breaks.
Try “create a file called story.txt in the current directory” instead and see if polling reveals more about the failure.
Hit this exact issue last month while processing a batch of documents. Those timeouts usually mean the assistant can’t access storage properly - it’s not just about adding code_interpreter. You need to check that your Azure AI service is actually linked to a storage account with the right permissions. My setup looked fine, but the storage permissions were screwed up at the resource group level. Go into Azure portal and make sure your AI service has contributor access to storage. Also check if the storage account’s firewall is blocking programmatic access. One more thing - you might be hitting concurrent execution limits. Azure AI Agents will throttle and queue operations forever if you go over certain thresholds.