Skip to content

Howie/release 2.7.0 - #49051

Draft
Howie Leung (howieleung) wants to merge 24 commits into
feature/azure-ai-projects/vnextfrom
howie/release-2.7.0
Draft

Howie Leung (howieleung) wants to merge 24 commits into
feature/azure-ai-projects/vnextfrom
howie/release-2.7.0

Conversation

@howieleung

Copy link
Copy Markdown
Member

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.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

… variable arguments and update metadata for version 2.7.0
- Ignore sample_voice_agent_live_text_conversation.py/_async.py in azpysdk's
  recursive samples check (both eng/tools/azure-sdk-tools/azpysdk/samples.py
  and scripts/devops_tasks/test_run_samples.py): the interactive input() loop
  has no timeout/ignore entry, so an automated run can block indefinitely or
  raise EOFError.
- Add a new test_agent_voice_samples group in tests/samples/test_samples.py
  covering samples/agents/voice/, which was previously undiscovered since
  get_sample_paths only lists files directly under samples/agents. The 4
  pure-HTTP samples (basic, generate, versions, with_tools) are now live
  recorded and run for real; the 4 WebSocket-based ones (live_text_conversation,
  live_function_tool, read_conversation, read_conversation_audio) stay skipped
  since they can't be captured/replayed by the test proxy. New recordings
  pushed to azure-sdk-assets and assets.json updated to the new tag.
- sample_voice_agent_generate.py: wrap the post-create output in try/finally
  so the agent is always deleted even if reading/printing the generated
  definition raises.
- sample_voice_agent_read_conversation.py / _audio.py: require
  FOUNDRY_VOICE_AGENT_NAME and FOUNDRY_VOICE_CONVERSATION_ID to be set
  together or both left unset, instead of treating them independently (which
  could mutate a user-owned agent without cleanup, or silently pair a
  conversation id with the wrong default agent).
Per Howie's PR review suggestion: since the temp agent this sample creates
always has exactly one version, capture create_version's return value and
clean up with agents.delete_version(agent_name, agent_version) instead of
agents.delete(agent_name). Functionally equivalent in the normal case
(deleting an agent's last version also removes the agent, verified live),
but more surgical/consistent with the versioned-resource model.

Live-tested end-to-end for both samples' zero-config path: create temp
agent, hold conversation, read back (transcript / audio), clean up via
delete_version, confirmed agent fully removed afterward. black/pylint clean.
Relax the env-var validation from "both or neither" to "conversation_id
requires agent_name" (one-directional), so pointing FOUNDRY_VOICE_AGENT_NAME
at your own existing agent without a conversation_id is now supported: the
sample holds a new conversation against it instead of erroring out.

Only call create_version (and only clean up via delete_version afterward)
when the agent is auto-created by this sample; an explicitly named agent is
assumed to already exist and is used as-is, never modified or deleted.
hold_sample_conversation already raises a clear error if it isn't actually
configured with store=True.

Live-verified all 4 combinations for both samples: neither set (auto-create
+ cleanup), agent-only (new conversation on existing agent, left unmodified,
not deleted), conversation-id-only (blocked with a clear ValueError), and
both set (unchanged, fully manual). black/pylint clean.
…y; improve documentation formatting in _enums.py; update commit reference in tsp-location.yaml
* Address Copilot review feedback on voice-agent samples/tests

- Ignore sample_voice_agent_live_text_conversation.py/_async.py in azpysdk's
  recursive samples check (both eng/tools/azure-sdk-tools/azpysdk/samples.py
  and scripts/devops_tasks/test_run_samples.py): the interactive input() loop
  has no timeout/ignore entry, so an automated run can block indefinitely or
  raise EOFError.
- Add a new test_agent_voice_samples group in tests/samples/test_samples.py
  covering samples/agents/voice/, which was previously undiscovered since
  get_sample_paths only lists files directly under samples/agents. The 4
  pure-HTTP samples (basic, generate, versions, with_tools) are now live
  recorded and run for real; the 4 WebSocket-based ones (live_text_conversation,
  live_function_tool, read_conversation, read_conversation_audio) stay skipped
  since they can't be captured/replayed by the test proxy. New recordings
  pushed to azure-sdk-assets and assets.json updated to the new tag.
- sample_voice_agent_generate.py: wrap the post-create output in try/finally
  so the agent is always deleted even if reading/printing the generated
  definition raises.
- sample_voice_agent_read_conversation.py / _audio.py: require
  FOUNDRY_VOICE_AGENT_NAME and FOUNDRY_VOICE_CONVERSATION_ID to be set
  together or both left unset, instead of treating them independently (which
  could mutate a user-owned agent without cleanup, or silently pair a
  conversation id with the wrong default agent).

* Use delete_version instead of delete for temp agent cleanup

Per Howie's PR review suggestion: since the temp agent this sample creates
always has exactly one version, capture create_version's return value and
clean up with agents.delete_version(agent_name, agent_version) instead of
agents.delete(agent_name). Functionally equivalent in the normal case
(deleting an agent's last version also removes the agent, verified live),
but more surgical/consistent with the versioned-resource model.

Live-tested end-to-end for both samples' zero-config path: create temp
agent, hold conversation, read back (transcript / audio), clean up via
delete_version, confirmed agent fully removed afterward. black/pylint clean.

* Refactor constructors in BetaRealtime and AsyncBetaRealtime to accept variable arguments and update metadata for version 2.7.0

* Support agent-name-only mode in read-conversation samples

Relax the env-var validation from "both or neither" to "conversation_id
requires agent_name" (one-directional), so pointing FOUNDRY_VOICE_AGENT_NAME
at your own existing agent without a conversation_id is now supported: the
sample holds a new conversation against it instead of erroring out.

Only call create_version (and only clean up via delete_version afterward)
when the agent is auto-created by this sample; an explicitly named agent is
assumed to already exist and is used as-is, never modified or deleted.
hold_sample_conversation already raises a clear error if it isn't actually
configured with store=True.

Live-verified all 4 combinations for both samples: neither set (auto-create
+ cleanup), agent-only (new conversation on existing agent, left unmodified,
not deleted), conversation-id-only (blocked with a clear ValueError), and
both set (unchanged, fully manual). black/pylint clean.

* Address Copilot review feedback on voice-agent samples/tests

- Ignore sample_voice_agent_live_text_conversation.py/_async.py in azpysdk's
  recursive samples check (both eng/tools/azure-sdk-tools/azpysdk/samples.py
  and scripts/devops_tasks/test_run_samples.py): the interactive input() loop
  has no timeout/ignore entry, so an automated run can block indefinitely or
  raise EOFError.
- Add a new test_agent_voice_samples group in tests/samples/test_samples.py
  covering samples/agents/voice/, which was previously undiscovered since
  get_sample_paths only lists files directly under samples/agents. The 4
  pure-HTTP samples (basic, generate, versions, with_tools) are now live
  recorded and run for real; the 4 WebSocket-based ones (live_text_conversation,
  live_function_tool, read_conversation, read_conversation_audio) stay skipped
  since they can't be captured/replayed by the test proxy. New recordings
  pushed to azure-sdk-assets and assets.json updated to the new tag.
- sample_voice_agent_generate.py: wrap the post-create output in try/finally
  so the agent is always deleted even if reading/printing the generated
  definition raises.
- sample_voice_agent_read_conversation.py / _audio.py: require
  FOUNDRY_VOICE_AGENT_NAME and FOUNDRY_VOICE_CONVERSATION_ID to be set
  together or both left unset, instead of treating them independently (which
  could mutate a user-owned agent without cleanup, or silently pair a
  conversation id with the wrong default agent).

* Use delete_version instead of delete for temp agent cleanup

Per Howie's PR review suggestion: since the temp agent this sample creates
always has exactly one version, capture create_version's return value and
clean up with agents.delete_version(agent_name, agent_version) instead of
agents.delete(agent_name). Functionally equivalent in the normal case
(deleting an agent's last version also removes the agent, verified live),
but more surgical/consistent with the versioned-resource model.

Live-tested end-to-end for both samples' zero-config path: create temp
agent, hold conversation, read back (transcript / audio), clean up via
delete_version, confirmed agent fully removed afterward. black/pylint clean.

* Support agent-name-only mode in read-conversation samples

Relax the env-var validation from "both or neither" to "conversation_id
requires agent_name" (one-directional), so pointing FOUNDRY_VOICE_AGENT_NAME
at your own existing agent without a conversation_id is now supported: the
sample holds a new conversation against it instead of erroring out.

Only call create_version (and only clean up via delete_version afterward)
when the agent is auto-created by this sample; an explicitly named agent is
assumed to already exist and is used as-is, never modified or deleted.
hold_sample_conversation already raises a clear error if it isn't actually
configured with store=True.

Live-verified all 4 combinations for both samples: neither set (auto-create
+ cleanup), agent-only (new conversation on existing agent, left unmodified,
not deleted), conversation-id-only (blocked with a clear ValueError), and
both set (unchanged, fully manual). black/pylint clean.

---------

Co-authored-by: Xiting Zhang <xitzhang@microsoft.com>
Co-authored-by: Howie Leung <howieleung@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…y mode (#49071)

sample_voice_agent_read_conversation.py and its audio counterpart called
create_version() on FOUNDRY_VOICE_AGENT_NAME whenever no conversation_id was
set, even when agent_name pointed to a real, user-owned agent rather than a
temporary one created by the sample. If that agent's current version content
happened to match the sample's hardcoded definition, the service deduped and
returned the existing version instead of creating a new one; the sample's
cleanup then deleted that version, which -- since it was the agent's only
version -- deleted the entire agent.

Fix: capture owns_agent = not agent_name before defaulting agent_name, and
only call create_version (and thus only ever populate created_version, which
gates the delete_version cleanup) when owns_agent is true. When the caller
names their own agent, the sample now holds a conversation against it
directly and never creates, mutates, or deletes it.

Verified live against the worst-case fixture (agent content byte-identical to
the sample's hardcoded definition) across all 4 FOUNDRY_VOICE_AGENT_NAME /
FOUNDRY_VOICE_CONVERSATION_ID combinations for both samples: the agent-only
mode no longer issues any create/delete calls and the agent survives, while
the other 3 combinations are unaffected.

Co-authored-by: Xiting Zhang <xitzhang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants