Implement generative AI and agentic solutions 2.1 Build generative applications by using Foundry

An app calls a Foundry agent through the Responses API for a complex reasoning task that…

Study guide skill: Design workflows, tool-augmented flows, and multistep reasoning pipelines

Question B6-015

An app calls a Foundry agent through the Responses API for a complex reasoning task that can run for a long time. The client must be able to start the task, disconnect, and check back later for the final output. What should you do?

Select one answer.

  • A Set tool_choice to none so that the agent finishes without calling tools
  • B Stream the response so that partial results arrive as they're generated
  • C Create a conversation for the task so that the service keeps the response history
  • D Set background to true when creating the response, and then poll the response status until it completes ✓ Correct answer

Answer: D

Background mode runs the agent asynchronously, which suits long-running tasks such as complex reasoning: set background to true when you create the response, and then poll the response status until it completes, so the client can disconnect and check back later. Streaming returns partial results incrementally as they're generated rather than letting the client leave and return for the final output. A conversation keeps history for follow-up turns but doesn't change how a response is delivered, and tool_choice none only stops the agent from calling tools.

Deep dive

How it works

For long-running operations, the Responses API gives you two delivery modes:

  • Streaming returns results incrementally while the connection stays open.
  • Background mode runs completely asynchronously.

Background mode runs the agent asynchronously, which Microsoft says is useful for long-running tasks such as complex reasoning or image generation. You set background to true when you create the response, then poll the response status until it completes. In both modes you typically monitor the response until it finishes and then consume the final output items.

The other options, and when you'd use them

  • tool_choice none: It only means the model doesn't call tools. It has nothing to do with how long the client must stay connected.
  • Stream the response: Streaming delivers partial results incrementally. Fully asynchronous execution is what background mode is for.
  • Create a conversation: Conversations are durable objects that store items such as messages, tool calls and tool outputs, and you can reuse them across sessions. They hold history for later turns but don't make one response run asynchronously.

Exam tip

Start, disconnect, come back = background: true + poll. Watch tokens arrive = stream: true. Multi-turn memory = conversation.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Generative AI & agents questions · AI-103 study guide

Thanks for your feedback!