Skip to content

.NET: Fix FoundryAgents_Step15_ComputerUse sample for Azure Agents API#3989

Merged
rogerbarreto merged 2 commits intomicrosoft:mainfrom
rogerbarreto:bugfix/bugbash-computer-use-foundry-agents-fix
Feb 19, 2026
Merged

.NET: Fix FoundryAgents_Step15_ComputerUse sample for Azure Agents API#3989
rogerbarreto merged 2 commits intomicrosoft:mainfrom
rogerbarreto:bugfix/bugbash-computer-use-foundry-agents-fix

Conversation

@rogerbarreto
Copy link
Member

Motivation and Context

The Azure Agents API rejects previous_response_id alongside computer_call_output items, unlike the vanilla OpenAI Responses API. This fix:

  • Send all prior response output items (reasoning, computer_call, etc.) as input items in follow-up calls so the API has full conversation context
  • Create a fresh session per call to avoid ConversationId/previous_response_id
  • Use currentCallId instead of initialCallId for computer_call_output
  • Clear ContinuationToken after polling to prevent stale tokens
  • Remove unused initialCallId tracking variable

The Azure Agents API rejects previous_response_id alongside computer_call_output
items, unlike the vanilla OpenAI Responses API. This fix:

- Send all prior response output items (reasoning, computer_call, etc.) as input
  items in follow-up calls so the API has full conversation context
- Create a fresh session per call to avoid ConversationId/previous_response_id
- Use currentCallId instead of initialCallId for computer_call_output
- Clear ContinuationToken after polling to prevent stale tokens
- Remove unused initialCallId tracking variable

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 17, 2026 13:21
@github-actions github-actions bot changed the title .Net: Fix FoundryAgents_Step15_ComputerUse sample for Azure Agents API .NET: Fix FoundryAgents_Step15_ComputerUse sample for Azure Agents API Feb 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes the FoundryAgents_Step15_ComputerUse sample to work correctly with the Azure Agents API. The Azure Agents API has specific requirements for computer use that differ from the vanilla OpenAI Responses API—it rejects requests containing previous_response_id alongside computer_call_output items. The fix implements a pattern of creating fresh sessions for each interaction and manually providing full conversation context by re-sending prior response output items.

Changes:

  • Move session creation to occur just before initial request (avoiding premature creation)
  • Add continuation token clearing after polling completes to prevent stale tokens
  • Remove unused initialCallId tracking variable that's no longer needed
  • Use currentCallId instead of initialCallId for computer_call_output
  • Implement Azure-specific pattern: re-send all prior response output items as an assistant message alongside computer_call_output in a fresh session

@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Feb 18, 2026
@rogerbarreto rogerbarreto added this pull request to the merge queue Feb 19, 2026
Merged via the queue into microsoft:main with commit c3eca25 Feb 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments