From d2fb32751b5e31d4356bea01c462798bb14150f6 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Fri, 19 Jun 2026 14:57:43 -0700 Subject: [PATCH 1/8] Fix --- .../azure/ai/projects/aio/operations/_patch_agents_async.py | 6 +++++- .../azure/ai/projects/operations/_patch_agents.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 9b1acdd6cd31..e7dfe45af79b 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -208,6 +208,7 @@ async def upload_session_file( # type: ignore[override] content_or_file_path: "bytes | str", *, path: str, + user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. @@ -227,6 +228,9 @@ async def upload_session_file( # type: ignore[override] :keyword path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult @@ -246,4 +250,4 @@ async def upload_session_file( # type: ignore[override] else: content = content_or_file_path - return await super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) + return await super()._upload_session_file(agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 19a0c25317b2..e4165035b03b 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -224,6 +224,7 @@ def upload_session_file( # type: ignore[override] content_or_file_path: "bytes | str", *, path: str, + user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. @@ -243,6 +244,9 @@ def upload_session_file( # type: ignore[override] :keyword path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult @@ -262,4 +266,4 @@ def upload_session_file( # type: ignore[override] else: content = content_or_file_path - return super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) + return super()._upload_session_file(agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs) From 4f9d7c23f08aaa0f74fa9406de6039f649ca595d Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Fri, 19 Jun 2026 15:10:25 -0700 Subject: [PATCH 2/8] . --- .../ai/projects/operations/_patch_agents.py | 112 ++++++++++++++---- 1 file changed, 91 insertions(+), 21 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index e4165035b03b..cad9864f0fbd 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ +import os from pathlib import Path from typing import Union, Optional, Any, IO, overload from azure.core.exceptions import HttpResponseError @@ -216,20 +217,84 @@ def create_version( raise new_exc from exc raise + @overload + def upload_session_file( + self, + agent_name: str, + session_id: str, + *, + content: bytes, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload binary content to the session sandbox. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword content: The binary content to upload. Required. + :paramtype content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + ... + + @overload + def upload_session_file( + self, + agent_name: str, + session_id: str, + *, + file_path: Union[str, "os.PathLike[str]"], + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload a file from disk to the session sandbox. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword file_path: The full path to a local file whose contents should be uploaded. Required. + :paramtype file_path: str or os.PathLike[str] + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + :raises FileNotFoundError: If *file_path* does not exist. + """ + ... + @distributed_trace def upload_session_file( # type: ignore[override] self, agent_name: str, session_id: str, - content_or_file_path: "bytes | str", *, + content: Optional[bytes] = None, + file_path: Optional[Union[str, "os.PathLike[str]"]] = None, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. - Accepts either a ``bytes`` buffer or a local file path (``str``). + Accepts either binary content directly or a local file path. When a file path is provided the file is read from disk and its contents are forwarded to the service. Maximum file size is 50 MB. Uploads exceeding this limit return 413 Payload Too Large. @@ -238,32 +303,37 @@ def upload_session_file( # type: ignore[override] :type agent_name: str :param session_id: The session ID. Required. :type session_id: str - :param content_or_file_path: The binary content to upload, **or** the full path to a local - file whose contents should be uploaded. Required. - :type content_or_file_path: bytes or str + :keyword content: The binary content to upload. Mutually exclusive with *file_path*. + :paramtype content: bytes + :keyword file_path: The full path to a local file whose contents should be uploaded. + Mutually exclusive with *content*. + :paramtype file_path: str or os.PathLike[str] :keyword path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with - MutableMapping + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: - :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. + :raises ValueError: If both *content* and *file_path* are provided, or neither is provided. + :raises FileNotFoundError: If *file_path* is provided and does not exist. """ - if isinstance(content_or_file_path, str): - - file_path = Path(content_or_file_path) - if not file_path.exists(): - raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") - if file_path.is_dir(): - raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") + if content is not None and file_path is not None: + raise ValueError("Specify either 'content' or 'file_path', not both.") + if content is None and file_path is None: + raise ValueError("Specify either 'content' or 'file_path'.") - with open(content_or_file_path, "rb") as f: - content: bytes = f.read() - else: - content = content_or_file_path + if file_path is not None: + p = Path(file_path) + if not p.exists(): + raise FileNotFoundError(f"The provided file `{file_path}` does not exist.") + if p.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{file_path}`.") + with open(file_path, "rb") as f: + content = f.read() - return super()._upload_session_file(agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs) + return super()._upload_session_file( + agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs + ) From a31d8cabb37e6a29be918a14be7babd9fe98eb35 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Fri, 19 Jun 2026 15:43:02 -0700 Subject: [PATCH 3/8] x --- .../aio/operations/_patch_agents_async.py | 114 ++++++++++++++---- .../ai/projects/operations/_patch_agents.py | 2 + .../sample_sessions_files_upload_download.py | 6 +- ...le_sessions_files_upload_download_async.py | 6 +- 4 files changed, 101 insertions(+), 27 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index e7dfe45af79b..c2901095e831 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ +import os from pathlib import Path from typing import Union, Optional, Any, IO, overload from azure.core.exceptions import HttpResponseError @@ -200,20 +201,84 @@ async def create_version( raise new_exc from exc raise + @overload + async def upload_session_file( + self, + agent_name: str, + session_id: str, + *, + content: bytes, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload binary content to the session sandbox. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword content: The binary content to upload. Required. + :paramtype content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + ... + + @overload + async def upload_session_file( + self, + agent_name: str, + session_id: str, + *, + file_path: Union[str, "os.PathLike[str]"], + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload a file from disk to the session sandbox. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword file_path: The full path to a local file whose contents should be uploaded. Required. + :paramtype file_path: str or os.PathLike[str] + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + :raises FileNotFoundError: If *file_path* does not exist. + """ + ... + @distributed_trace_async async def upload_session_file( # type: ignore[override] self, agent_name: str, session_id: str, - content_or_file_path: "bytes | str", *, + content: Optional[bytes] = None, + file_path: Optional[Union[str, "os.PathLike[str]"]] = None, path: str, - user_isolation_key: Optional[str] = None, + user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. - Accepts either a ``bytes`` buffer or a local file path (``str``). + Accepts either binary content directly or a local file path. When a file path is provided the file is read from disk and its contents are forwarded to the service. Maximum file size is 50 MB. Uploads exceeding this limit return 413 Payload Too Large. @@ -222,32 +287,39 @@ async def upload_session_file( # type: ignore[override] :type agent_name: str :param session_id: The session ID. Required. :type session_id: str - :param content_or_file_path: The binary content to upload, **or** the full path to a local - file whose contents should be uploaded. Required. - :type content_or_file_path: bytes or str + :keyword content: The binary content to upload. Mutually exclusive with *file_path*. + :paramtype content: bytes + :keyword file_path: The full path to a local file whose contents should be uploaded. + Mutually exclusive with *content*. + :paramtype file_path: str or os.PathLike[str] :keyword path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with - MutableMapping + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: - :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. + :raises ValueError: If both *content* and *file_path* are provided, or neither is provided. + :raises FileNotFoundError: If *file_path* is provided and does not exist. """ - if isinstance(content_or_file_path, str): + if content is not None and file_path is not None: + raise ValueError("Specify either 'content' or 'file_path', not both.") + if content is None and file_path is None: + raise ValueError("Specify either 'content' or 'file_path'.") - file_path = Path(content_or_file_path) - if not file_path.exists(): - raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") - if file_path.is_dir(): - raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") + if file_path is not None: + p = Path(file_path) + if not p.exists(): + raise FileNotFoundError(f"The provided file `{file_path}` does not exist.") + if p.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{file_path}`.") + with open(file_path, "rb") as f: + content = f.read() - with open(content_or_file_path, "rb") as f: - content: bytes = f.read() - else: - content = content_or_file_path + assert content is not None # Guaranteed by validation above - return await super()._upload_session_file(agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs) + return await super()._upload_session_file( + agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs + ) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index cad9864f0fbd..dcb2c5ead511 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -334,6 +334,8 @@ def upload_session_file( # type: ignore[override] with open(file_path, "rb") as f: content = f.read() + assert content is not None # Guaranteed by validation above + return super()._upload_session_file( agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py index 123ff986601d..00510ddc353a 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py @@ -65,11 +65,11 @@ ) print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: - # Upload and list session files + print(f"Uploading session file: {data_file1} -> {remote_file_path1}") project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content_or_file_path=data_file1, + file_path=data_file1, path=remote_file_path1, ) @@ -77,7 +77,7 @@ project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content_or_file_path=data_file2, + file_path=data_file2, path=remote_file_path2, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py index 9a9ffb22f507..2fac02d913a9 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py @@ -67,11 +67,11 @@ async def main(): ) print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: - # Upload and list session files + print(f"Uploading session file: {data_file1} -> {remote_file_path1}") await project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content_or_file_path=data_file1, + file_path=data_file1, path=remote_file_path1, ) @@ -79,7 +79,7 @@ async def main(): await project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content_or_file_path=data_file2, + file_path=data_file2, path=remote_file_path2, ) From c98cd4f60f199db07318f68f1737b87431302ae5 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Fri, 19 Jun 2026 16:42:09 -0700 Subject: [PATCH 4/8] rename to remote_path --- .../aio/operations/_patch_agents_async.py | 20 +++++++++---------- .../ai/projects/operations/_patch_agents.py | 20 +++++++++---------- .../sample_sessions_files_upload_download.py | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index c2901095e831..4e86cf201595 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -208,7 +208,7 @@ async def upload_session_file( session_id: str, *, content: bytes, - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -220,9 +220,9 @@ async def upload_session_file( :type session_id: str :keyword content: The binary content to upload. Required. :paramtype content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -239,7 +239,7 @@ async def upload_session_file( session_id: str, *, file_path: Union[str, "os.PathLike[str]"], - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -251,9 +251,9 @@ async def upload_session_file( :type session_id: str :keyword file_path: The full path to a local file whose contents should be uploaded. Required. :paramtype file_path: str or os.PathLike[str] - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -272,7 +272,7 @@ async def upload_session_file( # type: ignore[override] *, content: Optional[bytes] = None, file_path: Optional[Union[str, "os.PathLike[str]"]] = None, - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -292,9 +292,9 @@ async def upload_session_file( # type: ignore[override] :keyword file_path: The full path to a local file whose contents should be uploaded. Mutually exclusive with *content*. :paramtype file_path: str or os.PathLike[str] - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -321,5 +321,5 @@ async def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return await super()._upload_session_file( - agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, path=remote_path, user_isolation_key=user_isolation_key, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index dcb2c5ead511..7dfb430cdc6b 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -224,7 +224,7 @@ def upload_session_file( session_id: str, *, content: bytes, - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -236,9 +236,9 @@ def upload_session_file( :type session_id: str :keyword content: The binary content to upload. Required. :paramtype content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -255,7 +255,7 @@ def upload_session_file( session_id: str, *, file_path: Union[str, "os.PathLike[str]"], - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -267,9 +267,9 @@ def upload_session_file( :type session_id: str :keyword file_path: The full path to a local file whose contents should be uploaded. Required. :paramtype file_path: str or os.PathLike[str] - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -288,7 +288,7 @@ def upload_session_file( # type: ignore[override] *, content: Optional[bytes] = None, file_path: Optional[Union[str, "os.PathLike[str]"]] = None, - path: str, + remote_path: str, user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: @@ -308,9 +308,9 @@ def upload_session_file( # type: ignore[override] :keyword file_path: The full path to a local file whose contents should be uploaded. Mutually exclusive with *content*. :paramtype file_path: str or os.PathLike[str] - :keyword path: The destination file path within the sandbox, relative to the session home + :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. - :paramtype path: str + :paramtype remote_path: str :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. Default value is None. :paramtype user_isolation_key: str @@ -337,5 +337,5 @@ def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return super()._upload_session_file( - agent_name, session_id, content, path=path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, path=remote_path, user_isolation_key=user_isolation_key, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py index 00510ddc353a..ce9b1e950fe3 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py @@ -70,7 +70,7 @@ agent_name=agent_name, session_id=session.agent_session_id, file_path=data_file1, - path=remote_file_path1, + remote_path=remote_file_path1, ) print(f"Uploading session file: {data_file2} -> {remote_file_path2}") @@ -78,7 +78,7 @@ agent_name=agent_name, session_id=session.agent_session_id, file_path=data_file2, - path=remote_file_path2, + remote_path=remote_file_path2, ) print("Listing session files for the session at path '.'...") From a7df7c74ae32ed8020a24d267e45ea89a9901066 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Mon, 22 Jun 2026 09:07:09 -0700 Subject: [PATCH 5/8] Re-emit --- sdk/ai/azure-ai-projects/CHANGELOG.md | 5 +- .../azure-ai-projects/apiview-properties.json | 32 +- .../ai/projects/aio/operations/_operations.py | 133 +- .../aio/operations/_patch_agents_async.py | 2 +- .../azure/ai/projects/models/__init__.py | 56 +- .../azure/ai/projects/models/_enums.py | 61 +- .../azure/ai/projects/models/_models.py | 1355 +++++++++++------ .../ai/projects/operations/_operations.py | 195 +-- .../ai/projects/operations/_patch_agents.py | 2 +- .../sample_sessions_files_upload_download.py | 8 +- ...le_sessions_files_upload_download_async.py | 12 +- sdk/ai/azure-ai-projects/tsp-location.yaml | 2 +- 12 files changed, 1057 insertions(+), 806 deletions(-) diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md index bbb6dbc75839..2cb7b968433a 100644 --- a/sdk/ai/azure-ai-projects/CHANGELOG.md +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features Added * Two new methods `enable` and `disable` on the `.agents` subclient. +* New Agent tool type `REMINDER_PREVIEW`. * Hosted agents are now stable. There is no need to set `allow_preview=True` on the `AIProjectClient` constructor to create a Hosted agent. * Toolboxes operations are now stable. The have moved from `.beta.toolboxes` subclient to the `.toolboxes` subclient. * Session and Session files operations are now stable. They have moved from the `.beta.agents` subclient to the `.agents` subclient. @@ -12,10 +13,12 @@ ### Breaking Changes -Breaking changes in beta methods: +* Toolbox operation `create_version` now defines `tools` of type `List[ToolboxTool]` instead of `List[Tool]`. +* Input argument `path` renamed to `remote_path` in methods `.agents.delete_session_file`, `.agents.download_session_file`, `.agents.list_session_files` and `.agents.upload_session_file`. * Agent Optimization methods `.beta.agents.*optimization*` were re-written. Updated from v1 to v2 preview, focusing on cleanup to better align with Foundry job guidelines and platform standards. The v1 surface accumulated unused candidate sub-resources, internal-detail properties, and custom operation patterns inconsistent with the Foundry platform. The v2 API removes redundant models and operations, adopts shared Foundry job patterns (`JobLike<>`, standard job verbs), and introduces typed discriminated unions for dataset inputs and evaluator references. * Method `.beta.agents.list_optimization_candidates` now returns `ItemPaged[OptimizationCandidate]` instead of `AgentsPagedResultOptimizationCandidate`. The `after` parameter has been removed (use continuation-token-based paging instead). + ### Sample updates * Added `sample_routines_crud.py` to demonstrate CRUD operations. diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index 54446addbddb..024ae453be85 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -3,6 +3,10 @@ "CrossLanguageDefinitionId": { "azure.ai.projects.models.Tool": "OpenAI.Tool", "azure.ai.projects.models.A2APreviewTool": "Azure.AI.Projects.A2APreviewTool", + "azure.ai.projects.models.ToolboxTool": "Azure.AI.Projects.ToolboxTool", + "azure.ai.projects.models.A2APreviewToolboxTool": "Azure.AI.Projects.A2APreviewToolboxTool", + "azure.ai.projects.models.A2aProtocolConfiguration": "Azure.AI.Projects.A2aProtocolConfiguration", + "azure.ai.projects.models.ActivityProtocolConfiguration": "Azure.AI.Projects.ActivityProtocolConfiguration", "azure.ai.projects.models.AgentBlueprintReference": "Azure.AI.Projects.AgentBlueprintReference", "azure.ai.projects.models.AgentCard": "Azure.AI.Projects.AgentCard", "azure.ai.projects.models.AgentCardSkill": "Azure.AI.Projects.AgentCardSkill", @@ -40,6 +44,7 @@ "azure.ai.projects.models.Index": "Azure.AI.Projects.Index", "azure.ai.projects.models.AzureAISearchIndex": "Azure.AI.Projects.AzureAISearchIndex", "azure.ai.projects.models.AzureAISearchTool": "Azure.AI.Projects.AzureAISearchTool", + "azure.ai.projects.models.AzureAISearchToolboxTool": "Azure.AI.Projects.AzureAISearchToolboxTool", "azure.ai.projects.models.AzureAISearchToolResource": "Azure.AI.Projects.AzureAISearchToolResource", "azure.ai.projects.models.AzureFunctionBinding": "Azure.AI.Projects.AzureFunctionBinding", "azure.ai.projects.models.AzureFunctionDefinition": "Azure.AI.Projects.AzureFunctionDefinition", @@ -58,7 +63,9 @@ "azure.ai.projects.models.BlobReferenceSasCredential": "Azure.AI.Projects.SasCredential", "azure.ai.projects.models.BotServiceAuthorizationScheme": "Azure.AI.Projects.BotServiceAuthorizationScheme", "azure.ai.projects.models.BotServiceRbacAuthorizationScheme": "Azure.AI.Projects.BotServiceRbacAuthorizationScheme", + "azure.ai.projects.models.BotServiceTenantAuthorizationScheme": "Azure.AI.Projects.BotServiceTenantAuthorizationScheme", "azure.ai.projects.models.BrowserAutomationPreviewTool": "Azure.AI.Projects.BrowserAutomationPreviewTool", + "azure.ai.projects.models.BrowserAutomationPreviewToolboxTool": "Azure.AI.Projects.BrowserAutomationPreviewToolboxTool", "azure.ai.projects.models.BrowserAutomationToolConnectionParameters": "Azure.AI.Projects.BrowserAutomationToolConnectionParameters", "azure.ai.projects.models.BrowserAutomationToolParameters": "Azure.AI.Projects.BrowserAutomationToolParameters", "azure.ai.projects.models.CaptureStructuredOutputsTool": "Azure.AI.Projects.CaptureStructuredOutputsTool", @@ -71,6 +78,7 @@ "azure.ai.projects.models.CodeBasedEvaluatorDefinition": "Azure.AI.Projects.CodeBasedEvaluatorDefinition", "azure.ai.projects.models.CodeConfiguration": "Azure.AI.Projects.CodeConfiguration", "azure.ai.projects.models.CodeInterpreterTool": "OpenAI.CodeInterpreterTool", + "azure.ai.projects.models.CodeInterpreterToolboxTool": "Azure.AI.Projects.CodeInterpreterToolboxTool", "azure.ai.projects.models.ComparisonFilter": "OpenAI.ComparisonFilter", "azure.ai.projects.models.CompoundFilter": "OpenAI.CompoundFilter", "azure.ai.projects.models.ComputerTool": "OpenAI.ComputerTool", @@ -128,8 +136,6 @@ "azure.ai.projects.models.EmptyModelParam": "OpenAI.EmptyModelParam", "azure.ai.projects.models.EntraAuthorizationScheme": "Azure.AI.Projects.EntraAuthorizationScheme", "azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", - "azure.ai.projects.models.IsolationKeySource": "Azure.AI.Projects.IsolationKeySource", - "azure.ai.projects.models.EntraIsolationKeySource": "Azure.AI.Projects.EntraIsolationKeySource", "azure.ai.projects.models.EvalResult": "Azure.AI.Projects.EvalResult", "azure.ai.projects.models.EvalRunResultCompareItem": "Azure.AI.Projects.EvalRunResultCompareItem", "azure.ai.projects.models.EvalRunResultComparison": "Azure.AI.Projects.EvalRunResultComparison", @@ -155,11 +161,13 @@ "azure.ai.projects.models.ExternalAgentDefinition": "Azure.AI.Projects.ExternalAgentDefinition", "azure.ai.projects.models.FabricDataAgentToolParameters": "Azure.AI.Projects.FabricDataAgentToolParameters", "azure.ai.projects.models.FabricIQPreviewTool": "Azure.AI.Projects.FabricIQPreviewTool", + "azure.ai.projects.models.FabricIQPreviewToolboxTool": "Azure.AI.Projects.FabricIQPreviewToolboxTool", "azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping", "azure.ai.projects.models.FileDataGenerationJobOutput": "Azure.AI.Projects.FileDataGenerationJobOutput", "azure.ai.projects.models.FileDataGenerationJobSource": "Azure.AI.Projects.FileDataGenerationJobSource", "azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion", "azure.ai.projects.models.FileSearchTool": "OpenAI.FileSearchTool", + "azure.ai.projects.models.FileSearchToolboxTool": "Azure.AI.Projects.FileSearchToolboxTool", "azure.ai.projects.models.VersionSelectionRule": "Azure.AI.Projects.VersionSelectionRule", "azure.ai.projects.models.FixedRatioVersionSelectionRule": "Azure.AI.Projects.FixedRatioVersionSelectionRule", "azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion", @@ -170,7 +178,6 @@ "azure.ai.projects.models.FunctionTool": "OpenAI.FunctionTool", "azure.ai.projects.models.FunctionToolParam": "OpenAI.FunctionToolParam", "azure.ai.projects.models.GitHubIssueRoutineTrigger": "Azure.AI.Projects.GitHubIssueRoutineTrigger", - "azure.ai.projects.models.HeaderIsolationKeySource": "Azure.AI.Projects.HeaderIsolationKeySource", "azure.ai.projects.models.TelemetryEndpointAuth": "Azure.AI.Projects.TelemetryEndpointAuth", "azure.ai.projects.models.HeaderTelemetryEndpointAuth": "Azure.AI.Projects.HeaderTelemetryEndpointAuth", "azure.ai.projects.models.HostedAgentDefinition": "Azure.AI.Projects.HostedAgentDefinition", @@ -187,6 +194,8 @@ "azure.ai.projects.models.InsightScheduleTask": "Azure.AI.Projects.InsightScheduleTask", "azure.ai.projects.models.InsightsMetadata": "Azure.AI.Projects.InsightsMetadata", "azure.ai.projects.models.InsightSummary": "Azure.AI.Projects.InsightSummary", + "azure.ai.projects.models.InvocationsProtocolConfiguration": "Azure.AI.Projects.InvocationsProtocolConfiguration", + "azure.ai.projects.models.InvocationsWsProtocolConfiguration": "Azure.AI.Projects.InvocationsWsProtocolConfiguration", "azure.ai.projects.models.RoutineDispatchPayload": "Azure.AI.Projects.RoutineDispatchPayload", "azure.ai.projects.models.InvokeAgentInvocationsApiDispatchPayload": "Azure.AI.Projects.InvokeAgentInvocationsApiDispatchPayload", "azure.ai.projects.models.RoutineAction": "Azure.AI.Projects.RoutineAction", @@ -198,7 +207,9 @@ "azure.ai.projects.models.LoraConfig": "Azure.AI.Projects.LoraConfig", "azure.ai.projects.models.ManagedAgentIdentityBlueprintReference": "Azure.AI.Projects.ManagedAgentIdentityBlueprintReference", "azure.ai.projects.models.ManagedAzureAISearchIndex": "Azure.AI.Projects.ManagedAzureAISearchIndex", + "azure.ai.projects.models.McpProtocolConfiguration": "Azure.AI.Projects.McpProtocolConfiguration", "azure.ai.projects.models.MCPTool": "OpenAI.MCPTool", + "azure.ai.projects.models.MCPToolboxTool": "Azure.AI.Projects.MCPToolboxTool", "azure.ai.projects.models.MCPToolFilter": "OpenAI.MCPToolFilter", "azure.ai.projects.models.MCPToolRequireApproval": "OpenAI.MCPToolRequireApproval", "azure.ai.projects.models.MemoryOperation": "Azure.AI.Projects.MemoryOperation", @@ -236,6 +247,7 @@ "azure.ai.projects.models.OpenApiProjectConnectionAuthDetails": "Azure.AI.Projects.OpenApiProjectConnectionAuthDetails", "azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme": "Azure.AI.Projects.OpenApiProjectConnectionSecurityScheme", "azure.ai.projects.models.OpenApiTool": "Azure.AI.Projects.OpenApiTool", + "azure.ai.projects.models.OpenApiToolboxTool": "Azure.AI.Projects.OpenApiToolboxTool", "azure.ai.projects.models.OptimizationAgentIdentifier": "Azure.AI.Projects.OptimizationAgentIdentifier", "azure.ai.projects.models.OptimizationCandidate": "Azure.AI.Projects.OptimizationCandidate", "azure.ai.projects.models.OptimizationDatasetCriterion": "Azure.AI.Projects.OptimizationDatasetCriterion", @@ -261,6 +273,7 @@ "azure.ai.projects.models.PromptBasedEvaluatorDefinition": "Azure.AI.Projects.PromptBasedEvaluatorDefinition", "azure.ai.projects.models.PromptDataGenerationJobSource": "Azure.AI.Projects.PromptDataGenerationJobSource", "azure.ai.projects.models.PromptEvaluatorGenerationJobSource": "Azure.AI.Projects.PromptEvaluatorGenerationJobSource", + "azure.ai.projects.models.ProtocolConfiguration": "Azure.AI.Projects.ProtocolConfiguration", "azure.ai.projects.models.ProtocolVersionRecord": "Azure.AI.Projects.ProtocolVersionRecord", "azure.ai.projects.models.RaiConfig": "Azure.AI.Projects.RaiConfig", "azure.ai.projects.models.RankingOptions": "OpenAI.RankingOptions", @@ -268,6 +281,8 @@ "azure.ai.projects.models.RecurrenceTrigger": "Azure.AI.Projects.RecurrenceTrigger", "azure.ai.projects.models.RedTeam": "Azure.AI.Projects.RedTeam", "azure.ai.projects.models.ReminderPreviewTool": "Azure.AI.Projects.ReminderPreviewTool", + "azure.ai.projects.models.ReminderPreviewToolboxTool": "Azure.AI.Projects.ReminderPreviewToolboxTool", + "azure.ai.projects.models.ResponsesProtocolConfiguration": "Azure.AI.Projects.ResponsesProtocolConfiguration", "azure.ai.projects.models.ResponseUsageInputTokensDetails": "OpenAI.ResponseUsageInputTokensDetails", "azure.ai.projects.models.ResponseUsageOutputTokensDetails": "OpenAI.ResponseUsageOutputTokensDetails", "azure.ai.projects.models.Routine": "Azure.AI.Projects.Routine", @@ -302,7 +317,7 @@ "azure.ai.projects.models.TimerRoutineTrigger": "Azure.AI.Projects.TimerRoutineTrigger", "azure.ai.projects.models.ToolboxObject": "Azure.AI.Projects.ToolboxObject", "azure.ai.projects.models.ToolboxPolicies": "Azure.AI.Projects.ToolboxPolicies", - "azure.ai.projects.models.ToolboxSearchPreviewTool": "Azure.AI.Projects.ToolboxSearchPreviewTool", + "azure.ai.projects.models.ToolboxSearchPreviewToolboxTool": "Azure.AI.Projects.ToolboxSearchPreviewToolboxTool", "azure.ai.projects.models.ToolboxSkill": "Azure.AI.Projects.ToolboxSkill", "azure.ai.projects.models.ToolboxSkillReference": "Azure.AI.Projects.ToolboxSkillReference", "azure.ai.projects.models.ToolboxVersionObject": "Azure.AI.Projects.ToolboxVersionObject", @@ -336,10 +351,12 @@ "azure.ai.projects.models.WebSearchConfiguration": "Azure.AI.Projects.WebSearchConfiguration", "azure.ai.projects.models.WebSearchPreviewTool": "OpenAI.WebSearchPreviewTool", "azure.ai.projects.models.WebSearchTool": "OpenAI.WebSearchTool", + "azure.ai.projects.models.WebSearchToolboxTool": "Azure.AI.Projects.WebSearchToolboxTool", "azure.ai.projects.models.WebSearchToolFilters": "OpenAI.WebSearchToolFilters", "azure.ai.projects.models.WeeklyRecurrenceSchedule": "Azure.AI.Projects.WeeklyRecurrenceSchedule", "azure.ai.projects.models.WorkflowAgentDefinition": "Azure.AI.Projects.WorkflowAgentDefinition", "azure.ai.projects.models.WorkIQPreviewTool": "Azure.AI.Projects.WorkIQPreviewTool", + "azure.ai.projects.models.WorkIQPreviewToolboxTool": "Azure.AI.Projects.WorkIQPreviewToolboxTool", "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", "azure.ai.projects.models.ToolType": "OpenAI.ToolType", "azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType", @@ -402,7 +419,7 @@ "azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType", "azure.ai.projects.models.AgentState": "Azure.AI.Projects.AgentState", "azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind", - "azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol", + "azure.ai.projects.models.AgentEndpointProtocol": "Azure.AI.Projects.AgentEndpointProtocol", "azure.ai.projects.models.CodeDependencyResolution": "Azure.AI.Projects.CodeDependencyResolution", "azure.ai.projects.models.TelemetryEndpointKind": "Azure.AI.Projects.TelemetryEndpointKind", "azure.ai.projects.models.TelemetryDataKind": "Azure.AI.Projects.TelemetryDataKind", @@ -413,9 +430,7 @@ "azure.ai.projects.models.AgentVersionStatus": "Azure.AI.Projects.AgentVersionStatus", "azure.ai.projects.models.AgentBlueprintReferenceType": "Azure.AI.Projects.AgentBlueprintReferenceType", "azure.ai.projects.models.VersionSelectorType": "Azure.AI.Projects.VersionSelectorType", - "azure.ai.projects.models.AgentEndpointProtocol": "Azure.AI.Projects.AgentEndpointProtocol", "azure.ai.projects.models.AgentEndpointAuthorizationSchemeType": "Azure.AI.Projects.AgentEndpointAuthorizationSchemeType", - "azure.ai.projects.models.IsolationKeySourceKind": "Azure.AI.Projects.IsolationKeySourceKind", "azure.ai.projects.models.VersionIndicatorType": "Azure.AI.Projects.VersionIndicatorType", "azure.ai.projects.models.AgentSessionStatus": "Azure.AI.Projects.AgentSessionStatus", "azure.ai.projects.models.SessionLogEventType": "Azure.AI.Projects.SessionLogEventType", @@ -426,6 +441,7 @@ "azure.ai.projects.models.DatasetType": "Azure.AI.Projects.DatasetType", "azure.ai.projects.models.DeploymentType": "Azure.AI.Projects.DeploymentType", "azure.ai.projects.models.IndexType": "Azure.AI.Projects.IndexType", + "azure.ai.projects.models.ToolboxToolType": "Azure.AI.Projects.ToolboxToolType", "azure.ai.projects.models.MemoryStoreUpdateStatus": "Azure.AI.Projects.MemoryStoreUpdateStatus", "azure.ai.projects.operations.AgentsOperations.get": "Azure.AI.Projects.Agents.getAgent", "azure.ai.projects.aio.operations.AgentsOperations.get": "Azure.AI.Projects.Agents.getAgent", @@ -526,5 +542,5 @@ "azure.ai.projects.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion", "azure.ai.projects.aio.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion" }, - "CrossLanguageVersion": "623ba64ba559" + "CrossLanguageVersion": "ea005d146e87" } \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index b0b0a81edc8c..2b95a5b5d759 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -1587,7 +1587,7 @@ async def enable(self, agent_name: str, **kwargs: Any) -> None: response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -1644,7 +1644,7 @@ async def disable(self, agent_name: str, **kwargs: Any) -> None: response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -1661,7 +1661,6 @@ async def create_session( agent_name: str, *, version_indicator: _models.VersionIndicator, - user_isolation_key: Optional[str] = None, content_type: str = "application/json", agent_session_id: Optional[str] = None, **kwargs: Any @@ -1676,9 +1675,6 @@ async def create_session( :type agent_name: str :keyword version_indicator: Determines which agent version backs the session. Required. :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1692,13 +1688,7 @@ async def create_session( @overload async def create_session( - self, - agent_name: str, - body: JSON, - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any + self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.AgentSessionResource: """Create a session. @@ -1710,9 +1700,6 @@ async def create_session( :type agent_name: str :param body: Required. :type body: JSON - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1723,13 +1710,7 @@ async def create_session( @overload async def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.AgentSessionResource: """Create a session. @@ -1741,9 +1722,6 @@ async def create_session( :type agent_name: str :param body: Required. :type body: IO[bytes] - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1759,7 +1737,6 @@ async def create_session( body: Union[JSON, IO[bytes]] = _Unset, *, version_indicator: _models.VersionIndicator = _Unset, - user_isolation_key: Optional[str] = None, agent_session_id: Optional[str] = None, **kwargs: Any ) -> _models.AgentSessionResource: @@ -1775,9 +1752,6 @@ async def create_session( :type body: JSON or IO[bytes] :keyword version_indicator: Determines which agent version backs the session. Required. :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique within the agent endpoint. Auto-generated if omitted. Default value is None. :paramtype agent_session_id: str @@ -1813,7 +1787,6 @@ async def create_session( _request = build_agents_create_session_request( agent_name=agent_name, - user_isolation_key=user_isolation_key, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1857,9 +1830,7 @@ async def create_session( return deserialized # type: ignore @distributed_trace_async - async def get_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: """Get a session. Retrieves the details of a hosted agent session by agent name and session identifier. @@ -1868,9 +1839,6 @@ async def get_session( :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1891,7 +1859,6 @@ async def get_session( _request = build_agents_get_session_request( agent_name=agent_name, session_id=session_id, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1933,9 +1900,7 @@ async def get_session( return deserialized # type: ignore @distributed_trace_async - async def delete_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> None: + async def delete_session(self, agent_name: str, session_id: str, **kwargs: Any) -> None: """Delete a session. Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not @@ -1945,9 +1910,6 @@ async def delete_session( :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1968,7 +1930,6 @@ async def delete_session( _request = build_agents_delete_session_request( agent_name=agent_name, session_id=session_id, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2059,7 +2020,6 @@ def list_sessions( self, agent_name: str, *, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, @@ -2071,9 +2031,6 @@ def list_sessions( :param agent_name: The name of the agent. Required. :type agent_name: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -2109,7 +2066,6 @@ def prepare_request(_continuation_token=None): _request = build_agents_list_sessions_request( agent_name=agent_name, - user_isolation_key=user_isolation_key, limit=limit, order=order, after=_continuation_token, @@ -2260,14 +2216,7 @@ async def get_session_log_stream( @distributed_trace_async async def _upload_session_file( - self, - agent_name: str, - agent_session_id: str, - content: bytes, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any + self, agent_name: str, agent_session_id: str, content: bytes, *, remote_path: str, **kwargs: Any ) -> _models.SessionFileWriteResult: """Upload a session file. @@ -2280,12 +2229,9 @@ async def _upload_session_file( :type agent_session_id: str :param content: Required. :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :keyword remote_path: The destination file path within the sandbox, relative to the session + home directory. Required. + :paramtype remote_path: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2309,8 +2255,7 @@ async def _upload_session_file( _request = build_agents_upload_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2355,13 +2300,7 @@ async def _upload_session_file( @distributed_trace_async async def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any + self, agent_name: str, agent_session_id: str, *, remote_path: str, **kwargs: Any ) -> AsyncIterator[bytes]: """Download a session file. @@ -2372,12 +2311,9 @@ async def download_session_file( :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home + :keyword remote_path: The file path to download from the sandbox, relative to the session home directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :paramtype remote_path: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -2398,8 +2334,7 @@ async def download_session_file( _request = build_agents_download_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2443,8 +2378,7 @@ def list_session_files( agent_name: str, agent_session_id: str, *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, + remote_path: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, @@ -2460,12 +2394,9 @@ def list_session_files( :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Defaults to - the home directory if not provided. Default value is None. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :keyword remote_path: The directory path to list, relative to the session home directory. + Defaults to the home directory if not provided. Default value is None. + :paramtype remote_path: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -2503,8 +2434,7 @@ def prepare_request(_continuation_token=None): _request = build_agents_list_session_files_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, limit=limit, order=order, after=_continuation_token, @@ -2556,9 +2486,8 @@ async def delete_session_file( agent_name: str, agent_session_id: str, *, - path: str, + remote_path: str, recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, **kwargs: Any ) -> None: """Delete a session file. @@ -2570,15 +2499,12 @@ async def delete_session_file( :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str + :keyword remote_path: The file or directory path to delete, relative to the session home + directory. Required. + :paramtype remote_path: str :keyword recursive: Whether to recursively delete directory contents. The service defaults to ``false`` if a value is not specified by the caller. Default value is None. :paramtype recursive: bool - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2599,9 +2525,8 @@ async def delete_session_file( _request = build_agents_delete_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, + remote_path=remote_path, recursive=recursive, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4689,7 +4614,7 @@ async def create_version( self, name: str, *, - tools: List[_models.Tool], + tools: List[_models.ToolboxTool], content_type: str = "application/json", description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, @@ -4705,7 +4630,7 @@ async def create_version( Required. :type name: str :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] + :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4773,7 +4698,7 @@ async def create_version( name: str, body: Union[JSON, IO[bytes]] = _Unset, *, - tools: List[_models.Tool] = _Unset, + tools: List[_models.ToolboxTool] = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, skills: Optional[List[_models.ToolboxSkill]] = None, @@ -4790,7 +4715,7 @@ async def create_version( :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] + :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] :keyword description: A human-readable description of the toolbox. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 4e86cf201595..1e0978420563 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -321,5 +321,5 @@ async def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return await super()._upload_session_file( - agent_name, session_id, content, path=remote_path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, remote_path=remote_path, user_isolation_key=user_isolation_key, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py index 92a37f0aada6..731c169a21d1 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py @@ -15,7 +15,10 @@ from ._models import ( # type: ignore A2APreviewTool, + A2APreviewToolboxTool, + A2aProtocolConfiguration, AISearchIndexResource, + ActivityProtocolConfiguration, AgentBlueprintReference, AgentCard, AgentCardSkill, @@ -45,6 +48,7 @@ AzureAISearchIndex, AzureAISearchTool, AzureAISearchToolResource, + AzureAISearchToolboxTool, AzureFunctionBinding, AzureFunctionDefinition, AzureFunctionDefinitionFunction, @@ -62,7 +66,9 @@ BlobReferenceSasCredential, BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, + BotServiceTenantAuthorizationScheme, BrowserAutomationPreviewTool, + BrowserAutomationPreviewToolboxTool, BrowserAutomationToolConnectionParameters, BrowserAutomationToolParameters, CaptureStructuredOutputsTool, @@ -73,6 +79,7 @@ CodeBasedEvaluatorDefinition, CodeConfiguration, CodeInterpreterTool, + CodeInterpreterToolboxTool, ComparisonFilter, CompoundFilter, ComputerTool, @@ -126,7 +133,6 @@ EmptyModelParam, EntraAuthorizationScheme, EntraIDCredentials, - EntraIsolationKeySource, EvalResult, EvalRunResultCompareItem, EvalRunResultComparison, @@ -155,11 +161,13 @@ ExternalAgentDefinition, FabricDataAgentToolParameters, FabricIQPreviewTool, + FabricIQPreviewToolboxTool, FieldMapping, FileDataGenerationJobOutput, FileDataGenerationJobSource, FileDatasetVersion, FileSearchTool, + FileSearchToolboxTool, FixedRatioVersionSelectionRule, FolderDatasetVersion, FoundryModelWarning, @@ -170,7 +178,6 @@ FunctionTool, FunctionToolParam, GitHubIssueRoutineTrigger, - HeaderIsolationKeySource, HeaderTelemetryEndpointAuth, HostedAgentDefinition, HourlyRecurrenceSchedule, @@ -190,19 +197,22 @@ InsightScheduleTask, InsightSummary, InsightsMetadata, + InvocationsProtocolConfiguration, + InvocationsWsProtocolConfiguration, InvokeAgentInvocationsApiDispatchPayload, InvokeAgentInvocationsApiRoutineAction, InvokeAgentResponsesApiDispatchPayload, InvokeAgentResponsesApiRoutineAction, - IsolationKeySource, LocalShellToolParam, LocalSkillParam, LoraConfig, MCPTool, MCPToolFilter, MCPToolRequireApproval, + MCPToolboxTool, ManagedAgentIdentityBlueprintReference, ManagedAzureAISearchIndex, + McpProtocolConfiguration, MemoryItem, MemoryOperation, MemorySearchItem, @@ -239,6 +249,7 @@ OpenApiProjectConnectionAuthDetails, OpenApiProjectConnectionSecurityScheme, OpenApiTool, + OpenApiToolboxTool, OptimizationAgentIdentifier, OptimizationCandidate, OptimizationDatasetCriterion, @@ -263,6 +274,7 @@ PromptBasedEvaluatorDefinition, PromptDataGenerationJobSource, PromptEvaluatorGenerationJobSource, + ProtocolConfiguration, ProtocolVersionRecord, RaiConfig, RankingOptions, @@ -272,8 +284,10 @@ RedTeam, RedTeamTargetConfig, ReminderPreviewTool, + ReminderPreviewToolboxTool, ResponseUsageInputTokensDetails, ResponseUsageOutputTokensDetails, + ResponsesProtocolConfiguration, Routine, RoutineAction, RoutineDispatchPayload, @@ -330,9 +344,10 @@ ToolUseFineTuningDataGenerationJobOptions, ToolboxObject, ToolboxPolicies, - ToolboxSearchPreviewTool, + ToolboxSearchPreviewToolboxTool, ToolboxSkill, ToolboxSkillReference, + ToolboxTool, ToolboxVersionObject, TracesDataGenerationJobOptions, TracesDataGenerationJobSource, @@ -350,8 +365,10 @@ WebSearchPreviewTool, WebSearchTool, WebSearchToolFilters, + WebSearchToolboxTool, WeeklyRecurrenceSchedule, WorkIQPreviewTool, + WorkIQPreviewToolboxTool, WorkflowAgentDefinition, ) @@ -361,7 +378,6 @@ AgentEndpointProtocol, AgentKind, AgentObjectType, - AgentProtocol, AgentSessionStatus, AgentState, AgentVersionStatus, @@ -404,7 +420,6 @@ IndexType, InputFidelity, InsightType, - IsolationKeySourceKind, JobStatus, MemoryItemKind, MemoryOperationKind, @@ -439,6 +454,7 @@ ToolChoiceParamType, ToolSearchExecutionType, ToolType, + ToolboxToolType, TreatmentEffectType, TriggerType, VersionIndicatorType, @@ -450,7 +466,10 @@ __all__ = [ "A2APreviewTool", + "A2APreviewToolboxTool", + "A2aProtocolConfiguration", "AISearchIndexResource", + "ActivityProtocolConfiguration", "AgentBlueprintReference", "AgentCard", "AgentCardSkill", @@ -480,6 +499,7 @@ "AzureAISearchIndex", "AzureAISearchTool", "AzureAISearchToolResource", + "AzureAISearchToolboxTool", "AzureFunctionBinding", "AzureFunctionDefinition", "AzureFunctionDefinitionFunction", @@ -497,7 +517,9 @@ "BlobReferenceSasCredential", "BotServiceAuthorizationScheme", "BotServiceRbacAuthorizationScheme", + "BotServiceTenantAuthorizationScheme", "BrowserAutomationPreviewTool", + "BrowserAutomationPreviewToolboxTool", "BrowserAutomationToolConnectionParameters", "BrowserAutomationToolParameters", "CaptureStructuredOutputsTool", @@ -508,6 +530,7 @@ "CodeBasedEvaluatorDefinition", "CodeConfiguration", "CodeInterpreterTool", + "CodeInterpreterToolboxTool", "ComparisonFilter", "CompoundFilter", "ComputerTool", @@ -561,7 +584,6 @@ "EmptyModelParam", "EntraAuthorizationScheme", "EntraIDCredentials", - "EntraIsolationKeySource", "EvalResult", "EvalRunResultCompareItem", "EvalRunResultComparison", @@ -590,11 +612,13 @@ "ExternalAgentDefinition", "FabricDataAgentToolParameters", "FabricIQPreviewTool", + "FabricIQPreviewToolboxTool", "FieldMapping", "FileDataGenerationJobOutput", "FileDataGenerationJobSource", "FileDatasetVersion", "FileSearchTool", + "FileSearchToolboxTool", "FixedRatioVersionSelectionRule", "FolderDatasetVersion", "FoundryModelWarning", @@ -605,7 +629,6 @@ "FunctionTool", "FunctionToolParam", "GitHubIssueRoutineTrigger", - "HeaderIsolationKeySource", "HeaderTelemetryEndpointAuth", "HostedAgentDefinition", "HourlyRecurrenceSchedule", @@ -625,19 +648,22 @@ "InsightScheduleTask", "InsightSummary", "InsightsMetadata", + "InvocationsProtocolConfiguration", + "InvocationsWsProtocolConfiguration", "InvokeAgentInvocationsApiDispatchPayload", "InvokeAgentInvocationsApiRoutineAction", "InvokeAgentResponsesApiDispatchPayload", "InvokeAgentResponsesApiRoutineAction", - "IsolationKeySource", "LocalShellToolParam", "LocalSkillParam", "LoraConfig", "MCPTool", "MCPToolFilter", "MCPToolRequireApproval", + "MCPToolboxTool", "ManagedAgentIdentityBlueprintReference", "ManagedAzureAISearchIndex", + "McpProtocolConfiguration", "MemoryItem", "MemoryOperation", "MemorySearchItem", @@ -674,6 +700,7 @@ "OpenApiProjectConnectionAuthDetails", "OpenApiProjectConnectionSecurityScheme", "OpenApiTool", + "OpenApiToolboxTool", "OptimizationAgentIdentifier", "OptimizationCandidate", "OptimizationDatasetCriterion", @@ -698,6 +725,7 @@ "PromptBasedEvaluatorDefinition", "PromptDataGenerationJobSource", "PromptEvaluatorGenerationJobSource", + "ProtocolConfiguration", "ProtocolVersionRecord", "RaiConfig", "RankingOptions", @@ -707,8 +735,10 @@ "RedTeam", "RedTeamTargetConfig", "ReminderPreviewTool", + "ReminderPreviewToolboxTool", "ResponseUsageInputTokensDetails", "ResponseUsageOutputTokensDetails", + "ResponsesProtocolConfiguration", "Routine", "RoutineAction", "RoutineDispatchPayload", @@ -765,9 +795,10 @@ "ToolUseFineTuningDataGenerationJobOptions", "ToolboxObject", "ToolboxPolicies", - "ToolboxSearchPreviewTool", + "ToolboxSearchPreviewToolboxTool", "ToolboxSkill", "ToolboxSkillReference", + "ToolboxTool", "ToolboxVersionObject", "TracesDataGenerationJobOptions", "TracesDataGenerationJobSource", @@ -785,15 +816,16 @@ "WebSearchPreviewTool", "WebSearchTool", "WebSearchToolFilters", + "WebSearchToolboxTool", "WeeklyRecurrenceSchedule", "WorkIQPreviewTool", + "WorkIQPreviewToolboxTool", "WorkflowAgentDefinition", "AgentBlueprintReferenceType", "AgentEndpointAuthorizationSchemeType", "AgentEndpointProtocol", "AgentKind", "AgentObjectType", - "AgentProtocol", "AgentSessionStatus", "AgentState", "AgentVersionStatus", @@ -836,7 +868,6 @@ "IndexType", "InputFidelity", "InsightType", - "IsolationKeySourceKind", "JobStatus", "MemoryItemKind", "MemoryOperationKind", @@ -871,6 +902,7 @@ "ToolChoiceParamType", "ToolSearchExecutionType", "ToolType", + "ToolboxToolType", "TreatmentEffectType", "TriggerType", "VersionIndicatorType", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index 47fd25b8615c..6bea7cc58d3e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -61,6 +61,8 @@ class AgentEndpointAuthorizationSchemeType(str, Enum, metaclass=CaseInsensitiveE """BOT_SERVICE.""" BOT_SERVICE_RBAC = "BotServiceRbac" """BOT_SERVICE_RBAC.""" + BOT_SERVICE_TENANT = "BotServiceTenant" + """BOT_SERVICE_TENANT.""" class AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -108,23 +110,6 @@ class AgentObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AGENT_CONTAINER.""" -class AgentProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of AgentProtocol.""" - - ACTIVITY_PROTOCOL = "activity_protocol" - """ACTIVITY_PROTOCOL.""" - RESPONSES = "responses" - """RESPONSES.""" - A2A = "a2a" - """A2A.""" - MCP = "mcp" - """MCP.""" - INVOCATIONS = "invocations" - """INVOCATIONS.""" - INVOCATIONS_WS = "invocations_ws" - """WebSocket-based protocol for hosted voice and real-time streaming agents.""" - - class AgentSessionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of an agent session.""" @@ -683,15 +668,6 @@ class InsightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Evaluation Comparison.""" -class IsolationKeySourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of IsolationKeySourceKind.""" - - ENTRA = "Entra" - """ENTRA.""" - HEADER = "Header" - """HEADER.""" - - class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Extensible status values shared by Foundry jobs.""" @@ -1045,6 +1021,35 @@ class TextResponseFormatConfigurationType(str, Enum, metaclass=CaseInsensitiveEn """JSON_OBJECT.""" +class ToolboxToolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported tool types for tools stored in a toolbox.""" + + CODE_INTERPRETER = "code_interpreter" + """CODE_INTERPRETER.""" + FILE_SEARCH = "file_search" + """FILE_SEARCH.""" + WEB_SEARCH = "web_search" + """WEB_SEARCH.""" + MCP = "mcp" + """MCP.""" + AZURE_AI_SEARCH = "azure_ai_search" + """AZURE_AI_SEARCH.""" + OPENAPI = "openapi" + """OPENAPI.""" + A2_A_PREVIEW = "a2a_preview" + """A2_A_PREVIEW.""" + BROWSER_AUTOMATION_PREVIEW = "browser_automation_preview" + """BROWSER_AUTOMATION_PREVIEW.""" + REMINDER_PREVIEW = "reminder_preview" + """REMINDER_PREVIEW.""" + WORK_IQ_PREVIEW = "work_iq_preview" + """WORK_IQ_PREVIEW.""" + FABRIC_IQ_PREVIEW = "fabric_iq_preview" + """FABRIC_IQ_PREVIEW.""" + TOOLBOX_SEARCH_PREVIEW = "toolbox_search_preview" + """TOOLBOX_SEARCH_PREVIEW.""" + + class ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of ToolChoiceParamType.""" @@ -1132,14 +1137,14 @@ class ToolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SHAREPOINT_GROUNDING_PREVIEW.""" MEMORY_SEARCH_PREVIEW = "memory_search_preview" """MEMORY_SEARCH_PREVIEW.""" + REMINDER_PREVIEW = "reminder_preview" + """REMINDER_PREVIEW.""" WORK_IQ_PREVIEW = "work_iq_preview" """WORK_IQ_PREVIEW.""" FABRIC_IQ_PREVIEW = "fabric_iq_preview" """FABRIC_IQ_PREVIEW.""" TOOLBOX_SEARCH_PREVIEW = "toolbox_search_preview" """TOOLBOX_SEARCH_PREVIEW.""" - REMINDER_PREVIEW = "reminder_preview" - """REMINDER_PREVIEW.""" AZURE_AI_SEARCH = "azure_ai_search" """AZURE_AI_SEARCH.""" AZURE_FUNCTION = "azure_function" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index be438ce75dda..30da354bd394 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -34,7 +34,6 @@ FunctionShellToolParamEnvironmentType, IndexType, InsightType, - IsolationKeySourceKind, MemoryItemKind, MemoryStoreKind, MemoryStoreObjectType, @@ -52,6 +51,7 @@ TextResponseFormatConfigurationType, ToolChoiceParamType, ToolType, + ToolboxToolType, TriggerType, VersionIndicatorType, VersionSelectorType, @@ -71,15 +71,14 @@ class Tool(_Model): CustomToolParam, MicrosoftFabricPreviewTool, FabricIQPreviewTool, FileSearchTool, FunctionTool, ImageGenTool, LocalShellToolParam, MCPTool, MemorySearchPreviewTool, NamespaceToolParam, OpenApiTool, ReminderPreviewTool, SharepointPreviewTool, FunctionShellToolParam, - ToolSearchToolParam, ToolboxSearchPreviewTool, WebSearchTool, WebSearchPreviewTool, - WorkIQPreviewTool + ToolSearchToolParam, WebSearchTool, WebSearchPreviewTool, WorkIQPreviewTool :ivar type: Required. Known values are: "function", "file_search", "computer", "computer_use_preview", "web_search", "mcp", "code_interpreter", "image_generation", "local_shell", "shell", "custom", "namespace", "tool_search", "web_search_preview", "apply_patch", "a2a_preview", "bing_custom_search_preview", "browser_automation_preview", "fabric_dataagent_preview", "sharepoint_grounding_preview", "memory_search_preview", - "work_iq_preview", "fabric_iq_preview", "toolbox_search_preview", "reminder_preview", + "reminder_preview", "work_iq_preview", "fabric_iq_preview", "toolbox_search_preview", "azure_ai_search", "azure_function", "bing_grounding", "capture_structured_outputs", and "openapi". :vartype type: str or ~azure.ai.projects.models.ToolType @@ -92,9 +91,9 @@ class Tool(_Model): \"local_shell\", \"shell\", \"custom\", \"namespace\", \"tool_search\", \"web_search_preview\", \"apply_patch\", \"a2a_preview\", \"bing_custom_search_preview\", \"browser_automation_preview\", \"fabric_dataagent_preview\", \"sharepoint_grounding_preview\", - \"memory_search_preview\", \"work_iq_preview\", \"fabric_iq_preview\", - \"toolbox_search_preview\", \"reminder_preview\", \"azure_ai_search\", \"azure_function\", - \"bing_grounding\", \"capture_structured_outputs\", and \"openapi\".""" + \"memory_search_preview\", \"reminder_preview\", \"work_iq_preview\", \"fabric_iq_preview\", + \"toolbox_search_preview\", \"azure_ai_search\", \"azure_function\", \"bing_grounding\", + \"capture_structured_outputs\", and \"openapi\".""" @overload def __init__( @@ -119,14 +118,6 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2A_PREVIEW. :vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar base_url: Base URL of the agent. :vartype base_url: str :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not @@ -140,6 +131,65 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): type: Literal[ToolType.A2A_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the tool. Always ``\"a2a_preview``. Required. A2A_PREVIEW.""" + base_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Base URL of the agent.""" + agent_card_path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path to the agent card relative to the ``base_url``. If not provided, defaults to + ``/.well-known/agent-card.json``.""" + project_connection_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The connection ID in the project for the A2A server. The connection stores authentication and + other connection details needed to connect to the A2A server.""" + + @overload + def __init__( + self, + *, + base_url: Optional[str] = None, + agent_card_path: Optional[str] = None, + project_connection_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.A2A_PREVIEW # type: ignore + + +class ToolboxTool(_Model): + """An abstract representation of a tool stored in a toolbox. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2APreviewToolboxTool, AzureAISearchToolboxTool, BrowserAutomationPreviewToolboxTool, + CodeInterpreterToolboxTool, FabricIQPreviewToolboxTool, FileSearchToolboxTool, MCPToolboxTool, + OpenApiToolboxTool, ReminderPreviewToolboxTool, ToolboxSearchPreviewToolboxTool, + WebSearchToolboxTool, WorkIQPreviewToolboxTool + + :ivar type: The type of tool. Required. Known values are: "code_interpreter", "file_search", + "web_search", "mcp", "azure_ai_search", "openapi", "a2a_preview", "browser_automation_preview", + "reminder_preview", "work_iq_preview", "fabric_iq_preview", and "toolbox_search_preview". + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + """ + + __mapping__: dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The type of tool. Required. Known values are: \"code_interpreter\", \"file_search\", + \"web_search\", \"mcp\", \"azure_ai_search\", \"openapi\", \"a2a_preview\", + \"browser_automation_preview\", \"reminder_preview\", \"work_iq_preview\", + \"fabric_iq_preview\", and \"toolbox_search_preview\".""" name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -150,6 +200,54 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime.""" + + @overload + def __init__( + self, + *, + type: str, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class A2APreviewToolboxTool(ToolboxTool, discriminator="a2a_preview"): + """An A2A tool stored in a toolbox. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. A2_A_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.A2_A_PREVIEW + :ivar base_url: Base URL of the agent. + :vartype base_url: str + :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not + provided, defaults to ``/.well-known/agent-card.json``. + :vartype agent_card_path: str + :ivar project_connection_id: The connection ID in the project for the A2A server. The + connection stores authentication and other connection details needed to connect to the A2A + server. + :vartype project_connection_id: str + """ + + type: Literal[ToolboxToolType.A2_A_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A2_A_PREVIEW.""" base_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Base URL of the agent.""" agent_card_path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -180,7 +278,40 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.A2A_PREVIEW # type: ignore + self.type = ToolboxToolType.A2_A_PREVIEW # type: ignore + + +class A2aProtocolConfiguration(_Model): + """Configuration specific to the A2A protocol.""" + + +class ActivityProtocolConfiguration(_Model): + """Configuration specific to the activity protocol. + + :ivar enable_m365_public_endpoint: Whether to enable the M365 public endpoint for the activity + protocol. + :vartype enable_m365_public_endpoint: bool + """ + + enable_m365_public_endpoint: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether to enable the M365 public endpoint for the activity protocol.""" + + @overload + def __init__( + self, + *, + enable_m365_public_endpoint: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) class AgentBlueprintReference(_Model): @@ -646,15 +777,18 @@ class AgentEndpointAuthorizationScheme(_Model): """AgentEndpointAuthorizationScheme. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, EntraAuthorizationScheme + BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, + BotServiceTenantAuthorizationScheme, EntraAuthorizationScheme - :ivar type: Required. Known values are: "Entra", "BotService", and "BotServiceRbac". + :ivar type: Required. Known values are: "Entra", "BotService", "BotServiceRbac", and + "BotServiceTenant". :vartype type: str or ~azure.ai.projects.models.AgentEndpointAuthorizationSchemeType """ __mapping__: dict[str, _Model] = {} type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """Required. Known values are: \"Entra\", \"BotService\", and \"BotServiceRbac\".""" + """Required. Known values are: \"Entra\", \"BotService\", \"BotServiceRbac\", and + \"BotServiceTenant\".""" @overload def __init__( @@ -680,8 +814,8 @@ class AgentEndpointConfig(_Model): :ivar version_selector: The version selector of the agent endpoint determines how traffic is routed to different versions of the agent. :vartype version_selector: ~azure.ai.projects.models.VersionSelector - :ivar protocols: The protocols that the agent supports. - :vartype protocols: list[str or ~azure.ai.projects.models.AgentEndpointProtocol] + :ivar protocol_configuration: Per-protocol configuration for the agent endpoint. + :vartype protocol_configuration: ~azure.ai.projects.models.ProtocolConfiguration :ivar authorization_schemes: The authorization schemes supported by the agent endpoint. :vartype authorization_schemes: list[~azure.ai.projects.models.AgentEndpointAuthorizationScheme] @@ -692,10 +826,10 @@ class AgentEndpointConfig(_Model): ) """The version selector of the agent endpoint determines how traffic is routed to different versions of the agent.""" - protocols: Optional[list[Union[str, "_models.AgentEndpointProtocol"]]] = rest_field( + protocol_configuration: Optional["_models.ProtocolConfiguration"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The protocols that the agent supports.""" + """Per-protocol configuration for the agent endpoint.""" authorization_schemes: Optional[list["_models.AgentEndpointAuthorizationScheme"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -706,7 +840,7 @@ def __init__( self, *, version_selector: Optional["_models.VersionSelector"] = None, - protocols: Optional[list[Union[str, "_models.AgentEndpointProtocol"]]] = None, + protocol_configuration: Optional["_models.ProtocolConfiguration"] = None, authorization_schemes: Optional[list["_models.AgentEndpointAuthorizationScheme"]] = None, ) -> None: ... @@ -1743,6 +1877,39 @@ class AzureAISearchTool(Tool, discriminator="azure_ai_search"): :ivar type: The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH. :vartype type: str or ~azure.ai.projects.models.AZURE_AI_SEARCH + :ivar azure_ai_search: The azure ai search index resource. Required. + :vartype azure_ai_search: ~azure.ai.projects.models.AzureAISearchToolResource + """ + + type: Literal[ToolType.AZURE_AI_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH.""" + azure_ai_search: "_models.AzureAISearchToolResource" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The azure ai search index resource. Required.""" + + @overload + def __init__( + self, + *, + azure_ai_search: "_models.AzureAISearchToolResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.AZURE_AI_SEARCH # type: ignore + + +class AzureAISearchToolboxTool(ToolboxTool, discriminator="azure_ai_search"): + """An Azure AI Search tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -1751,22 +1918,14 @@ class AzureAISearchTool(Tool, discriminator="azure_ai_search"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. AZURE_AI_SEARCH. + :vartype type: str or ~azure.ai.projects.models.AZURE_AI_SEARCH :ivar azure_ai_search: The azure ai search index resource. Required. :vartype azure_ai_search: ~azure.ai.projects.models.AzureAISearchToolResource """ - type: Literal[ToolType.AZURE_AI_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" + type: Literal[ToolboxToolType.AZURE_AI_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_AI_SEARCH.""" azure_ai_search: "_models.AzureAISearchToolResource" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -1791,7 +1950,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.AZURE_AI_SEARCH # type: ignore + self.type = ToolboxToolType.AZURE_AI_SEARCH # type: ignore class AzureAISearchToolResource(_Model): @@ -1993,10 +2152,6 @@ class AzureFunctionTool(Tool, discriminator="azure_function"): :vartype type: str or ~azure.ai.projects.models.AZURE_FUNCTION :ivar azure_function: The Azure Function Tool definition. Required. :vartype azure_function: ~azure.ai.projects.models.AzureFunctionDefinition - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.AZURE_FUNCTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -2005,19 +2160,12 @@ class AzureFunctionTool(Tool, discriminator="azure_function"): visibility=["read", "create", "update", "delete", "query"] ) """The Azure Function Tool definition. Required.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( self, *, azure_function: "_models.AzureFunctionDefinition", - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2164,14 +2312,6 @@ class BingCustomSearchPreviewTool(Tool, discriminator="bing_custom_search_previe :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. BING_CUSTOM_SEARCH_PREVIEW. :vartype type: str or ~azure.ai.projects.models.BING_CUSTOM_SEARCH_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. :vartype bing_custom_search_preview: ~azure.ai.projects.models.BingCustomSearchToolParameters """ @@ -2179,16 +2319,6 @@ class BingCustomSearchPreviewTool(Tool, discriminator="bing_custom_search_previe type: Literal[ToolType.BING_CUSTOM_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The object type, which is always 'bing_custom_search_preview'. Required. BING_CUSTOM_SEARCH_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" bing_custom_search_preview: "_models.BingCustomSearchToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2199,9 +2329,6 @@ def __init__( self, *, bing_custom_search_preview: "_models.BingCustomSearchToolParameters", - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2337,30 +2464,12 @@ class BingGroundingTool(Tool, discriminator="bing_grounding"): :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. :vartype type: str or ~azure.ai.projects.models.BING_GROUNDING - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar bing_grounding: The bing grounding search tool parameters. Required. :vartype bing_grounding: ~azure.ai.projects.models.BingGroundingSearchToolParameters """ type: Literal[ToolType.BING_GROUNDING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The object type, which is always 'bing_grounding'. Required. BING_GROUNDING.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" bing_grounding: "_models.BingGroundingSearchToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2371,9 +2480,6 @@ def __init__( self, *, bing_grounding: "_models.BingGroundingSearchToolParameters", - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -2505,12 +2611,73 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = AgentEndpointAuthorizationSchemeType.BOT_SERVICE_RBAC # type: ignore +class BotServiceTenantAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator="BotServiceTenant"): + """BotServiceTenantAuthorizationScheme. + + :ivar type: Required. BOT_SERVICE_TENANT. + :vartype type: str or ~azure.ai.projects.models.BOT_SERVICE_TENANT + """ + + type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE_TENANT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BOT_SERVICE_TENANT.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = AgentEndpointAuthorizationSchemeType.BOT_SERVICE_TENANT # type: ignore + + class BrowserAutomationPreviewTool(Tool, discriminator="browser_automation_preview"): """The input definition information for a Browser Automation Tool, as used to configure an Agent. :ivar type: The object type, which is always 'browser_automation_preview'. Required. BROWSER_AUTOMATION_PREVIEW. :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW + :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. + :vartype browser_automation_preview: ~azure.ai.projects.models.BrowserAutomationToolParameters + """ + + type: Literal[ToolType.BROWSER_AUTOMATION_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW.""" + browser_automation_preview: "_models.BrowserAutomationToolParameters" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Browser Automation Tool parameters. Required.""" + + @overload + def __init__( + self, + *, + browser_automation_preview: "_models.BrowserAutomationToolParameters", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.BROWSER_AUTOMATION_PREVIEW # type: ignore + + +class BrowserAutomationPreviewToolboxTool(ToolboxTool, discriminator="browser_automation_preview"): + """A browser automation tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -2519,23 +2686,14 @@ class BrowserAutomationPreviewTool(Tool, discriminator="browser_automation_previ default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. :vartype browser_automation_preview: ~azure.ai.projects.models.BrowserAutomationToolParameters """ - type: Literal[ToolType.BROWSER_AUTOMATION_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'browser_automation_preview'. Required. - BROWSER_AUTOMATION_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" + type: Literal[ToolboxToolType.BROWSER_AUTOMATION_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BROWSER_AUTOMATION_PREVIEW.""" browser_automation_preview: "_models.BrowserAutomationToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2560,7 +2718,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.BROWSER_AUTOMATION_PREVIEW # type: ignore + self.type = ToolboxToolType.BROWSER_AUTOMATION_PREVIEW # type: ignore class BrowserAutomationToolConnectionParameters(_Model): # pylint: disable=name-too-long @@ -2629,14 +2787,6 @@ class CaptureStructuredOutputsTool(Tool, discriminator="capture_structured_outpu :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. CAPTURE_STRUCTURED_OUTPUTS. :vartype type: str or ~azure.ai.projects.models.CAPTURE_STRUCTURED_OUTPUTS - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar outputs: The structured outputs to capture from the model. Required. :vartype outputs: ~azure.ai.projects.models.StructuredOutputDefinition """ @@ -2644,16 +2794,6 @@ class CaptureStructuredOutputsTool(Tool, discriminator="capture_structured_outpu type: Literal[ToolType.CAPTURE_STRUCTURED_OUTPUTS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the tool. Always ``capture_structured_outputs``. Required. CAPTURE_STRUCTURED_OUTPUTS.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" outputs: "_models.StructuredOutputDefinition" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -2664,9 +2804,6 @@ def __init__( self, *, outputs: "_models.StructuredOutputDefinition", - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -3117,6 +3254,45 @@ class CodeInterpreterTool(Tool, discriminator="code_interpreter"): :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER. :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER + :ivar container: The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an optional + ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a + AutoCodeInterpreterToolParam type. + :vartype container: str or ~azure.ai.projects.models.AutoCodeInterpreterToolParam + """ + + type: Literal[ToolType.CODE_INTERPRETER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.""" + container: Optional[Union[str, "_models.AutoCodeInterpreterToolParam"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The code interpreter container. Can be a container ID or an object that specifies uploaded file + IDs to make available to your code, along with an optional ``memory_limit`` setting. If not + provided, the service assumes auto. Is either a str type or a AutoCodeInterpreterToolParam + type.""" + + @overload + def __init__( + self, + *, + container: Optional[Union[str, "_models.AutoCodeInterpreterToolParam"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.CODE_INTERPRETER # type: ignore + + +class CodeInterpreterToolboxTool(ToolboxTool, discriminator="code_interpreter"): + """A code interpreter tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -3125,6 +3301,8 @@ class CodeInterpreterTool(Tool, discriminator="code_interpreter"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. CODE_INTERPRETER. + :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER :ivar container: The code interpreter container. Can be a container ID or an object that specifies uploaded file IDs to make available to your code, along with an optional ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a @@ -3132,18 +3310,8 @@ class CodeInterpreterTool(Tool, discriminator="code_interpreter"): :vartype container: str or ~azure.ai.projects.models.AutoCodeInterpreterToolParam """ - type: Literal[ToolType.CODE_INTERPRETER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" + type: Literal[ToolboxToolType.CODE_INTERPRETER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. CODE_INTERPRETER.""" container: Optional[Union[str, "_models.AutoCodeInterpreterToolParam"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -3171,7 +3339,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.CODE_INTERPRETER # type: ignore + self.type = ToolboxToolType.CODE_INTERPRETER # type: ignore class ComparisonFilter(_Model): @@ -5404,24 +5572,14 @@ class EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator=" :ivar type: Required. ENTRA. :vartype type: str or ~azure.ai.projects.models.ENTRA - :ivar isolation_key_source: The source from which the per-user isolation key is derived for - requests authorized via this scheme. Defaults to Entra-based isolation when omitted. - :vartype isolation_key_source: ~azure.ai.projects.models.IsolationKeySource """ type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Required. ENTRA.""" - isolation_key_source: Optional["_models.IsolationKeySource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The source from which the per-user isolation key is derived for requests authorized via this - scheme. Defaults to Entra-based isolation when omitted.""" @overload def __init__( self, - *, - isolation_key_source: Optional["_models.IsolationKeySource"] = None, ) -> None: ... @overload @@ -5463,65 +5621,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = CredentialType.ENTRA_ID # type: ignore -class IsolationKeySource(_Model): - """IsolationKeySource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - EntraIsolationKeySource, HeaderIsolationKeySource - - :ivar kind: Required. Known values are: "Entra" and "Header". - :vartype kind: str or ~azure.ai.projects.models.IsolationKeySourceKind - """ - - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """Required. Known values are: \"Entra\" and \"Header\".""" - - @overload - def __init__( - self, - *, - kind: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class EntraIsolationKeySource(IsolationKeySource, discriminator="Entra"): - """EntraIsolationKeySource. - - :ivar kind: Required. ENTRA. - :vartype kind: str or ~azure.ai.projects.models.ENTRA - """ - - kind: Literal[IsolationKeySourceKind.ENTRA] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. ENTRA.""" - - @overload - def __init__( - self, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = IsolationKeySourceKind.ENTRA # type: ignore - - class EvalResult(_Model): """Result of the evaluation. @@ -6745,6 +6844,48 @@ class FabricIQPreviewTool(Tool, discriminator="fabric_iq_preview"): :ivar require_approval: (Optional) Whether the agent requires approval before executing actions. Default is always. Is either a MCPToolRequireApproval type or a str type. :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str + """ + + type: Literal[ToolType.FABRIC_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW.""" + project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the FabricIQ project connection. Required.""" + server_label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional) The label of the FabricIQ MCP server to connect to.""" + server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project + connection will be used.""" + require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """(Optional) Whether the agent requires approval before executing actions. Default is always. Is + either a MCPToolRequireApproval type or a str type.""" + + @overload + def __init__( + self, + *, + project_connection_id: str, + server_label: Optional[str] = None, + server_url: Optional[str] = None, + require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.FABRIC_IQ_PREVIEW # type: ignore + + +class FabricIQPreviewToolboxTool(ToolboxTool, discriminator="fabric_iq_preview"): + """A FabricIQ tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -6753,10 +6894,22 @@ class FabricIQPreviewTool(Tool, discriminator="fabric_iq_preview"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. FABRIC_IQ_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.FABRIC_IQ_PREVIEW + :ivar project_connection_id: The ID of the FabricIQ project connection. Required. + :vartype project_connection_id: str + :ivar server_label: (Optional) The label of the FabricIQ MCP server to connect to. + :vartype server_label: str + :ivar server_url: (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from + the project connection will be used. + :vartype server_url: str + :ivar require_approval: (Optional) Whether the agent requires approval before executing + actions. Default is always. Is either a MCPToolRequireApproval type or a str type. + :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str """ - type: Literal[ToolType.FABRIC_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW.""" + type: Literal[ToolboxToolType.FABRIC_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. FABRIC_IQ_PREVIEW.""" project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The ID of the FabricIQ project connection. Required.""" server_label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -6769,28 +6922,18 @@ class FabricIQPreviewTool(Tool, discriminator="fabric_iq_preview"): ) """(Optional) Whether the agent requires approval before executing actions. Default is always. Is either a MCPToolRequireApproval type or a str type.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( self, *, project_connection_id: str, - server_label: Optional[str] = None, - server_url: Optional[str] = None, - require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = None, name: Optional[str] = None, description: Optional[str] = None, tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + server_label: Optional[str] = None, + server_url: Optional[str] = None, + require_approval: Optional[Union["_models.MCPToolRequireApproval", str]] = None, ) -> None: ... @overload @@ -6802,7 +6945,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FABRIC_IQ_PREVIEW # type: ignore + self.type = ToolboxToolType.FABRIC_IQ_PREVIEW # type: ignore class FieldMapping(_Model): @@ -6999,14 +7142,6 @@ class FileSearchTool(Tool, discriminator="file_search"): :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. :vartype filters: ~azure.ai.projects.models.ComparisonFilter or ~azure.ai.projects.models.CompoundFilter - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.FILE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7021,16 +7156,6 @@ class FileSearchTool(Tool, discriminator="file_search"): """Ranking options for search.""" filters: Optional["_types.Filters"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Is either a ComparisonFilter type or a CompoundFilter type.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( @@ -7040,9 +7165,69 @@ def __init__( max_num_results: Optional[int] = None, ranking_options: Optional["_models.RankingOptions"] = None, filters: Optional["_types.Filters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.FILE_SEARCH # type: ignore + + +class FileSearchToolboxTool(ToolboxTool, discriminator="file_search"): + """A file search tool stored in a toolbox. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. FILE_SEARCH. + :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH + :ivar max_num_results: The maximum number of results to return. This number should be between 1 + and 50 inclusive. + :vartype max_num_results: int + :ivar ranking_options: Ranking options for search. + :vartype ranking_options: ~azure.ai.projects.models.RankingOptions + :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. + :vartype filters: ~azure.ai.projects.models.ComparisonFilter or + ~azure.ai.projects.models.CompoundFilter + :ivar vector_store_ids: The IDs of the vector stores to search. + :vartype vector_store_ids: list[str] + """ + + type: Literal[ToolboxToolType.FILE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. FILE_SEARCH.""" + max_num_results: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" + ranking_options: Optional["_models.RankingOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Ranking options for search.""" + filters: Optional["_types.Filters"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Is either a ComparisonFilter type or a CompoundFilter type.""" + vector_store_ids: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IDs of the vector stores to search.""" + + @overload + def __init__( + self, + *, name: Optional[str] = None, description: Optional[str] = None, tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + max_num_results: Optional[int] = None, + ranking_options: Optional["_models.RankingOptions"] = None, + filters: Optional["_types.Filters"] = None, + vector_store_ids: Optional[list[str]] = None, ) -> None: ... @overload @@ -7054,7 +7239,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.FILE_SEARCH # type: ignore + self.type = ToolboxToolType.FILE_SEARCH # type: ignore class VersionSelectionRule(_Model): @@ -7226,14 +7411,6 @@ class FunctionShellToolParam(Tool, discriminator="shell"): :vartype type: str or ~azure.ai.projects.models.SHELL :ivar environment: :vartype environment: ~azure.ai.projects.models.FunctionShellToolParamEnvironment - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7241,25 +7418,12 @@ class FunctionShellToolParam(Tool, discriminator="shell"): environment: Optional["_models.FunctionShellToolParamEnvironment"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( self, *, environment: Optional["_models.FunctionShellToolParamEnvironment"] = None, - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -7507,33 +7671,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = RoutineTriggerType.GITHUB_ISSUE # type: ignore -class HeaderIsolationKeySource(IsolationKeySource, discriminator="Header"): - """HeaderIsolationKeySource. - - :ivar kind: Required. HEADER. - :vartype kind: str or ~azure.ai.projects.models.HEADER - """ - - kind: Literal[IsolationKeySourceKind.HEADER] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. HEADER.""" - - @overload - def __init__( - self, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = IsolationKeySourceKind.HEADER # type: ignore - - class TelemetryEndpointAuth(_Model): """Authentication configuration for a telemetry endpoint. @@ -7845,14 +7982,6 @@ class ImageGenTool(Tool, discriminator="image_generation"): :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: "generate", "edit", and "auto". :vartype action: str or ~azure.ai.projects.models.ImageGenAction - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.IMAGE_GENERATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7915,16 +8044,6 @@ class ImageGenTool(Tool, discriminator="image_generation"): ) """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: \"generate\", \"edit\", and \"auto\".""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( @@ -7943,11 +8062,8 @@ def __init__( background: Optional[Literal["transparent", "opaque", "auto"]] = None, input_fidelity: Optional[Union[str, "_models.InputFidelity"]] = None, input_image_mask: Optional["_models.ImageGenToolInputImageMask"] = None, - partial_images: Optional[int] = None, - action: Optional[Union[str, "_models.ImageGenAction"]] = None, - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + partial_images: Optional[int] = None, + action: Optional[Union[str, "_models.ImageGenAction"]] = None, ) -> None: ... @overload @@ -8357,6 +8473,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class InvocationsProtocolConfiguration(_Model): + """Configuration specific to the invocations protocol.""" + + +class InvocationsWsProtocolConfiguration(_Model): + """Configuration specific to the WebSocket-based invocations protocol.""" + + class RoutineDispatchPayload(_Model): """Base model for a manual dispatch payload. @@ -8609,36 +8733,14 @@ class LocalShellToolParam(Tool, discriminator="local_shell"): :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. :vartype type: str or ~azure.ai.projects.models.LOCAL_SHELL - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.LOCAL_SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( self, - *, - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -8817,6 +8919,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = IndexType.MANAGED_AZURE_SEARCH # type: ignore +class McpProtocolConfiguration(_Model): + """Configuration specific to the MCP protocol.""" + + class MCPTool(Tool, discriminator="mcp"): """MCP tool. @@ -8863,10 +8969,6 @@ class MCPTool(Tool, discriminator="mcp"): connection stores authentication and other connection details needed to connect to the MCP server. :vartype project_connection_id: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.MCP] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -8923,18 +9025,165 @@ class MCPTool(Tool, discriminator="mcp"): project_connection_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The connection ID in the project for the MCP server. The connection stores authentication and other connection details needed to connect to the MCP server.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( + + @overload + def __init__( + self, + *, + server_label: str, + server_url: Optional[str] = None, + connector_id: Optional[ + Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + ] = None, + authorization: Optional[str] = None, + server_description: Optional[str] = None, + headers: Optional[dict[str, str]] = None, + allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = None, + require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = None, + defer_loading: Optional[bool] = None, + project_connection_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.MCP # type: ignore + + +class MCPToolboxTool(ToolboxTool, discriminator="mcp"): + """An MCP tool stored in a toolbox. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. MCP. + :vartype type: str or ~azure.ai.projects.models.MCP + :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. + :vartype server_label: str + :ivar server_url: The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be + provided. + :vartype server_url: str + :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of + ``server_url`` or ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], + Literal["connector_googledrive"], Literal["connector_microsoftteams"], + Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], + Literal["connector_sharepoint"] + :vartype connector_id: str or str or str or str or str or str or str or str + :ivar authorization: An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application must handle the OAuth + authorization flow and provide the token here. + :vartype authorization: str + :ivar server_description: Optional description of the MCP server, used to provide more context. + :vartype server_description: str + :ivar headers: + :vartype headers: dict[str, str] + :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. + :vartype allowed_tools: list[str] or ~azure.ai.projects.models.MCPToolFilter + :ivar require_approval: Is one of the following types: MCPToolRequireApproval, + Literal["always"], Literal["never"] + :vartype require_approval: ~azure.ai.projects.models.MCPToolRequireApproval or str or str + :ivar defer_loading: Whether this MCP tool is deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar project_connection_id: The connection ID in the project for the MCP server. The + connection stores authentication and other connection details needed to connect to the MCP + server. + :vartype project_connection_id: str + """ + + type: Literal[ToolboxToolType.MCP] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. MCP.""" + server_label: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A label for this MCP server, used to identify it in tool calls. Required.""" + server_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be provided.""" + connector_id: Optional[ + Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + ] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identifier for service connectors, like those available in ChatGPT. One of ``server_url`` or + ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], + Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], + Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], + Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" + authorization: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An OAuth access token that can be used with a remote MCP server, either with a custom MCP + server URL or a service connector. Your application must handle the OAuth authorization flow + and provide the token here.""" + server_description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional description of the MCP server, used to provide more context.""" + headers: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + allowed_tools: Optional[Union[list[str], "_models.MCPToolFilter"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" + """Is either a [str] type or a MCPToolFilter type.""" + require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = ( + rest_field(visibility=["read", "create", "update", "delete", "query"]) + ) + """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" + defer_loading: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether this MCP tool is deferred and discovered via tool search.""" + project_connection_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The connection ID in the project for the MCP server. The connection stores authentication and + other connection details needed to connect to the MCP server.""" @overload def __init__( self, *, server_label: str, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, server_url: Optional[str] = None, connector_id: Optional[ Literal[ @@ -8955,7 +9204,6 @@ def __init__( require_approval: Optional[Union["_models.MCPToolRequireApproval", Literal["always"], Literal["never"]]] = None, defer_loading: Optional[bool] = None, project_connection_id: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -8967,7 +9215,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.MCP # type: ignore + self.type = ToolboxToolType.MCP # type: ignore class MCPToolFilter(_Model): @@ -9139,14 +9387,6 @@ class MemorySearchPreviewTool(Tool, discriminator="memory_search_preview"): :ivar type: The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW. :vartype type: str or ~azure.ai.projects.models.MEMORY_SEARCH_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar memory_store_name: The name of the memory store to use. Required. :vartype memory_store_name: str :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which @@ -9162,16 +9402,6 @@ class MemorySearchPreviewTool(Tool, discriminator="memory_search_preview"): type: Literal[ToolType.MEMORY_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" memory_store_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the memory store to use. Required.""" scope: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -9191,9 +9421,6 @@ def __init__( *, memory_store_name: str, scope: str, - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, search_options: Optional["_models.MemorySearchOptions"] = None, update_delay: Optional[int] = None, ) -> None: ... @@ -9656,14 +9883,6 @@ class MicrosoftFabricPreviewTool(Tool, discriminator="fabric_dataagent_preview") :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. FABRIC_DATAAGENT_PREVIEW. :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. :vartype fabric_dataagent_preview: ~azure.ai.projects.models.FabricDataAgentToolParameters """ @@ -9671,16 +9890,6 @@ class MicrosoftFabricPreviewTool(Tool, discriminator="fabric_dataagent_preview") type: Literal[ToolType.FABRIC_DATAAGENT_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The object type, which is always 'fabric_dataagent_preview'. Required. FABRIC_DATAAGENT_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" fabric_dataagent_preview: "_models.FabricDataAgentToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -9691,9 +9900,6 @@ def __init__( self, *, fabric_dataagent_preview: "_models.FabricDataAgentToolParameters", - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -10539,30 +10745,65 @@ class OpenApiTool(Tool, discriminator="openapi"): :vartype type: str or ~azure.ai.projects.models.OPENAPI :ivar openapi: The openapi function definition. Required. :vartype openapi: ~azure.ai.projects.models.OpenApiFunctionDefinition + """ + + type: Literal[ToolType.OPENAPI] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'openapi'. Required. OPENAPI.""" + openapi: "_models.OpenApiFunctionDefinition" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The openapi function definition. Required.""" + + @overload + def __init__( + self, + *, + openapi: "_models.OpenApiFunctionDefinition", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.OPENAPI # type: ignore + + +class OpenApiToolboxTool(ToolboxTool, discriminator="openapi"): + """An OpenAPI tool stored in a toolbox. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. OPENAPI. + :vartype type: str or ~azure.ai.projects.models.OPENAPI + :ivar openapi: The openapi function definition. Required. + :vartype openapi: ~azure.ai.projects.models.OpenApiFunctionDefinition """ - type: Literal[ToolType.OPENAPI] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'openapi'. Required. OPENAPI.""" + type: Literal[ToolboxToolType.OPENAPI] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. OPENAPI.""" openapi: "_models.OpenApiFunctionDefinition" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The openapi function definition. Required.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( self, *, openapi: "_models.OpenApiFunctionDefinition", + name: Optional[str] = None, + description: Optional[str] = None, tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @@ -10575,7 +10816,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.OPENAPI # type: ignore + self.type = ToolboxToolType.OPENAPI # type: ignore class OptimizationAgentIdentifier(_Model): @@ -11751,21 +11992,86 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = EvaluatorGenerationJobSourceType.PROMPT # type: ignore +class ProtocolConfiguration(_Model): + """Per-protocol configuration for the agent endpoint. + + :ivar activity: Configuration for the activity protocol. + :vartype activity: ~azure.ai.projects.models.ActivityProtocolConfiguration + :ivar responses: Configuration for the responses protocol. + :vartype responses: ~azure.ai.projects.models.ResponsesProtocolConfiguration + :ivar a2_a: Configuration for the A2A protocol. + :vartype a2_a: ~azure.ai.projects.models.A2aProtocolConfiguration + :ivar mcp: Configuration for the MCP protocol. + :vartype mcp: ~azure.ai.projects.models.McpProtocolConfiguration + :ivar invocations: Configuration for the invocations protocol. + :vartype invocations: ~azure.ai.projects.models.InvocationsProtocolConfiguration + :ivar invocations_ws: Configuration for the WebSocket-based invocations protocol. + :vartype invocations_ws: ~azure.ai.projects.models.InvocationsWsProtocolConfiguration + """ + + activity: Optional["_models.ActivityProtocolConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the activity protocol.""" + responses: Optional["_models.ResponsesProtocolConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the responses protocol.""" + a2_a: Optional["_models.A2aProtocolConfiguration"] = rest_field( + name="a2a", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the A2A protocol.""" + mcp: Optional["_models.McpProtocolConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the MCP protocol.""" + invocations: Optional["_models.InvocationsProtocolConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the invocations protocol.""" + invocations_ws: Optional["_models.InvocationsWsProtocolConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for the WebSocket-based invocations protocol.""" + + @overload + def __init__( + self, + *, + activity: Optional["_models.ActivityProtocolConfiguration"] = None, + responses: Optional["_models.ResponsesProtocolConfiguration"] = None, + a2_a: Optional["_models.A2aProtocolConfiguration"] = None, + mcp: Optional["_models.McpProtocolConfiguration"] = None, + invocations: Optional["_models.InvocationsProtocolConfiguration"] = None, + invocations_ws: Optional["_models.InvocationsWsProtocolConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ProtocolVersionRecord(_Model): """A record mapping for a single protocol and its version. - :ivar protocol: The protocol type. Required. Known values are: "activity_protocol", - "responses", "a2a", "mcp", "invocations", and "invocations_ws". - :vartype protocol: str or ~azure.ai.projects.models.AgentProtocol + :ivar protocol: The protocol type. Required. Known values are: "activity", "responses", "a2a", + "mcp", "invocations", and "invocations_ws". + :vartype protocol: str or ~azure.ai.projects.models.AgentEndpointProtocol :ivar version: The version string for the protocol, e.g. 'v0.1.1'. Required. :vartype version: str """ - protocol: Union[str, "_models.AgentProtocol"] = rest_field( + protocol: Union[str, "_models.AgentEndpointProtocol"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The protocol type. Required. Known values are: \"activity_protocol\", \"responses\", \"a2a\", - \"mcp\", \"invocations\", and \"invocations_ws\".""" + """The protocol type. Required. Known values are: \"activity\", \"responses\", \"a2a\", \"mcp\", + \"invocations\", and \"invocations_ws\".""" version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The version string for the protocol, e.g. 'v0.1.1'. Required.""" @@ -11773,7 +12079,7 @@ class ProtocolVersionRecord(_Model): def __init__( self, *, - protocol: Union[str, "_models.AgentProtocol"], + protocol: Union[str, "_models.AgentEndpointProtocol"], version: str, ) -> None: ... @@ -12073,10 +12379,6 @@ class ReminderPreviewTool(Tool, discriminator="reminder_preview"): :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] """ type: Literal[ToolType.REMINDER_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -12085,12 +12387,6 @@ class ReminderPreviewTool(Tool, discriminator="reminder_preview"): """Optional user-defined name for this tool or configuration.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( @@ -12098,7 +12394,6 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -12113,6 +12408,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = ToolType.REMINDER_PREVIEW # type: ignore +class ReminderPreviewToolboxTool(ToolboxTool, discriminator="reminder_preview"): + """A reminder tool stored in a toolbox. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all + default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names + are silently ignored at runtime. + :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. REMINDER_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.REMINDER_PREVIEW + """ + + type: Literal[ToolboxToolType.REMINDER_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. REMINDER_PREVIEW.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolboxToolType.REMINDER_PREVIEW # type: ignore + + +class ResponsesProtocolConfiguration(_Model): + """Configuration specific to the responses protocol.""" + + class ResponseUsageInputTokensDetails(_Model): """ResponseUsageInputTokensDetails. @@ -12755,10 +13093,10 @@ class SessionLogEvent(_Model): .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} :ivar event: The SSE event type. Currently ``log``, but additional event types may be added in the future. Clients should ignore unrecognized event types. Required. "log" @@ -12834,14 +13172,6 @@ class SharepointPreviewTool(Tool, discriminator="sharepoint_grounding_preview"): :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. SHAREPOINT_GROUNDING_PREVIEW. :vartype type: str or ~azure.ai.projects.models.SHAREPOINT_GROUNDING_PREVIEW - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar tool_configs: Per-tool configuration map. Keys are tool names or ``*`` (catch-all - default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names - are silently ignored at runtime. - :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. :vartype sharepoint_grounding_preview: ~azure.ai.projects.models.SharepointGroundingToolParameters @@ -12850,16 +13180,6 @@ class SharepointPreviewTool(Tool, discriminator="sharepoint_grounding_preview"): type: Literal[ToolType.SHAREPOINT_GROUNDING_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The object type, which is always 'sharepoint_grounding_preview'. Required. SHAREPOINT_GROUNDING_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" sharepoint_grounding_preview: "_models.SharepointGroundingToolParameters" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -12870,9 +13190,6 @@ def __init__( self, *, sharepoint_grounding_preview: "_models.SharepointGroundingToolParameters", - name: Optional[str] = None, - description: Optional[str] = None, - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, ) -> None: ... @overload @@ -13716,13 +14033,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ToolboxSearchPreviewTool(Tool, discriminator="toolbox_search_preview"): - """A tool for searching over the agent's toolbox. When present, deferred tools are hidden from - ``tools/list`` and only discoverable via ``search_tools`` queries at runtime. +class ToolboxSearchPreviewToolboxTool(ToolboxTool, discriminator="toolbox_search_preview"): + """A toolbox search tool stored in a toolbox. - :ivar type: The type of the tool. Always ``toolbox_search_preview``. Required. - TOOLBOX_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.TOOLBOX_SEARCH_PREVIEW :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -13731,20 +14044,13 @@ class ToolboxSearchPreviewTool(Tool, discriminator="toolbox_search_preview"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: The type of the tool. Always ``toolbox_search_preview``. Required. + TOOLBOX_SEARCH_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.TOOLBOX_SEARCH_PREVIEW """ - type: Literal[ToolType.TOOLBOX_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + type: Literal[ToolboxToolType.TOOLBOX_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the tool. Always ``toolbox_search_preview``. Required. TOOLBOX_SEARCH_PREVIEW.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( @@ -13764,7 +14070,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.TOOLBOX_SEARCH_PREVIEW # type: ignore + self.type = ToolboxToolType.TOOLBOX_SEARCH_PREVIEW # type: ignore class ToolboxSkill(_Model): @@ -13861,7 +14167,7 @@ class ToolboxVersionObject(_Model): :ivar created_at: The Unix timestamp (seconds) when the toolbox version was created. Required. :vartype created_at: ~datetime.datetime :ivar tools: The list of tools contained in this toolbox version. Required. - :vartype tools: list[~azure.ai.projects.models.Tool] + :vartype tools: list[~azure.ai.projects.models.ToolboxTool] :ivar skills: The list of skill sources included in this toolbox version. :vartype skills: list[~azure.ai.projects.models.ToolboxSkill] :ivar policies: Policy configuration for the toolbox version. @@ -13888,7 +14194,7 @@ class ToolboxVersionObject(_Model): visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" ) """The Unix timestamp (seconds) when the toolbox version was created. Required.""" - tools: list["_models.Tool"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tools: list["_models.ToolboxTool"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of tools contained in this toolbox version. Required.""" skills: Optional[list["_models.ToolboxSkill"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] @@ -13908,7 +14214,7 @@ def __init__( name: str, version: str, created_at: datetime.datetime, - tools: list["_models.Tool"], + tools: list["_models.ToolboxTool"], description: Optional[str] = None, skills: Optional[list["_models.ToolboxSkill"]] = None, policies: Optional["_models.ToolboxPolicies"] = None, @@ -15038,6 +15344,57 @@ class WebSearchTool(Tool, discriminator="web_search"): for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: Literal["low"], Literal["medium"], Literal["high"] :vartype search_context_size: str or str or str + :ivar custom_search_configuration: The project connections attached to this tool. There can be + a maximum of 1 connection resource attached to the tool. + :vartype custom_search_configuration: ~azure.ai.projects.models.WebSearchConfiguration + """ + + type: Literal[ToolType.WEB_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required. + WEB_SEARCH.""" + filters: Optional["_models.WebSearchToolFilters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + user_location: Optional["_models.WebSearchApproximateLocation"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + search_context_size: Optional[Literal["low", "medium", "high"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """High level guidance for the amount of context window space to use for the search. One of + ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: + Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" + custom_search_configuration: Optional["_models.WebSearchConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + @overload + def __init__( + self, + *, + filters: Optional["_models.WebSearchToolFilters"] = None, + user_location: Optional["_models.WebSearchApproximateLocation"] = None, + search_context_size: Optional[Literal["low", "medium", "high"]] = None, + custom_search_configuration: Optional["_models.WebSearchConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.WEB_SEARCH # type: ignore + + +class WebSearchToolboxTool(ToolboxTool, discriminator="web_search"): + """A web search tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -15046,14 +15403,23 @@ class WebSearchTool(Tool, discriminator="web_search"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. WEB_SEARCH. + :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH + :ivar filters: + :vartype filters: ~azure.ai.projects.models.WebSearchToolFilters + :ivar user_location: + :vartype user_location: ~azure.ai.projects.models.WebSearchApproximateLocation + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of + the following types: Literal["low"], Literal["medium"], Literal["high"] + :vartype search_context_size: str or str or str :ivar custom_search_configuration: The project connections attached to this tool. There can be a maximum of 1 connection resource attached to the tool. :vartype custom_search_configuration: ~azure.ai.projects.models.WebSearchConfiguration """ - type: Literal[ToolType.WEB_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required. - WEB_SEARCH.""" + type: Literal[ToolboxToolType.WEB_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. WEB_SEARCH.""" filters: Optional["_models.WebSearchToolFilters"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -15066,16 +15432,6 @@ class WebSearchTool(Tool, discriminator="web_search"): """High level guidance for the amount of context window space to use for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" custom_search_configuration: Optional["_models.WebSearchConfiguration"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -15086,12 +15442,12 @@ class WebSearchTool(Tool, discriminator="web_search"): def __init__( self, *, - filters: Optional["_models.WebSearchToolFilters"] = None, - user_location: Optional["_models.WebSearchApproximateLocation"] = None, - search_context_size: Optional[Literal["low", "medium", "high"]] = None, name: Optional[str] = None, description: Optional[str] = None, tool_configs: Optional[dict[str, "_models.ToolConfig"]] = None, + filters: Optional["_models.WebSearchToolFilters"] = None, + user_location: Optional["_models.WebSearchApproximateLocation"] = None, + search_context_size: Optional[Literal["low", "medium", "high"]] = None, custom_search_configuration: Optional["_models.WebSearchConfiguration"] = None, ) -> None: ... @@ -15104,7 +15460,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.WEB_SEARCH # type: ignore + self.type = ToolboxToolType.WEB_SEARCH # type: ignore class WebSearchToolFilters(_Model): @@ -15212,6 +15568,35 @@ class WorkIQPreviewTool(Tool, discriminator="work_iq_preview"): :vartype type: str or ~azure.ai.projects.models.WORK_IQ_PREVIEW :ivar project_connection_id: The ID of the WorkIQ project connection. Required. :vartype project_connection_id: str + """ + + type: Literal[ToolType.WORK_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW.""" + project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the WorkIQ project connection. Required.""" + + @overload + def __init__( + self, + *, + project_connection_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = ToolType.WORK_IQ_PREVIEW # type: ignore + + +class WorkIQPreviewToolboxTool(ToolboxTool, discriminator="work_iq_preview"): + """A WorkIQ tool stored in a toolbox. + :ivar name: Optional user-defined name for this tool or configuration. :vartype name: str :ivar description: Optional user-defined description for this tool or configuration. @@ -15220,22 +15605,16 @@ class WorkIQPreviewTool(Tool, discriminator="work_iq_preview"): default). Resolution order: exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] + :ivar type: Required. WORK_IQ_PREVIEW. + :vartype type: str or ~azure.ai.projects.models.WORK_IQ_PREVIEW + :ivar project_connection_id: The ID of the WorkIQ project connection. Required. + :vartype project_connection_id: str """ - type: Literal[ToolType.WORK_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW.""" + type: Literal[ToolboxToolType.WORK_IQ_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. WORK_IQ_PREVIEW.""" project_connection_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The ID of the WorkIQ project connection. Required.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined name for this tool or configuration.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Optional user-defined description for this tool or configuration.""" - tool_configs: Optional[dict[str, "_models.ToolConfig"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Per-tool configuration map. Keys are tool names or ``*`` (catch-all default). Resolution order: - exact tool name match takes priority over ``*``. Unknown tool names are silently ignored at - runtime.""" @overload def __init__( @@ -15256,4 +15635,4 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolType.WORK_IQ_PREVIEW # type: ignore + self.type = ToolboxToolType.WORK_IQ_PREVIEW # type: ignore diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index dd229b438bb2..88fd78d735b3 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -404,9 +404,7 @@ def build_agents_disable_request(agent_name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_agents_create_session_request( - agent_name: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_agents_create_session_request(agent_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -426,8 +424,6 @@ def build_agents_create_session_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -435,9 +431,7 @@ def build_agents_create_session_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_agents_get_session_request( - agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_agents_get_session_request(agent_name: str, session_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -457,17 +451,12 @@ def build_agents_get_session_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agents_delete_session_request( - agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_agents_delete_session_request(agent_name: str, session_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) @@ -483,11 +472,7 @@ def build_agents_delete_session_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_agents_stop_session_request(agent_name: str, session_id: str, **kwargs: Any) -> HttpRequest: @@ -512,7 +497,6 @@ def build_agents_stop_session_request(agent_name: str, session_id: str, **kwargs def build_agents_list_sessions_request( agent_name: str, *, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -545,8 +529,6 @@ def build_agents_list_sessions_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -581,7 +563,7 @@ def build_agents_get_session_log_stream_request( # pylint: disable=name-too-lon def build_agents_upload_session_file_request( - agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any + agent_name: str, agent_session_id: str, *, remote_path: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -600,20 +582,18 @@ def build_agents_upload_session_file_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") + _params["path"] = _SERIALIZER.query("remote_path", remote_path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_agents_download_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any + agent_name: str, agent_session_id: str, *, remote_path: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -631,12 +611,10 @@ def build_agents_download_session_file_request( # pylint: disable=name-too-long _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") + _params["path"] = _SERIALIZER.query("remote_path", remote_path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -646,8 +624,7 @@ def build_agents_list_session_files_request( agent_name: str, agent_session_id: str, *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, + remote_path: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -670,8 +647,8 @@ def build_agents_list_session_files_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if path is not None: - _params["path"] = _SERIALIZER.query("path", path, "str") + if remote_path is not None: + _params["path"] = _SERIALIZER.query("remote_path", remote_path, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -683,23 +660,14 @@ def build_agents_list_session_files_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_agents_delete_session_file_request( - agent_name: str, - agent_session_id: str, - *, - path: str, - recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, - **kwargs: Any + agent_name: str, agent_session_id: str, *, remote_path: str, recursive: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) @@ -713,16 +681,12 @@ def build_agents_delete_session_file_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") + _params["path"] = _SERIALIZER.query("remote_path", remote_path, "str") if recursive is not None: _params["recursive"] = _SERIALIZER.query("recursive", recursive, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_evaluation_rules_get_request(id: str, **kwargs: Any) -> HttpRequest: @@ -5040,7 +5004,7 @@ def enable(self, agent_name: str, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -5097,7 +5061,7 @@ def disable(self, agent_name: str, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -5114,7 +5078,6 @@ def create_session( agent_name: str, *, version_indicator: _models.VersionIndicator, - user_isolation_key: Optional[str] = None, content_type: str = "application/json", agent_session_id: Optional[str] = None, **kwargs: Any @@ -5129,9 +5092,6 @@ def create_session( :type agent_name: str :keyword version_indicator: Determines which agent version backs the session. Required. :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5145,13 +5105,7 @@ def create_session( @overload def create_session( - self, - agent_name: str, - body: JSON, - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any + self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.AgentSessionResource: """Create a session. @@ -5163,9 +5117,6 @@ def create_session( :type agent_name: str :param body: Required. :type body: JSON - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5176,13 +5127,7 @@ def create_session( @overload def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.AgentSessionResource: """Create a session. @@ -5194,9 +5139,6 @@ def create_session( :type agent_name: str :param body: Required. :type body: IO[bytes] - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5212,7 +5154,6 @@ def create_session( body: Union[JSON, IO[bytes]] = _Unset, *, version_indicator: _models.VersionIndicator = _Unset, - user_isolation_key: Optional[str] = None, agent_session_id: Optional[str] = None, **kwargs: Any ) -> _models.AgentSessionResource: @@ -5228,9 +5169,6 @@ def create_session( :type body: JSON or IO[bytes] :keyword version_indicator: Determines which agent version backs the session. Required. :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique within the agent endpoint. Auto-generated if omitted. Default value is None. :paramtype agent_session_id: str @@ -5266,7 +5204,6 @@ def create_session( _request = build_agents_create_session_request( agent_name=agent_name, - user_isolation_key=user_isolation_key, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5310,9 +5247,7 @@ def create_session( return deserialized # type: ignore @distributed_trace - def get_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: """Get a session. Retrieves the details of a hosted agent session by agent name and session identifier. @@ -5321,9 +5256,6 @@ def get_session( :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: @@ -5344,7 +5276,6 @@ def get_session( _request = build_agents_get_session_request( agent_name=agent_name, session_id=session_id, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5387,7 +5318,7 @@ def get_session( @distributed_trace def delete_session( # pylint: disable=inconsistent-return-statements - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any + self, agent_name: str, session_id: str, **kwargs: Any ) -> None: """Delete a session. @@ -5398,9 +5329,6 @@ def delete_session( # pylint: disable=inconsistent-return-statements :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -5421,7 +5349,6 @@ def delete_session( # pylint: disable=inconsistent-return-statements _request = build_agents_delete_session_request( agent_name=agent_name, session_id=session_id, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5514,7 +5441,6 @@ def list_sessions( self, agent_name: str, *, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, @@ -5526,9 +5452,6 @@ def list_sessions( :param agent_name: The name of the agent. Required. :type agent_name: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -5564,7 +5487,6 @@ def prepare_request(_continuation_token=None): _request = build_agents_list_sessions_request( agent_name=agent_name, - user_isolation_key=user_isolation_key, limit=limit, order=order, after=_continuation_token, @@ -5715,14 +5637,7 @@ def get_session_log_stream( @distributed_trace def _upload_session_file( - self, - agent_name: str, - agent_session_id: str, - content: bytes, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any + self, agent_name: str, agent_session_id: str, content: bytes, *, remote_path: str, **kwargs: Any ) -> _models.SessionFileWriteResult: """Upload a session file. @@ -5735,12 +5650,9 @@ def _upload_session_file( :type agent_session_id: str :param content: Required. :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :keyword remote_path: The destination file path within the sandbox, relative to the session + home directory. Required. + :paramtype remote_path: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: @@ -5764,8 +5676,7 @@ def _upload_session_file( _request = build_agents_upload_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5810,13 +5721,7 @@ def _upload_session_file( @distributed_trace def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any + self, agent_name: str, agent_session_id: str, *, remote_path: str, **kwargs: Any ) -> Iterator[bytes]: """Download a session file. @@ -5827,12 +5732,9 @@ def download_session_file( :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home + :keyword remote_path: The file path to download from the sandbox, relative to the session home directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :paramtype remote_path: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -5853,8 +5755,7 @@ def download_session_file( _request = build_agents_download_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5898,8 +5799,7 @@ def list_session_files( agent_name: str, agent_session_id: str, *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, + remote_path: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, @@ -5915,12 +5815,9 @@ def list_session_files( :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Defaults to - the home directory if not provided. Default value is None. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :keyword remote_path: The directory path to list, relative to the session home directory. + Defaults to the home directory if not provided. Default value is None. + :paramtype remote_path: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -5957,8 +5854,7 @@ def prepare_request(_continuation_token=None): _request = build_agents_list_session_files_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + remote_path=remote_path, limit=limit, order=order, after=_continuation_token, @@ -6010,9 +5906,8 @@ def delete_session_file( # pylint: disable=inconsistent-return-statements agent_name: str, agent_session_id: str, *, - path: str, + remote_path: str, recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, **kwargs: Any ) -> None: """Delete a session file. @@ -6024,15 +5919,12 @@ def delete_session_file( # pylint: disable=inconsistent-return-statements :type agent_name: str :param agent_session_id: The session ID. Required. :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str + :keyword remote_path: The file or directory path to delete, relative to the session home + directory. Required. + :paramtype remote_path: str :keyword recursive: Whether to recursively delete directory contents. The service defaults to ``false`` if a value is not specified by the caller. Default value is None. :paramtype recursive: bool - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -6053,9 +5945,8 @@ def delete_session_file( # pylint: disable=inconsistent-return-statements _request = build_agents_delete_session_file_request( agent_name=agent_name, agent_session_id=agent_session_id, - path=path, + remote_path=remote_path, recursive=recursive, - user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8143,7 +8034,7 @@ def create_version( self, name: str, *, - tools: List[_models.Tool], + tools: List[_models.ToolboxTool], content_type: str = "application/json", description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, @@ -8159,7 +8050,7 @@ def create_version( Required. :type name: str :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] + :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8227,7 +8118,7 @@ def create_version( name: str, body: Union[JSON, IO[bytes]] = _Unset, *, - tools: List[_models.Tool] = _Unset, + tools: List[_models.ToolboxTool] = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, skills: Optional[List[_models.ToolboxSkill]] = None, @@ -8244,7 +8135,7 @@ def create_version( :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] + :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] :keyword description: A human-readable description of the toolbox. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 7dfb430cdc6b..f679339c795a 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -337,5 +337,5 @@ def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return super()._upload_session_file( - agent_name, session_id, content, path=remote_path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, remote_path=remote_path, user_isolation_key=user_isolation_key, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py index ce9b1e950fe3..4087a45cd9fa 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py @@ -85,7 +85,7 @@ files = project_client.agents.list_session_files( agent_name=agent_name, agent_session_id=session.agent_session_id, - path="/remote", + remote_path="/remote", ) for entry in files: print(f" - name={entry.name}, size={entry.size}, is_directory={entry.is_directory}") @@ -95,7 +95,7 @@ project_client.agents.download_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path1, + remote_path=remote_file_path1, ) ) file_content = content_bytes.decode("utf-8", errors="replace") @@ -105,14 +105,14 @@ project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path1, + remote_path=remote_file_path1, ) print(f"Deleting session file at path: {remote_file_path2}...") project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path2, + remote_path=remote_file_path2, ) finally: project_client.agents.delete_session( diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py index 2fac02d913a9..c87f17d4dac0 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py @@ -72,7 +72,7 @@ async def main(): agent_name=agent_name, session_id=session.agent_session_id, file_path=data_file1, - path=remote_file_path1, + remote_path=remote_file_path1, ) print(f"Uploading session file: {data_file2} -> {remote_file_path2}") @@ -80,14 +80,14 @@ async def main(): agent_name=agent_name, session_id=session.agent_session_id, file_path=data_file2, - path=remote_file_path2, + remote_path=remote_file_path2, ) print("Listing session files for the session at path '.'...") files = project_client.agents.list_session_files( agent_name=agent_name, agent_session_id=session.agent_session_id, - path="/remote", + remote_path="/remote", ) async for entry in files: print(f" - name={entry.name}, size={entry.size}, is_directory={entry.is_directory}") @@ -97,7 +97,7 @@ async def main(): async for chunk in await project_client.agents.download_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path1, + remote_path=remote_file_path1, ): content_bytes += chunk file_content = content_bytes.decode("utf-8", errors="replace") @@ -107,14 +107,14 @@ async def main(): await project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path1, + remote_path=remote_file_path1, ) print(f"Deleting session file at path: {remote_file_path2}...") await project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, - path=remote_file_path2, + remote_path=remote_file_path2, ) finally: await project_client.agents.delete_session( diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index 2ba75c97059f..8d7cada18c96 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai-foundry/data-plane/Foundry/src/sdk-python-js-azure-ai-projects -commit: 90a82ad9585909f403d18768665f74f128e36ac7 +commit: 6760ee629b02de8a5416f4636c1d5850fc29fb5f repo: Azure/azure-rest-api-specs additionalDirectories: - specification/ai-foundry/data-plane/Foundry/src/agents From 0e3a7dc0bbbee33d6506bd1df38ff870d9de9438 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Mon, 22 Jun 2026 09:27:05 -0700 Subject: [PATCH 6/8] Fixed patched code --- .../azure/ai/projects/aio/operations/_patch_agents_async.py | 6 +----- .../azure/ai/projects/operations/_patch_agents.py | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 1e0978420563..004ee173f0b2 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -273,7 +273,6 @@ async def upload_session_file( # type: ignore[override] content: Optional[bytes] = None, file_path: Optional[Union[str, "os.PathLike[str]"]] = None, remote_path: str, - user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. @@ -295,9 +294,6 @@ async def upload_session_file( # type: ignore[override] :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype remote_path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: @@ -321,5 +317,5 @@ async def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return await super()._upload_session_file( - agent_name, session_id, content, remote_path=remote_path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, remote_path=remote_path, **kwargs ) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index f679339c795a..9d50db2746b9 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -289,7 +289,6 @@ def upload_session_file( # type: ignore[override] content: Optional[bytes] = None, file_path: Optional[Union[str, "os.PathLike[str]"]] = None, remote_path: str, - user_isolation_key: Optional[str] = None, **kwargs: Any, ) -> _models.SessionFileWriteResult: """Upload a file to the session sandbox. @@ -311,9 +310,6 @@ def upload_session_file( # type: ignore[override] :keyword remote_path: The destination file path within the sandbox, relative to the session home directory. Required. :paramtype remote_path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: @@ -337,5 +333,5 @@ def upload_session_file( # type: ignore[override] assert content is not None # Guaranteed by validation above return super()._upload_session_file( - agent_name, session_id, content, remote_path=remote_path, user_isolation_key=user_isolation_key, **kwargs + agent_name, session_id, content, remote_path=remote_path, **kwargs ) From 9261aff4a6197801f3e8683207921243dbe836c8 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Mon, 22 Jun 2026 11:25:52 -0700 Subject: [PATCH 7/8] More --- .../aio/operations/_patch_agents_async.py | 47 +++++ .../ai/projects/operations/_patch_agents.py | 47 +++++ .../sessions/test_agent_session_files_crud.py | 189 +++++++++++++++++ .../test_agent_session_files_crud_async.py | 193 ++++++++++++++++++ .../tests/test_data/sessions/data_file1.txt | 1 + .../tests/test_data/sessions/data_file2.txt | 1 + 6 files changed, 478 insertions(+) create mode 100644 sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py create mode 100644 sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py create mode 100644 sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file1.txt create mode 100644 sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file2.txt diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 004ee173f0b2..1b8c85b5ad93 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -319,3 +319,50 @@ async def upload_session_file( # type: ignore[override] return await super()._upload_session_file( agent_name, session_id, content, remote_path=remote_path, **kwargs ) + + @distributed_trace_async + async def download_session_file_to_disk( + self, + agent_name: str, + session_id: str, + *, + file_path: Union[str, "os.PathLike[str]"], + remote_path: str, + **kwargs: Any, + ) -> None: + """Download a session file directly to disk. + + Downloads the file at the specified sandbox path and writes it to a local file. + The remote path is resolved relative to the session home directory. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword file_path: The full path to the local file where the content should be written. Required. + :paramtype file_path: str or os.PathLike[str] + :keyword remote_path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype remote_path: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + :raises ValueError: If *file_path* points to a directory. + :raises OSError: If the file cannot be written. + """ + p = Path(file_path) + if p.exists() and p.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{file_path}`.") + + # Download the file content using the existing method + content_iterator = await self.download_session_file( + agent_name=agent_name, + agent_session_id=session_id, + remote_path=remote_path, + **kwargs, + ) + + # Write the content to disk + with open(file_path, "wb") as f: + async for chunk in content_iterator: + f.write(chunk) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 9d50db2746b9..18a82926c57a 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -335,3 +335,50 @@ def upload_session_file( # type: ignore[override] return super()._upload_session_file( agent_name, session_id, content, remote_path=remote_path, **kwargs ) + + @distributed_trace + def download_session_file_to_disk( + self, + agent_name: str, + session_id: str, + *, + file_path: Union[str, "os.PathLike[str]"], + remote_path: str, + **kwargs: Any, + ) -> None: + """Download a session file directly to disk. + + Downloads the file at the specified sandbox path and writes it to a local file. + The remote path is resolved relative to the session home directory. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :keyword file_path: The full path to the local file where the content should be written. Required. + :paramtype file_path: str or os.PathLike[str] + :keyword remote_path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype remote_path: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + :raises ValueError: If *file_path* points to a directory. + :raises OSError: If the file cannot be written. + """ + p = Path(file_path) + if p.exists() and p.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{file_path}`.") + + # Download the file content using the existing method + content_iterator = self.download_session_file( + agent_name=agent_name, + agent_session_id=session_id, + remote_path=remote_path, + **kwargs, + ) + + # Write the content to disk + with open(file_path, "wb") as f: + for chunk in content_iterator: + f.write(chunk) diff --git a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py new file mode 100644 index 000000000000..427dd048c2c1 --- /dev/null +++ b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py @@ -0,0 +1,189 @@ +# pylint: disable=line-too-long,useless-suppression +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +# cSpell:disable +import os +from test_base import TestBase, servicePreparer +from devtools_testutils import recorded_by_proxy +from azure.ai.projects.models import VersionRefIndicator + + +class TestAgentSessionFilesCrud(TestBase): + """ + Test CRUD operations for Agent Session Files. + + These tests require a Hosted Agent to be deployed and available. + Sessions only work with Hosted Agents. + + Prerequisites: + - A Hosted Agent must be deployed and active. + - Environment variable FOUNDRY_HOSTED_AGENT_NAME must be set. + """ + + def _get_latest_active_agent_version(self, project_client, agent_name): + """Get the latest active agent version for a hosted agent.""" + for version in project_client.agents.list_versions(agent_name=agent_name, order="desc"): + if version.status == "active": + return version + raise RuntimeError( + f"No active version found for hosted agent '{agent_name}'. " + "Create or activate a version before running this test." + ) + + # To run this test: + # pytest tests\sessions\test_agent_session_files_crud.py::TestAgentSessionFilesCrud::test_agent_session_files_crud -s + @servicePreparer() + @recorded_by_proxy() + def test_agent_session_files_crud(self, **kwargs): + """ + Test CRUD operations for Agent Session Files. + + This test: + 1. Creates a session for a hosted agent + 2. Uploads two files to the session + 3. Lists files in the session and verifies the uploaded files are present + 4. Downloads a file and verifies its content + 5. Deletes both files + 6. Cleans up by deleting the session + + Routes used in this test: + + Action REST API Route Client Method + ------+---------------------------------------------------------------------------+------------------------------------------- + POST /agents/{agent_name}/sessions project_client.agents.create_session() + POST /agents/{agent_name}/sessions/{session_id}/files:upload project_client.agents.upload_session_file() + GET /agents/{agent_name}/sessions/{session_id}/files project_client.agents.list_session_files() + GET /agents/{agent_name}/sessions/{session_id}/files:download project_client.agents.download_session_file() + DELETE /agents/{agent_name}/sessions/{session_id}/files project_client.agents.delete_session_file() + DELETE /agents/{agent_name}/sessions/{session_id} project_client.agents.delete_session() + """ + print("\n") + + agent_name = kwargs["foundry_hosted_agent_name"] + project_client = self.create_client(**kwargs) + + # Construct paths to test data files + test_dir = os.path.dirname(os.path.abspath(__file__)) + test_data_folder = os.path.join(test_dir, "..", "test_data", "sessions") + data_file1 = os.path.join(test_data_folder, "data_file1.txt") + data_file2 = os.path.join(test_data_folder, "data_file2.txt") + remote_file_path1 = "/remote/data_file1.txt" + remote_file_path2 = "/remote/data_file2.txt" + + # Verify test data files exist + assert os.path.exists(data_file1), f"Test data file not found: {data_file1}" + assert os.path.exists(data_file2), f"Test data file not found: {data_file2}" + + # Get the latest active agent version + agent = self._get_latest_active_agent_version(project_client, agent_name) + assert agent is not None, "Failed to get agent version" + assert agent.version is not None, "Agent version should not be None" + print(f"Using agent: {agent_name}, version: {agent.version}") + + # Create a session + session = project_client.agents.create_session( + agent_name=agent_name, + version_indicator=VersionRefIndicator(agent_version=agent.version), + ) + assert session is not None, "Session creation returned None" + assert session.agent_session_id is not None, "Session ID should not be None" + assert session.status is not None, "Session status should not be None" + print(f"Session created (id: {session.agent_session_id}, status: {session.status})") + + try: + # Upload first file + print(f"Uploading session file: {data_file1} -> {remote_file_path1}") + project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + file_path=data_file1, + remote_path=remote_file_path1, + ) + print(f"Successfully uploaded file to {remote_file_path1}") + + # Upload second file using content (bytes) instead of file_path + print(f"Uploading session file using content: {data_file2} -> {remote_file_path2}") + with open(data_file2, "rb") as f: + file2_content = f.read() + project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + content=file2_content, + remote_path=remote_file_path2, + ) + print(f"Successfully uploaded file to {remote_file_path2}") + + # List session files and verify uploaded files are present + print("Listing session files at path '/remote'...") + files = project_client.agents.list_session_files( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path="/remote", + ) + + # Convert to list for verification + files_list = list(files) + assert len(files_list) >= 2, f"Expected at least 2 files, got {len(files_list)}" + + # Verify file entries + file_names = [entry.name for entry in files_list] + print(f"Files found: {file_names}") + assert "data_file1.txt" in file_names, "data_file1.txt not found in listed files" + assert "data_file2.txt" in file_names, "data_file2.txt not found in listed files" + + # Verify file properties + for entry in files_list: + print(f" - name={entry.name}, size={entry.size}, is_directory={entry.is_directory}") + assert entry.name is not None, "File name should not be None" + assert entry.size is not None, "File size should not be None" + assert entry.is_directory is not None, "is_directory should not be None" + + # Download and verify content of first file + print(f"Downloading and verifying content from '{remote_file_path1}'") + content_bytes = b"".join( + project_client.agents.download_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path1, + ) + ) + assert content_bytes is not None, "Downloaded content should not be None" + assert len(content_bytes) > 0, "Downloaded content should not be empty" + + file_content = content_bytes.decode("utf-8", errors="replace") + print(f"Downloaded content: {file_content.strip()}") + + # Verify content matches expected + expected_content = "This is sample file 1" + assert expected_content in file_content, f"Expected content '{expected_content}' not found in downloaded file" + print("Content verification passed!") + + # Delete first file + print(f"Deleting session file at path: {remote_file_path1}...") + project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path1, + ) + print(f"Successfully deleted {remote_file_path1}") + + # Delete second file + print(f"Deleting session file at path: {remote_file_path2}...") + project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path2, + ) + print(f"Successfully deleted {remote_file_path2}") + + print("All session file CRUD operations completed successfully!") + + finally: + # Clean up: delete the session + project_client.agents.delete_session( + agent_name=agent_name, + session_id=session.agent_session_id, + ) + print(f"Session deleted (id: {session.agent_session_id})") diff --git a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py new file mode 100644 index 000000000000..1d1efdafbf64 --- /dev/null +++ b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py @@ -0,0 +1,193 @@ +# pylint: disable=line-too-long,useless-suppression +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +# cSpell:disable +import os +from test_base import TestBase, servicePreparer +from devtools_testutils.aio import recorded_by_proxy_async +from azure.ai.projects.models import VersionRefIndicator + + +class TestAgentSessionFilesCrudAsync(TestBase): + """ + Test CRUD operations for Agent Session Files (Async). + + These tests require a Hosted Agent to be deployed and available. + Sessions only work with Hosted Agents. + + Prerequisites: + - A Hosted Agent must be deployed and active. + - Environment variable FOUNDRY_HOSTED_AGENT_NAME must be set. + """ + + async def _get_latest_active_agent_version_async(self, project_client, agent_name): + """Get the latest active agent version for a hosted agent (async).""" + async for version in project_client.agents.list_versions(agent_name=agent_name, order="desc"): + if version.status == "active": + return version + raise RuntimeError( + f"No active version found for hosted agent '{agent_name}'. " + "Create or activate a version before running this test." + ) + + # To run this test: + # pytest tests\sessions\test_agent_session_files_crud_async.py::TestAgentSessionFilesCrudAsync::test_agent_session_files_crud_async -s + @servicePreparer() + @recorded_by_proxy_async() + async def test_agent_session_files_crud_async(self, **kwargs): + """ + Test CRUD operations for Agent Session Files (Async). + + This test: + 1. Creates a session for a hosted agent + 2. Uploads two files to the session + 3. Lists files in the session and verifies the uploaded files are present + 4. Downloads a file and verifies its content + 5. Deletes both files + 6. Cleans up by deleting the session + + Routes used in this test: + + Action REST API Route Client Method + ------+---------------------------------------------------------------------------+------------------------------------------- + POST /agents/{agent_name}/sessions project_client.agents.create_session() + POST /agents/{agent_name}/sessions/{session_id}/files:upload project_client.agents.upload_session_file() + GET /agents/{agent_name}/sessions/{session_id}/files project_client.agents.list_session_files() + GET /agents/{agent_name}/sessions/{session_id}/files:download project_client.agents.download_session_file() + DELETE /agents/{agent_name}/sessions/{session_id}/files project_client.agents.delete_session_file() + DELETE /agents/{agent_name}/sessions/{session_id} project_client.agents.delete_session() + """ + print("\n") + + agent_name = kwargs["foundry_hosted_agent_name"] + project_client = self.create_async_client(**kwargs) + + # Construct paths to test data files + test_dir = os.path.dirname(os.path.abspath(__file__)) + test_data_folder = os.path.join(test_dir, "..", "test_data", "sessions") + data_file1 = os.path.join(test_data_folder, "data_file1.txt") + data_file2 = os.path.join(test_data_folder, "data_file2.txt") + remote_file_path1 = "/remote/data_file1.txt" + remote_file_path2 = "/remote/data_file2.txt" + + # Verify test data files exist + assert os.path.exists(data_file1), f"Test data file not found: {data_file1}" + assert os.path.exists(data_file2), f"Test data file not found: {data_file2}" + + async with project_client: + # Get the latest active agent version + agent = await self._get_latest_active_agent_version_async(project_client, agent_name) + assert agent is not None, "Failed to get agent version" + assert agent.version is not None, "Agent version should not be None" + print(f"Using agent: {agent_name}, version: {agent.version}") + + # Create a session + session = await project_client.agents.create_session( + agent_name=agent_name, + version_indicator=VersionRefIndicator(agent_version=agent.version), + ) + assert session is not None, "Session creation returned None" + assert session.agent_session_id is not None, "Session ID should not be None" + assert session.status is not None, "Session status should not be None" + print(f"Session created (id: {session.agent_session_id}, status: {session.status})") + + try: + # Upload first file + print(f"Uploading session file: {data_file1} -> {remote_file_path1}") + await project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + file_path=data_file1, + remote_path=remote_file_path1, + ) + print(f"Successfully uploaded file to {remote_file_path1}") + + # Upload second file using content (bytes) instead of file_path + print(f"Uploading session file using content: {data_file2} -> {remote_file_path2}") + with open(data_file2, "rb") as f: + file2_content = f.read() + await project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + content=file2_content, + remote_path=remote_file_path2, + ) + print(f"Successfully uploaded file to {remote_file_path2}") + + # List session files and verify uploaded files are present + print("Listing session files at path '/remote'...") + files_list = [] + async for entry in project_client.agents.list_session_files( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path="/remote", + ): + files_list.append(entry) + + assert len(files_list) >= 2, f"Expected at least 2 files, got {len(files_list)}" + + # Verify file entries + file_names = [entry.name for entry in files_list] + print(f"Files found: {file_names}") + assert "data_file1.txt" in file_names, "data_file1.txt not found in listed files" + assert "data_file2.txt" in file_names, "data_file2.txt not found in listed files" + + # Verify file properties + for entry in files_list: + print(f" - name={entry.name}, size={entry.size}, is_directory={entry.is_directory}") + assert entry.name is not None, "File name should not be None" + assert entry.size is not None, "File size should not be None" + assert entry.is_directory is not None, "is_directory should not be None" + + # Download and verify content of first file + print(f"Downloading and verifying content from '{remote_file_path1}'") + content_chunks = [] + download_iterator = await project_client.agents.download_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path1, + ) + async for chunk in download_iterator: + content_chunks.append(chunk) + content_bytes = b"".join(content_chunks) + + assert content_bytes is not None, "Downloaded content should not be None" + assert len(content_bytes) > 0, "Downloaded content should not be empty" + + file_content = content_bytes.decode("utf-8", errors="replace") + print(f"Downloaded content: {file_content.strip()}") + + # Verify content matches expected + expected_content = "This is sample file 1" + assert expected_content in file_content, f"Expected content '{expected_content}' not found in downloaded file" + print("Content verification passed!") + + # Delete first file + print(f"Deleting session file at path: {remote_file_path1}...") + await project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path1, + ) + print(f"Successfully deleted {remote_file_path1}") + + # Delete second file + print(f"Deleting session file at path: {remote_file_path2}...") + await project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path2, + ) + print(f"Successfully deleted {remote_file_path2}") + + print("All session file CRUD operations completed successfully!") + + finally: + # Clean up: delete the session + await project_client.agents.delete_session( + agent_name=agent_name, + session_id=session.agent_session_id, + ) + print(f"Session deleted (id: {session.agent_session_id})") diff --git a/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file1.txt b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file1.txt new file mode 100644 index 000000000000..e129759a15ff --- /dev/null +++ b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file1.txt @@ -0,0 +1 @@ +This is sample file 1 diff --git a/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file2.txt b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file2.txt new file mode 100644 index 000000000000..3dd74cdfc9eb --- /dev/null +++ b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file2.txt @@ -0,0 +1 @@ +This is sample file 2 From b7d6b0b0aa4bd340ecba85948d591a1a2f45eecf Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Mon, 22 Jun 2026 11:59:59 -0700 Subject: [PATCH 8/8] Update test --- .../sessions/test_agent_session_files_crud.py | 38 +++++++++++++++---- .../test_agent_session_files_crud_async.py | 38 +++++++++++++++---- .../tests/test_data/sessions/data_file3.txt | 1 + 3 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file3.txt diff --git a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py index 427dd048c2c1..58061ef1bd12 100644 --- a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py +++ b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud.py @@ -5,6 +5,7 @@ # ------------------------------------ # cSpell:disable import os +from pathlib import Path from test_base import TestBase, servicePreparer from devtools_testutils import recorded_by_proxy from azure.ai.projects.models import VersionRefIndicator @@ -69,12 +70,15 @@ def test_agent_session_files_crud(self, **kwargs): test_data_folder = os.path.join(test_dir, "..", "test_data", "sessions") data_file1 = os.path.join(test_data_folder, "data_file1.txt") data_file2 = os.path.join(test_data_folder, "data_file2.txt") + data_file3 = os.path.join(test_data_folder, "data_file3.txt") remote_file_path1 = "/remote/data_file1.txt" remote_file_path2 = "/remote/data_file2.txt" + remote_file_path3 = "/remote/data_file3.txt" # Verify test data files exist assert os.path.exists(data_file1), f"Test data file not found: {data_file1}" assert os.path.exists(data_file2), f"Test data file not found: {data_file2}" + assert os.path.exists(data_file3), f"Test data file not found: {data_file3}" # Get the latest active agent version agent = self._get_latest_active_agent_version(project_client, agent_name) @@ -93,7 +97,7 @@ def test_agent_session_files_crud(self, **kwargs): print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: - # Upload first file + # Upload first file using file_path (str) print(f"Uploading session file: {data_file1} -> {remote_file_path1}") project_client.agents.upload_session_file( agent_name=agent_name, @@ -103,18 +107,28 @@ def test_agent_session_files_crud(self, **kwargs): ) print(f"Successfully uploaded file to {remote_file_path1}") - # Upload second file using content (bytes) instead of file_path - print(f"Uploading session file using content: {data_file2} -> {remote_file_path2}") - with open(data_file2, "rb") as f: - file2_content = f.read() + # Upload second file using file_path (PathLike[str]) + print(f"Uploading session file using PathLike: {data_file2} -> {remote_file_path2}") project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content=file2_content, + file_path=Path(data_file2), remote_path=remote_file_path2, ) print(f"Successfully uploaded file to {remote_file_path2}") + # Upload third file using content (bytes) + print(f"Uploading session file using content: {data_file3} -> {remote_file_path3}") + with open(data_file3, "rb") as f: + file3_content = f.read() + project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + content=file3_content, + remote_path=remote_file_path3, + ) + print(f"Successfully uploaded file to {remote_file_path3}") + # List session files and verify uploaded files are present print("Listing session files at path '/remote'...") files = project_client.agents.list_session_files( @@ -125,13 +139,14 @@ def test_agent_session_files_crud(self, **kwargs): # Convert to list for verification files_list = list(files) - assert len(files_list) >= 2, f"Expected at least 2 files, got {len(files_list)}" + assert len(files_list) >= 3, f"Expected at least 3 files, got {len(files_list)}" # Verify file entries file_names = [entry.name for entry in files_list] print(f"Files found: {file_names}") assert "data_file1.txt" in file_names, "data_file1.txt not found in listed files" assert "data_file2.txt" in file_names, "data_file2.txt not found in listed files" + assert "data_file3.txt" in file_names, "data_file3.txt not found in listed files" # Verify file properties for entry in files_list: @@ -178,6 +193,15 @@ def test_agent_session_files_crud(self, **kwargs): ) print(f"Successfully deleted {remote_file_path2}") + # Delete third file + print(f"Deleting session file at path: {remote_file_path3}...") + project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path3, + ) + print(f"Successfully deleted {remote_file_path3}") + print("All session file CRUD operations completed successfully!") finally: diff --git a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py index 1d1efdafbf64..a906ec27b19f 100644 --- a/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py +++ b/sdk/ai/azure-ai-projects/tests/sessions/test_agent_session_files_crud_async.py @@ -5,6 +5,7 @@ # ------------------------------------ # cSpell:disable import os +from pathlib import Path from test_base import TestBase, servicePreparer from devtools_testutils.aio import recorded_by_proxy_async from azure.ai.projects.models import VersionRefIndicator @@ -69,12 +70,15 @@ async def test_agent_session_files_crud_async(self, **kwargs): test_data_folder = os.path.join(test_dir, "..", "test_data", "sessions") data_file1 = os.path.join(test_data_folder, "data_file1.txt") data_file2 = os.path.join(test_data_folder, "data_file2.txt") + data_file3 = os.path.join(test_data_folder, "data_file3.txt") remote_file_path1 = "/remote/data_file1.txt" remote_file_path2 = "/remote/data_file2.txt" + remote_file_path3 = "/remote/data_file3.txt" # Verify test data files exist assert os.path.exists(data_file1), f"Test data file not found: {data_file1}" assert os.path.exists(data_file2), f"Test data file not found: {data_file2}" + assert os.path.exists(data_file3), f"Test data file not found: {data_file3}" async with project_client: # Get the latest active agent version @@ -94,7 +98,7 @@ async def test_agent_session_files_crud_async(self, **kwargs): print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: - # Upload first file + # Upload first file using file_path (str) print(f"Uploading session file: {data_file1} -> {remote_file_path1}") await project_client.agents.upload_session_file( agent_name=agent_name, @@ -104,18 +108,28 @@ async def test_agent_session_files_crud_async(self, **kwargs): ) print(f"Successfully uploaded file to {remote_file_path1}") - # Upload second file using content (bytes) instead of file_path - print(f"Uploading session file using content: {data_file2} -> {remote_file_path2}") - with open(data_file2, "rb") as f: - file2_content = f.read() + # Upload second file using file_path (PathLike[str]) + print(f"Uploading session file using PathLike: {data_file2} -> {remote_file_path2}") await project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, - content=file2_content, + file_path=Path(data_file2), remote_path=remote_file_path2, ) print(f"Successfully uploaded file to {remote_file_path2}") + # Upload third file using content (bytes) + print(f"Uploading session file using content: {data_file3} -> {remote_file_path3}") + with open(data_file3, "rb") as f: + file3_content = f.read() + await project_client.agents.upload_session_file( + agent_name=agent_name, + session_id=session.agent_session_id, + content=file3_content, + remote_path=remote_file_path3, + ) + print(f"Successfully uploaded file to {remote_file_path3}") + # List session files and verify uploaded files are present print("Listing session files at path '/remote'...") files_list = [] @@ -126,13 +140,14 @@ async def test_agent_session_files_crud_async(self, **kwargs): ): files_list.append(entry) - assert len(files_list) >= 2, f"Expected at least 2 files, got {len(files_list)}" + assert len(files_list) >= 3, f"Expected at least 3 files, got {len(files_list)}" # Verify file entries file_names = [entry.name for entry in files_list] print(f"Files found: {file_names}") assert "data_file1.txt" in file_names, "data_file1.txt not found in listed files" assert "data_file2.txt" in file_names, "data_file2.txt not found in listed files" + assert "data_file3.txt" in file_names, "data_file3.txt not found in listed files" # Verify file properties for entry in files_list: @@ -182,6 +197,15 @@ async def test_agent_session_files_crud_async(self, **kwargs): ) print(f"Successfully deleted {remote_file_path2}") + # Delete third file + print(f"Deleting session file at path: {remote_file_path3}...") + await project_client.agents.delete_session_file( + agent_name=agent_name, + agent_session_id=session.agent_session_id, + remote_path=remote_file_path3, + ) + print(f"Successfully deleted {remote_file_path3}") + print("All session file CRUD operations completed successfully!") finally: diff --git a/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file3.txt b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file3.txt new file mode 100644 index 000000000000..dde35c02f5a4 --- /dev/null +++ b/sdk/ai/azure-ai-projects/tests/test_data/sessions/data_file3.txt @@ -0,0 +1 @@ +This is sample file 3