You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -155,29 +155,28 @@ The value of the **action_id** field in the agent definition manifest must match
155
155
156
156
Set the JSON file to **Copy to Output Directory** in your project properties:
157
157
158
-
-**For C# projects**: Right-click the JSON file in Solution Explorer, select **Properties**, and set **Copy to Output Directory** to **Copy if newer** or **Copy always**.
159
-
-**For C++ projects**: Add the following code to your project file:
158
+
***For C# projects**: Right-click the JSON file in Solution Explorer, select **Properties**, and set **Copy to Output Directory** to **Copy if newer** or **Copy always**.
159
+
***For C++ projects**: Add the following code to your project file:
Agent Launchers can register statically (at install time) or dynamically (at runtime). This section covers static registration.
171
170
172
-
The Package.appxmanifest file provides the details of the MSIX package for an app. If you followed the get started tutorial for app actions, you already added a [uap3:Extension](/uwp/schemas/appxpackage/uapmanifestschema/element-uap3-appextension-manual) element to register the action by setting the extension **Name** attribute to `com.microsoft.windows.ai.actions`. To register the action as an Agent Launcher, you need to add another app extension with the **Name** set to `com.microsoft.windows.ai.appAgent`. Under the **Properties** element of the app extension element, you must provide a **Registration** element that specifies the location of your agent definition JSON file.
171
+
The Package.appxmanifest file provides the details of the MSIX package for an app. If you followed the get started tutorial for app actions, you already added a [uap3:Extension](/uwp/schemas/appxpackage/uapmanifestschema/element-uap3-appextension-manual) element to register the action by setting the extension **Name** attribute to `com.microsoft.windows.ai.actions`. To register the action as an Agent Launcher, you need to add another app extension with the **Name** set to `com.microsoft.windows.ai.agentInfo`. Under the **Properties** element of the app extension element, you must provide a **Registration** element that specifies the location of your agent definition JSON file.
173
172
174
173
> [!NOTE]
175
174
> Each statically registered Agent Launcher should have its own AppExtension entry.
176
175
177
176
```xml
178
177
<uap3:ExtensionCategory="windows.appExtension">
179
178
<uap3:AppExtension
180
-
Name="com.microsoft.windows.ai.appAgent"
179
+
Name="com.microsoft.windows.ai.agentInfo"
181
180
Id="ZavaAgent"
182
181
DisplayName="Zava Agent"
183
182
PublicFolder="Assets">
@@ -188,14 +187,13 @@ The Package.appxmanifest file provides the details of the MSIX package for an ap
188
187
</uap3:Extension>
189
188
```
190
189
191
-
192
190
## Dynamic registration via On Device Registry (ODR)
193
191
194
192
In addition to static registration, you can register Agent Launchers dynamically at runtime by using the Windows On Device Registry (ODR). This method is useful when you need to add or remove agents based on application logic.
195
193
196
194
### Add an Agent Launcher dynamically
197
195
198
-
Use the `odr add-app-agent` command to register an Agent Launcher dynamically. This command takes the path to your agent registration JSON file.
196
+
Use the `odr agent-info add` command to register an Agent Launcher dynamically. This command takes the path to your agent registration JSON file.
199
197
200
198
```csharp
201
199
usingSystem.Diagnostics;
@@ -204,7 +202,7 @@ using System.Diagnostics;
204
202
ProcessStartInfostartInfo=newProcessStartInfo
205
203
{
206
204
FileName="odr.exe",
207
-
Arguments=$"add-app-agent \"<path to agentDefinition.json>\"",
205
+
Arguments=$"agent-info add\"<path to agentDefinition.json>\"",
208
206
UseShellExecute=false,
209
207
RedirectStandardOutput=true,
210
208
RedirectStandardError=true,
@@ -226,24 +224,14 @@ The command returns a JSON response with the following structure:
Use the `odr remove-app-agent` command to remove a dynamically registered Agent Launcher. You can only remove agents that the same package adds dynamically.
234
+
Use the `odr agent-info remove` command to remove a dynamically registered Agent Launcher. You can only remove agents that the same package adds dynamically.
Arguments=$"agent-info remove \"<path to agentDefinition.json>\"",
256
244
UseShellExecute=false,
257
245
RedirectStandardOutput=true,
258
246
RedirectStandardError=true,
@@ -274,20 +262,19 @@ The command returns:
274
262
275
263
```json
276
264
{
277
-
"success": true,
278
-
"message": "Agent removed successfully"
265
+
"extended_error": 0
279
266
}
280
267
```
281
268
282
269
> [!IMPORTANT]
283
-
> Due to package identity requirements, you can't use `add-app-agent` and `remove-app-agent` from an unpackaged app. You must run these commands from within a packaged application that also contains the associated App Action.
270
+
> Due to package identity requirements, you can't use `agent-info add` and `agent-info remove` from an unpackaged app. You must run these commands from within a packaged application that also contains the associated App Action.
284
271
285
272
## List available Agent Launchers
286
273
287
-
To discover all registered Agent Launchers on the system, use the `odr list-app-agents` command. This command returns all Agent Launchers that you can invoke.
274
+
To discover all registered Agent Launchers on the system, use the `odr agent-info list` command. This command returns all Agent Launchers that you can invoke.
288
275
289
276
```powershell
290
-
odr list-app-agents
277
+
odr agent-info list
291
278
```
292
279
293
280
This command returns a JSON array of agent definitions:
@@ -311,13 +298,63 @@ This command returns a JSON array of agent definitions:
311
298
312
299
Use the `package_family_name` and `action_id` fields together to identify and invoke the associated App Action.
313
300
301
+
### Supply icon qualifiers
302
+
303
+
When querying for available Agent Launchers using `odr agent-info list`, you can supply one or more additional arguments to specify qualifiers for the icon resources that are returned in the command output. The following table lists the icon qualifiers that can be used when listing Agent Launchers.
| language | Specifies the user‑preferred language used to resolve localized resources, for example, "en-US". Only a single value can be specified. |
309
+
| scale | Indicates the display scale factor used to choose the correctly sized assets, for example, 100, 200, 400 |
310
+
| targetsize | Specifies the pixel side‑length for icons, for example, 16, 24. This is primarily used for file‑type or protocol icons. |
311
+
| theme | Determines app theme influence, for example, `light`, `dark`. The system automatically infers the theme value unless it is overridden by supplying this qualifier. |
312
+
313
+
You can specify multiple qualifiers in a call to `odr agent-info list`. You can supply multiple values for each qualifier by using a comma as a delimiter. If malformed qualifiers are present in the query, the system will make a best effort to return results based on the well-formed qualifiers. If the system can't resolve any icons, the returned icon list will be empty.
314
+
315
+
The following example demonstrates a call to `odr agent-info list`, specifying qualifiers for a single `scale` value and multiple `theme` values.
316
+
317
+
```powershell
318
+
odr agent-info list --theme dark,light --scale 200
319
+
```
320
+
321
+
This command returns he following JSON payload which includes the `icons` array of the available icons that match the specified icon qualifiers.
1. Call `odr list-app-agents` to get all available Agent Launchers.
355
+
1. Call `odr agent-info list` to get all available Agent Launchers.
319
356
1. Select the agent you want to invoke based on your application logic (for example, user interaction).
320
-
3. Use the Windows.AI.Actions APIs to invoke the agent's associated App Action
357
+
1. Use the Windows.AI.Actions APIs to invoke the agent's associated App Action
321
358
322
359
Here's an example of invoking an Agent Launcher by using the Windows.AI.Actions APIs:
323
360
@@ -366,28 +403,56 @@ After you verify the functionality of your App Action, test your Agent Launcher
366
403
367
404
1. Build and deploy your packaged application with the agent extension in the manifest.
368
405
1. Open a terminal and run:
406
+
369
407
```powershell
370
-
odr list-app-agents
408
+
odr agent-info list
371
409
```
410
+
372
411
1. Verify that your Agent Launcher appears in the output with the correct `package_family_name` and `action_id`.
373
412
374
413
### Test dynamic registration
375
414
376
-
1. Run the `odr add-app-agent` command from within your packaged application as shown in the dynamic registration section.
415
+
1. Run the `odr agent-info add` command from within your packaged application as shown in the dynamic registration section.
377
416
1. Check the command output to confirm successful registration.
378
417
1. Verify the registration by running:
418
+
379
419
```powershell
380
-
odr list-app-agents
420
+
odr agent-info list
381
421
```
422
+
382
423
1. Confirm your agent appears in the list.
383
-
1. Test removal by running the `odr remove-app-agent` command with your agent's ID.
384
-
1. Confirm removal by running `odr list-app-agents` again and verifying the agent no longer appears.
424
+
1. Test removal by running the `odr agent-info remove` command with your agent's ID.
425
+
1. Confirm removal by running `odr agent-info list` again and verifying the agent no longer appears.
385
426
386
427
### Test Agent Launcher invocation
387
428
388
429
After you register your Agent Launcher, test the end-to-end invocation:
389
430
390
-
1. Run `odr list-app-agents` to get your agent's `package_family_name` and `action_id` values.
431
+
1. Run `odr agent-info list` to get your agent's `package_family_name` and `action_id` values.
391
432
1. Use the App Action testing approach from the [Get started with App Actions](../app-actions/actions-get-started.md) article or the Action Test Tool to invoke your action with the required `agentName` and `prompt` inputs.
392
433
1. Verify that your app receives the inputs correctly and your agent logic executes as expected.
393
434
1. Test optional inputs like `attachedFile` if your action supports them.
435
+
436
+
## Handle errors
437
+
438
+
The success status of `odr agent-info` commands is returned in the JSON output in the `extended_error` field. A value of zero indicates success and a non-zero value is an extended error code that specifies the type of error that occurred. The `message` field contains a human-readable string describing the error. The `message` field is only included in the output for commands that are unsuccessful.
439
+
440
+
The following is the example output of a call to `odr agent-info remove` where the operation failed because the specified agent was not found.
441
+
442
+
```json
443
+
{
444
+
"extended_error": -2147023728,
445
+
"message": "E_NOTFOUND Agent not found: ZavaAgent_cw5n1h2txyewy_Zava.ZavaAgent"
446
+
}
447
+
```
448
+
449
+
Error codes that can be returned from `odr agent-info` commands include the following.
450
+
451
+
| Error code | Value | Description |
452
+
|------------|-------|-------------|
453
+
|S_OK|0x00000000|Success.|
454
+
| E_FAIL | 0x80004005 | Generic error. |
455
+
| E_INVALIDARG | 0x80070057 | Invalid argument. Examples include invalid JSON path being passed as input for registration or attempting to register an agent that is already registered. |
456
+
| E_ACCESSDENIED | 0x8007000 | Access denied. |
457
+
| E_NOTFOUND | 0x80070490 | Agent being unregistered is not in the registry. |
458
+
| E_ABORT | 0x80004004 | The call was canceled before the operation was completed. |
@@ -39,6 +40,7 @@ The table below describes the properties of the agent definition JSON file.
39
40
| name | string | A unique identifier for your agent, typically using reverse domain notation (e.g., "Zava.ZavaAgent"). This value is not localizable and must be unique within your package. | Yes |
40
41
| display_name | string | The user-facing display name for the agent. This value is localizable using the `ms-resource://` format to reference a string resource in your app package. | Yes |
41
42
| description | string | A user-facing description of what the agent does. This value is localizable using the `ms-resource://` format to reference a string resource in your app package. | Yes |
43
+
| placeholder_text | string | A user-facing text string for agent providers to offer users a reference query. This value is localizable using the `ms-resource://` format to reference a string resource in your app package. | No |
42
44
| icon | string | The icon for the agent. This value is localizable using the `ms-resource://` format to reference an icon resource deployed with your app package. | Yes |
43
45
| action_id | string | The identifier of the App Action that will handle invocations of this agent. This must match the `id` field of an action defined in the same app package. For information on creating the associated App Action, see [Get started with Agent Launchers on Windows](agents-get-started.md). | Yes |
44
46
@@ -64,7 +66,7 @@ To localize icon properties, use the following format:
64
66
"icon": "ms-resource://Files/Assets/iconName.png"
65
67
```
66
68
67
-
The path is relative to your package root and can reference different icons for different languages through your app's resource system.
69
+
The path is relative to your package root and can reference different icons for different languages through your app's resource system. Agents can provide multiple icons that automatically resolve based on the user’s context, such as theme (light/dark), high-contrast mode, target size and display scale. For information on naming conventions for icon resources, see [Load images and assets tailored for scale, theme, high contrast, and more](/windows/uwp/app-resources/images-tailored-for-scale-theme-contrast).
0 commit comments