Remove allow_preview=True when it's not needed#47797
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes allow_preview=True from AIProjectClient construction (and create_client/create_async_client test helpers) in samples and tests where the underlying feature no longer requires it. It follows the 2.3.0 changelog note that Hosted Agent methods are now stable, and reflects that .beta.* subclient methods (skills, memories, optimization) never required allow_preview. Two OpenAI-endpoint unit tests are renamed to drop the _and_allow_preview suffix.
Changes:
- Drop unnecessary
allow_preview=Truefrom hosted-agent, skills, memories, optimization, and toolbox samples. - Update sync/async
get_openai_clientendpoint tests andtest_prompt_agent_endpoint_responsestests to no longer passallow_preview=True. - In two workflow telemetry tests (which still keep
allow_preview=True), tightenkwargs.get("foundry_model_name")tokwargs["foundry_model_name"]with astrannotation.
Note (out of scope for this diff): the get_openai_client docstrings in azure/ai/projects/_patch.py and aio/_patch.py still state that agent_name requires allow_preview=True and may raise ValueError; these were not updated here and now diverge from actual behavior — a follow-up may be warranted.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/responses/test_openai_client_endpoint.py | Renamed test and removed allow_preview=True; verifies agent base_url without preview flag |
| tests/responses/test_openai_client_endpoint_async.py | Async counterpart of the same rename/removal |
| tests/agents/test_agents_crud.py | Dropped allow_preview=True from create_client in prompt-agent endpoint test |
| tests/agents/test_agents_crud_async.py | Async counterpart of the same removal |
| tests/agents/telemetry/test_responses_instrumentor.py | Kept allow_preview=True (workflow agent); tightened foundry_model_name kwargs access + type annotation |
| samples/skills/sample_skills_crud.py / _async.py | Removed allow_preview=True (uses .beta.skills) |
| samples/skills/sample_skills_upload_and_download.py / _async.py | Removed allow_preview=True (uses .beta.skills) |
| samples/memories/sample_memory_basic.py / _async.py | Removed allow_preview=True (uses .beta.memory_stores) |
| samples/hosted_agents/sample_create_hosted_agent.py / _async.py | Removed allow_preview=True (stable .agents.create_version) |
| samples/hosted_agents/sample_toolbox_with_skill.py | Removed allow_preview=True (stable agents/toolboxes + .beta.skills) |
| samples/agents/tools/sample_agent_toolbox_skill.py | Removed allow_preview=True (stable agents/toolboxes + .beta.skills) |
| samples/agents/optimization/sample_optimization_job_basic.py / _basic_async.py / _cancel.py / _list_get_delete.py | Removed allow_preview=True (uses .beta.agents optimization) |
… and adjust protocol version
…s and requirements
…ts, and enhance cspell configuration
No description provided.