Hide agentserver response internals from API surface - #48370
Hide agentserver response internals from API surface#48370Shivakishore14 wants to merge 46 commits into
Conversation
Move response contracts to local TypedDict wire payloads and remove runtime reliance on generated model constructors, serialization helpers, and nested generated SDK model paths. Keep validation behind a stable local wrapper and update tests to exercise dict-native payloads instead of generated model runtime callability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the source-built TypeSpec Python emitter TypedDict output as the model source instead of the localized bridge artifact. Normalize the emitted package into the local AgentServer generated boundary and remove fake model_base/_models compatibility shims. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pin AgentServer TypeSpec generation to the source PR that removes stale OpenAI usage decorators and enables Python TypeDict generation. Replace the old finalization script with a minimal contract extractor, regenerate API docs and model contracts, and remove unused _types.py output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Regenerate AgentServer response TypedDict contracts, validators, and API docs from the current AgentServer service contract path. Point tsp-location.yaml at the fresh spec PR commit and compile from the clean synced Foundry/src root. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Inline the single-use wire field mutation helper and remove a thin Foundry serializer wrapper that only delegated to to_wire_dict. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Generate the TypedDict enum fallback at the root _generated package so validators use the same _enums import shape as latest main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Point AgentServer Responses generation metadata at the latest spec PR commit after CI-only validation fixes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Address runtime dict-native response compatibility, static analysis, spelling, and Sphinx documentation failures for the AgentServer Responses package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Update samples to use TypedDict-safe access and required discriminator fields so package Pyright validation passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Regenerate AgentServer response contracts from the rapida/add-agentserver-view spec branch and restore the SDK TypeSpec pointer layout to the main SDK shape with only the commit updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Fix review feedback for dict-native response models by completing ID generation coverage, preserving wire field names, filtering storage-only SSE fields, and restoring ResponseIncompleteReason as a public compatibility enum. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Sanitize generated model docstrings that Sphinx treats as warnings, narrow public model exports to actual generated types, and add package spellcheck words for generated response ID prefixes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Avoid using generated enum fallback objects in runtime code by comparing against the stable wire string values directly, and annotate the ID dispatch table for mypy. Regenerate API stubs after the public export cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Handle scale service tier validation, tighten input text extraction, preserve required statuses on search output items, reject output-only item types from input conversion, and keep generated union aliases public without exposing enum literal aliases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Use a correctly spelled invalid enum member name in the generated enum fallback regression test so CSpell does not flag the test-only typo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Generate runtime enum classes from literal aliases so enum members preserve isinstance and iteration semantics, and materialize response timestamps as Unix integers in emitted wire payloads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Move custom request validators out of the TypeSpec-emitted _generated package and align validation helper names with TypedDict Literal contracts instead of enum shims. Preserve scale service_tier support by reading the generated CreateResponse field literal before schema alias fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Update the AgentServer responses SDK to consume the spec fix that removes the server-assigned id field from function-call input items. Regenerate TypedDict contracts, request validators, and API stubs, and add a checked typing contract for CreateResponse function-call input without id. Spec PR: Azure/azure-rest-api-specs#44927 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Update the AgentServer responses TypeSpec pin to the spec PR tip that includes the function-call input id fix and CI metadata for the SDK-only contracts folder. Spec PR: Azure/azure-rest-api-specs#44927 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Enforce generated Literal aliases for enum-like schemas, reject unknown discriminators, preserve nullable literal refs, export public Literal aliases, and clean generated validator/temp outputs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ead3de5-a3b3-4d3a-bf93-a4ee397d7498
Hide internal validation errors and response builder helpers from the public API while preserving public runtime types and model expansion helpers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a 2.0.0b1 changelog entry for the API surface cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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. |
There was a problem hiding this comment.
Pull request overview
Attempts to reduce the package’s public API surface by privatizing implementation helpers and updating generated API artifacts.
Changes:
- Privatizes validation errors and response builders.
- Removes selected top-level helper exports.
- Updates tests, documentation, API artifacts, and version metadata.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/test_validation.py |
Uses private validation errors. |
tests/unit/test_response_execution.py |
Tests renamed private builder. |
tests/unit/test_generated_payload_validation.py |
Updates private error import. |
tests/unit/test_error_source_classification.py |
Updates private error import. |
doc/azure.ai.agentserver.responses.models.rst |
Removes public errors documentation. |
CHANGELOG.md |
Records API cleanup release. |
models/runtime.py |
Renames response builders as private. |
models/_errors.py |
Marks validation helpers internal. |
hosting/_validation.py |
Uses private validation errors. |
hosting/_request_parsing.py |
Uses private validation errors. |
_version.py |
Bumps version to 2.0.0b1. |
responses/__init__.py |
Removes two top-level helper exports. |
api.metadata.yml |
Updates API artifact metadata. |
api.md |
Regenerates the documented API surface. |
…i-review-public-surface # Conflicts: # sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (2)
sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/runtime.py:344
- Prefixing these two builders with
_does not perform the described move of runtime helpers/state to a private module.models/runtime.pyremains public, and the regenerated API still exposes the resolver/apply helpers plusResponseExecution,ResponseModeFlags,StreamEventRecord, andStreamReplayStateundermodels.runtime(api.md:5924-6124). Move this implementation tomodels._runtime, update its imports/docs/tests, and regenerate the API artifacts.
def _build_cancelled_response(
sdk/agentserver/azure-ai-agentserver-responses/api.metadata.yml:1
- The regenerated surface still exposes
azure.ai.agentserver.responses.models.get_content_expandedatapi.md:1755becausemodels/__init__.pycontinues to import it and list it in__all__. This contradicts the PR's stated removal; remove those export entries and regenerate both API artifacts.
apiMdSha256: 791aa262be4b10719e1a9ddde5516041bdad4d169806f83d5ebaef26474ccb30
Keep contract-bearing runtime types public, but move terminal response helpers and replay state to the private models._runtime module. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md:8
- This release note understates a breaking API change: the public
models.errors/models.runtimemembers are removed, andresponses.__init__also drops the root-levelget_conversation_idandto_output_itemexports without mentioning them. This package records public removals under### Breaking Changes(see this file at lines 83–88), so please classify and enumerate these removals rather than presenting them as an unspecified cleanup.
- Cleaned up the public API surface by moving validation-only error helpers and runtime terminal/replay helpers to private implementation modules.
Remove the separate models._runtime module and keep implementation-only runtime helpers in models.runtime with leading underscores. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Azure-style parameter and return documentation required by pylint for private runtime helpers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…blic-surface' into sshiva/agentserver-api-review-public-surface
|
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. |
|
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. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md:7
- This release also removes the public top-level
get_conversation_idandto_output_itemexports, so existing imports will fail, but the changelog only calls out the error/runtime changes. Please list these removals explicitly so the breaking API change is discoverable.
- Cleaned up the public API surface by moving validation-only error helpers to a private implementation module and renaming runtime terminal/replay helpers as private.
[Pilot] PR Pipeline Failure AnalysisA CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green. What failedOne test is consistently failing across 5 platform/build matrix combinations (macOS Python 3.11, Ubuntu Python 3.12 sdist & whl, Ubuntu Python 3.13 sdist & whl, Ubuntu Python 3.14 whl):
The failure is in the Recommended next steps
Raw pipeline analysis (azsdk ci analyze)
|
Addresses the APIView feedback from PR #47995 by tightening the
azure-ai-agentserver-responsespublic API surface while preserving contract-bearing types.Changes:
azure.ai.agentserver.responses:get_conversation_idto_output_itemazure.ai.agentserver.responses.modelsfor SDK parity:get_content_expandedget_conversation_expandedget_conversation_idget_input_expandedget_tool_choice_expandedmodels.errorsto privatemodels._errors.models.ApiErrorResponseandmodels.Errorremain unchanged.ApiErrorResponse.error: Errorshape is preserved.models.runtimepublic becauseResponseExecution,ResponseModeFlags, andStreamEventRecordappear in public signatures.models.runtime:_build_cancelled_response_build_failed_response_apply_cancelled_terminal_apply_failed_terminal_resolve_cancelled_response_resolve_failed_response_StreamReplayStatemodels.runtimeAPI surface.2.0.0b1changelog/version entry for this API cleanup.api.mdandapi.metadata.yml.Validation:
azpysdk apistub .azsdk_package_build_code(Python build no-op)azsdk_package_run_checkwithLinting