Skip to content

Commit 5a35bad

Browse files
authored
[azure-ai-projects] Emit SDK from TypeSpec, including new enable/disable Agent methods (#47560)
1 parent 48b908b commit 5a35bad

16 files changed

Lines changed: 635 additions & 105 deletions

File tree

sdk/ai/azure-ai-projects/.env.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ SHAREPOINT_USER_INPUT=
4646
FABRIC_USER_INPUT=
4747
BING_CUSTOM_USER_INPUT=
4848
A2A_USER_INPUT=
49+
WORK_IQ_PROJECT_CONNECTION_ID=
50+
WORK_IQ_USER_INPUT=
4951

5052
#######################################################################
5153
#

sdk/ai/azure-ai-projects/.github/skills/azure-ai-projects-emit-from-typespec/SKILL.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,9 @@ git push -u origin <topic-branch>
117117

118118
## Step 7: Run post-emitter fixes
119119

120-
After a successful emit, run the post-emitter fix script located in the `sdk/ai/azure-ai-projects` folder:
120+
After a successful emit, run the PowerShell script named `PostEmitter.ps1` located in the `sdk/ai/azure-ai-projects` folder.
121121

122-
```
123-
post-emitter-fixes.cmd
124-
```
125-
126-
This script applies azure-ai-projects-specific corrections to the emitted code (restores `pyproject.toml`, fixes enum names, patches Sphinx doc-string issues, and runs `black` formatting).
122+
This script applies azure-ai-projects specific corrections to the emitted code (restores `pyproject.toml`, fixes enum names, patches Sphinx doc-string issues, and runs `black` formatting).
127123

128124
**If the script fails**, stop and report the error to the user. Do not continue. Do not attempt to analyze the script failures and fix them with Copilot. The script should be fixed by the engineering team if it is not working.
129125

@@ -174,7 +170,20 @@ In the folder `sdk\ai\azure-ai-projects`, run `pip install -e .` to install the
174170

175171
---
176172

177-
## Step 12: Commit and push
173+
## Step 12: Run `apiview-stub-generator` to update api.md and api.metadata.yml files
174+
175+
In the root of the `azure-sdk-for-python` folder run the following commands
176+
177+
```
178+
azpysdk apistub --md --extract-metadata azure-ai-projects --dest-dir .
179+
```
180+
181+
This will update the `api.md` and `api.metadata.yml` files under in the package folder `sdk\ai\azure-ai-projects`. Now change directory
182+
back to the package folder.
183+
184+
---
185+
186+
## Step 13: Commit and push
178187

179188
Stage all changes (excluding file names that start with `.env`), commit, and push the topic branch:
180189

@@ -188,7 +197,7 @@ git push -u origin <topic-branch>
188197

189198
---
190199

191-
## Step 13: Create a Pull Request
200+
## Step 14: Create a Pull Request
192201

193202
Create a draft PR from the **topic branch** to the **base branch** (recorded in Step 2):
194203

@@ -205,7 +214,7 @@ Open a new tab in the default browser and navigate to the PR URL.
205214

206215
---
207216

208-
## Step 14: Optionally run tests locally
217+
## Step 15: Optionally run tests locally
209218

210219
Prompt the user with this message: "Tests will run as part of the Pull Request. However, you can optionally run tests locally in a Python virtual environment, right now. It will take a few minutes. Do you want to run tests locally? (yes/no)"
211220

sdk/ai/azure-ai-projects/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
### Features Added
66

7-
* Hosted agents are now stable. There is need to set `allow_preview=True` on the `AIProjectClient` constructor to create a Hosted agent.
7+
* Two new methods `enable` and `disable` on the `.agents` subclient.
8+
* Hosted agents are now stable. There is no need to set `allow_preview=True` on the `AIProjectClient` constructor to create a Hosted agent.
89
* Toolboxes operations are now stable. The have moved from `.beta.toolboxes` subclient to the `.toolboxes` subclient.
910
* Session and Session files operations are now stable. They have moved from the `.beta.agents` subclient to the `.agents` subclient.
1011
* Agent code operations are now stable. This includes `create_version_from_code` and `download_code`. They have moved from the `.beta.agents` subclient to the `.agents` subclient.

sdk/ai/azure-ai-projects/api.md

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ namespace azure.ai.projects.aio.operations
250250
**kwargs: Any
251251
) -> DeleteAgentVersionResponse: ...
252252

253+
@distributed_trace_async
254+
async def disable(
255+
self,
256+
agent_name: str,
257+
**kwargs: Any
258+
) -> None: ...
259+
253260
@distributed_trace_async
254261
async def download_code(
255262
self,
@@ -270,6 +277,13 @@ namespace azure.ai.projects.aio.operations
270277
**kwargs: Any
271278
) -> AsyncIterator[bytes]: ...
272279

280+
@distributed_trace_async
281+
async def enable(
282+
self,
283+
agent_name: str,
284+
**kwargs: Any
285+
) -> None: ...
286+
273287
@distributed_trace_async
274288
async def get(
275289
self,
@@ -2504,6 +2518,7 @@ namespace azure.ai.projects.models
25042518
instance_identity: Optional[AgentIdentity]
25052519
name: str
25062520
object: Literal[AgentObjectType.AGENT]
2521+
state: Union[str, AgentState]
25072522
versions: AgentObjectVersions
25082523

25092524
@overload
@@ -2674,6 +2689,11 @@ namespace azure.ai.projects.models
26742689
UPDATING = "updating"
26752690

26762691

2692+
class azure.ai.projects.models.AgentState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2693+
DISABLED = "disabled"
2694+
ENABLED = "enabled"
2695+
2696+
26772697
class azure.ai.projects.models.AgentTaxonomyInput(EvaluationTaxonomyInput, discriminator='agent'):
26782698
risk_categories: list[Union[str, RiskCategory]]
26792699
target: EvaluationTarget
@@ -6599,7 +6619,6 @@ namespace azure.ai.projects.models
65996619
lora_config: Optional[LoraConfig]
66006620
name: str
66016621
source: Optional[ModelSourceData]
6602-
system_data: Optional[SystemDataV3]
66036622
tags: Optional[dict[str, str]]
66046623
version: str
66056624
warnings: Optional[list[FoundryModelWarning]]
@@ -7474,6 +7493,25 @@ namespace azure.ai.projects.models
74747493
def __init__(self, mapping: Mapping[str, Any]) -> None: ...
74757494

74767495

7496+
class azure.ai.projects.models.ReminderPreviewTool(Tool, discriminator='reminder_preview'):
7497+
description: Optional[str]
7498+
name: Optional[str]
7499+
tool_configs: Optional[dict[str, ToolConfig]]
7500+
type: Literal[ToolType.REMINDER_PREVIEW]
7501+
7502+
@overload
7503+
def __init__(
7504+
self,
7505+
*,
7506+
description: Optional[str] = ...,
7507+
name: Optional[str] = ...,
7508+
tool_configs: Optional[dict[str, ToolConfig]] = ...
7509+
) -> None: ...
7510+
7511+
@overload
7512+
def __init__(self, mapping: Mapping[str, Any]) -> None: ...
7513+
7514+
74777515
class azure.ai.projects.models.ResponseRetrievalItemGenerationParams(TypedDict, total=False):
74787516
key "data_mapping": Required[Dict[str, str]]
74797517
key "max_num_turns": int
@@ -8087,26 +8125,6 @@ namespace azure.ai.projects.models
80878125
def __init__(self, mapping: Mapping[str, Any]) -> None: ...
80888126

80898127

8090-
class azure.ai.projects.models.SystemDataV3(_Model):
8091-
created_at: Optional[datetime]
8092-
created_by: Optional[str]
8093-
created_by_type: Optional[str]
8094-
last_modified_at: Optional[datetime]
8095-
8096-
@overload
8097-
def __init__(
8098-
self,
8099-
*,
8100-
created_at: Optional[datetime] = ...,
8101-
created_by: Optional[str] = ...,
8102-
created_by_type: Optional[str] = ...,
8103-
last_modified_at: Optional[datetime] = ...
8104-
) -> None: ...
8105-
8106-
@overload
8107-
def __init__(self, mapping: Mapping[str, Any]) -> None: ...
8108-
8109-
81108128
class azure.ai.projects.models.TargetCompletionEvalRunDataSource(TypedDict, total=False):
81118129
key "input_messages": Required[InputMessagesItemReference]
81128130
key "source": Required[Union[SourceFileContent, SourceFileID]]
@@ -8597,6 +8615,7 @@ namespace azure.ai.projects.models
85978615
MEMORY_SEARCH_PREVIEW = "memory_search_preview"
85988616
NAMESPACE = "namespace"
85998617
OPENAPI = "openapi"
8618+
REMINDER_PREVIEW = "reminder_preview"
86008619
SHAREPOINT_GROUNDING_PREVIEW = "sharepoint_grounding_preview"
86018620
SHELL = "shell"
86028621
TOOLBOX_SEARCH_PREVIEW = "toolbox_search_preview"
@@ -9297,6 +9316,13 @@ namespace azure.ai.projects.operations
92979316
**kwargs: Any
92989317
) -> DeleteAgentVersionResponse: ...
92999318

9319+
@distributed_trace
9320+
def disable(
9321+
self,
9322+
agent_name: str,
9323+
**kwargs: Any
9324+
) -> None: ...
9325+
93009326
@distributed_trace
93019327
def download_code(
93029328
self,
@@ -9317,6 +9343,13 @@ namespace azure.ai.projects.operations
93179343
**kwargs: Any
93189344
) -> Iterator[bytes]: ...
93199345

9346+
@distributed_trace
9347+
def enable(
9348+
self,
9349+
agent_name: str,
9350+
**kwargs: Any
9351+
) -> None: ...
9352+
93209353
@distributed_trace
93219354
def get(
93229355
self,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
apiMdSha256: 2515589fc688e1a9369aadfd0922bb686ddc1081f2fc8e4ebbd4241238336162
1+
apiMdSha256: b60afd274d28a27c40d16bedb18fe1688ea2b4013d226a5ebc12d01d649b7221
22
parserVersion: 0.3.28
33
pythonVersion: 3.14.3

sdk/ai/azure-ai-projects/apiview-properties.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"azure.ai.projects.models.Reasoning": "OpenAI.Reasoning",
268268
"azure.ai.projects.models.RecurrenceTrigger": "Azure.AI.Projects.RecurrenceTrigger",
269269
"azure.ai.projects.models.RedTeam": "Azure.AI.Projects.RedTeam",
270+
"azure.ai.projects.models.ReminderPreviewTool": "Azure.AI.Projects.ReminderPreviewTool",
270271
"azure.ai.projects.models.ResponseUsageInputTokensDetails": "OpenAI.ResponseUsageInputTokensDetails",
271272
"azure.ai.projects.models.ResponseUsageOutputTokensDetails": "OpenAI.ResponseUsageOutputTokensDetails",
272273
"azure.ai.projects.models.Routine": "Azure.AI.Projects.Routine",
@@ -291,7 +292,6 @@
291292
"azure.ai.projects.models.SpecificFunctionShellParam": "OpenAI.SpecificFunctionShellParam",
292293
"azure.ai.projects.models.StructuredInputDefinition": "Azure.AI.Projects.StructuredInputDefinition",
293294
"azure.ai.projects.models.StructuredOutputDefinition": "Azure.AI.Projects.StructuredOutputDefinition",
294-
"azure.ai.projects.models.SystemDataV3": "Azure.AI.Projects.SystemDataV3",
295295
"azure.ai.projects.models.TaxonomyCategory": "Azure.AI.Projects.TaxonomyCategory",
296296
"azure.ai.projects.models.TaxonomySubCategory": "Azure.AI.Projects.TaxonomySubCategory",
297297
"azure.ai.projects.models.TelemetryConfig": "Azure.AI.Projects.TelemetryConfig",
@@ -400,6 +400,7 @@
400400
"azure.ai.projects.models.DataGenerationJobOutputType": "Azure.AI.Projects.DataGenerationJobOutputType",
401401
"azure.ai.projects.models.OptimizationDatasetInputType": "Azure.AI.Projects.OptimizationDatasetInputType",
402402
"azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType",
403+
"azure.ai.projects.models.AgentState": "Azure.AI.Projects.AgentState",
403404
"azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind",
404405
"azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol",
405406
"azure.ai.projects.models.CodeDependencyResolution": "Azure.AI.Projects.CodeDependencyResolution",
@@ -448,6 +449,10 @@
448449
"azure.ai.projects.aio.operations.AgentsOperations.create_version_from_code": "Azure.AI.Projects.Agents.createAgentVersionFromCode",
449450
"azure.ai.projects.operations.AgentsOperations.download_code": "Azure.AI.Projects.Agents.downloadAgentCode",
450451
"azure.ai.projects.aio.operations.AgentsOperations.download_code": "Azure.AI.Projects.Agents.downloadAgentCode",
452+
"azure.ai.projects.operations.AgentsOperations.enable": "Azure.AI.Projects.Agents.enableAgent",
453+
"azure.ai.projects.aio.operations.AgentsOperations.enable": "Azure.AI.Projects.Agents.enableAgent",
454+
"azure.ai.projects.operations.AgentsOperations.disable": "Azure.AI.Projects.Agents.disableAgent",
455+
"azure.ai.projects.aio.operations.AgentsOperations.disable": "Azure.AI.Projects.Agents.disableAgent",
451456
"azure.ai.projects.operations.AgentsOperations.create_session": "Azure.AI.Projects.Agents.createSession",
452457
"azure.ai.projects.aio.operations.AgentsOperations.create_session": "Azure.AI.Projects.Agents.createSession",
453458
"azure.ai.projects.operations.AgentsOperations.get_session": "Azure.AI.Projects.Agents.getSession",
@@ -521,5 +526,5 @@
521526
"azure.ai.projects.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion",
522527
"azure.ai.projects.aio.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion"
523528
},
524-
"CrossLanguageVersion": "a252b3ce0280"
529+
"CrossLanguageVersion": "623ba64ba559"
525530
}

sdk/ai/azure-ai-projects/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/ai/azure-ai-projects",
5-
"Tag": "python/ai/azure-ai-projects_3ec4cc5f02"
5+
"Tag": "python/ai/azure-ai-projects_44980e76d0"
66
}

0 commit comments

Comments
 (0)