Skip to content

Update item type check for workflow actions#45260

Open
spotakash wants to merge 1 commit intoAzure:mainfrom
spotakash:patch-1
Open

Update item type check for workflow actions#45260
spotakash wants to merge 1 commit intoAzure:mainfrom
spotakash:patch-1

Conversation

@spotakash
Copy link

As per SDK, package name correction and item payload correction. Else there will be error indicates event.item is None when you try to access event.item.type. Add a null check before comparing the type

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

As per SDK, package name correction and item payload correction. Else there will be error indicates event.item is None when you try to access event.item.type. Add a null check before comparing the type
Copilot AI review requested due to automatic review settings February 19, 2026 15:30
@github-actions github-actions bot added AI Projects Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Feb 19, 2026
@github-actions
Copy link

Thank you for your contribution @spotakash! We will review the pull request and get back to you soon.

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 PR updates the streaming event handling in the azure-ai-projects multi-agent workflow sample to avoid errors when event.item is missing, and adjusts the item type check logic.

Changes:

  • Adds a null check for event.item before reading event.item.type during streaming.
  • Replaces the workflow-action type comparison with a string-based check.
  • Updates the imported model symbol list in the sample.

PromptAgentDefinition,
WorkflowAgentDefinition,
ItemResourceType,
ItemResource,
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

ItemResource is imported but never used in this sample. This will trigger unused-import linting in many CI configurations. If the intent is to avoid string literals for the item type check, consider importing/using ItemResourceType instead; otherwise remove this import entirely.

Suggested change
ItemResource,

Copilot uses AI. Check for mistakes.
Comment on lines 158 to +160
if (
event.type == "response.output_item.added" or event.type == "response.output_item.done"
) and event.item.type == ItemResourceType.WORKFLOW_ACTION:
) and event.item is not None and event.item.type == "workflow_action":
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

This condition hard-codes the item type as the string "workflow_action". The SDK already defines this value in ItemResourceType.WORKFLOW_ACTION, which is safer (avoids typos and stays aligned if the constant ever changes). You can keep the new event.item is not None guard, but compare event.item.type against the enum constant instead of a raw string.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Projects Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments