Implement generative AI and agentic solutions 2.2 Build agents by using Foundry
A Foundry agent's function tool starts a report export in your backend that takes much…
Study guide skill: Build agents that integrate retrieval, function-calling, and conversation memory
Question B4-022
A Foundry agent's function tool starts a report export in your backend that takes much longer than an agent run is allowed to stay open before it expires. Users still need to learn the outcome. Which approach follows the function calling guidance?
Select one answer.
Answer: A
Runs expire a fixed time after creation, and the expiration applies to total elapsed time, not to each function execution, so the guidance for long-running operations is to return a status immediately and implement polling. Waiting for the export or splitting it into shorter calls still runs past the expiration. The function_call_output must carry the call_id from the function call so the agent can match it.
Deep dive
How it works
With function tools in Foundry Agent Service, the model returns a function call, your code runs the function, and you send a function_call_output item back. It carries the call_id from the function call, so the agent can match the result to the call.
There's a hard time limit: runs expire 10 minutes after creation, and you must submit tool outputs before they expire. The function calling page adds that the 10-minute expiration applies to total elapsed time, not individual function execution.
That rules out anything that keeps the run waiting on a long export. The page's guidance for long-running operations: return a status immediately and implement polling. The function returns something like a job ID with "in progress", the run finishes on time, and your app checks the job's status until it completes, then reports the outcome.
The other options, and when you'd use them
- Submit the output without a call_id: The output must carry the call_id from the function call in the previous response. Leaving it out doesn't make the agent wait.
- Split the export into several calls: The expiration covers the run's total elapsed time, so several shorter calls still add up past the limit.
- Keep the function running, then submit: The run expires 10 minutes after creation, before the export finishes.
Exam tip
Long backend job in a function tool = return a status (job ID) immediately and poll. The 10-minute limit is for the whole run.
References
Last reviewed: