Skip to content

Commit 16131c8

Browse files
Merge pull request #1137 from MicrosoftDocs/main
Auto Publish – main to live - 2026-03-16 21:18 UTC
2 parents a0c5124 + 224c4c9 commit 16131c8

2 files changed

Lines changed: 104 additions & 37 deletions

File tree

docs/agent-launchers/agents-get-started.md

Lines changed: 100 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,28 @@ The value of the **action_id** field in the agent definition manifest must match
155155

156156
Set the JSON file to **Copy to Output Directory** in your project properties:
157157

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:
160160

161161
```xml
162162
<Content Include="Assets\agentRegistration.json">
163163
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164164
</Content>
165165
```
166166

167-
168167
## Static registration via app package manifest
169168

170169
Agent Launchers can register statically (at install time) or dynamically (at runtime). This section covers static registration.
171170

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.
173172

174173
> [!NOTE]
175174
> Each statically registered Agent Launcher should have its own AppExtension entry.
176175
177176
```xml
178177
<uap3:Extension Category="windows.appExtension">
179178
<uap3:AppExtension
180-
Name="com.microsoft.windows.ai.appAgent"
179+
Name="com.microsoft.windows.ai.agentInfo"
181180
Id="ZavaAgent"
182181
DisplayName="Zava Agent"
183182
PublicFolder="Assets">
@@ -188,14 +187,13 @@ The Package.appxmanifest file provides the details of the MSIX package for an ap
188187
</uap3:Extension>
189188
```
190189

191-
192190
## Dynamic registration via On Device Registry (ODR)
193191

194192
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.
195193

196194
### Add an Agent Launcher dynamically
197195

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.
199197

200198
```csharp
201199
using System.Diagnostics;
@@ -204,7 +202,7 @@ using System.Diagnostics;
204202
ProcessStartInfo startInfo = new ProcessStartInfo
205203
{
206204
FileName = "odr.exe",
207-
Arguments = $"add-app-agent \"<path to agentDefinition.json>\"",
205+
Arguments = $"agent-info add \"<path to agentDefinition.json>\"",
208206
UseShellExecute = false,
209207
RedirectStandardOutput = true,
210208
RedirectStandardError = true,
@@ -226,24 +224,14 @@ The command returns a JSON response with the following structure:
226224

227225
```json
228226
{
229-
"success": true,
230-
"agent": {
231-
"id": "ZavaAgent_cw5n1h2txyewy_Zava.ZavaAgent",
232-
"version": "1.0.0",
233-
"name": "Zava.ZavaAgent",
234-
"display_name": "Zava Agent",
235-
"description": "Description for Zava agent.",
236-
"icon": "C://pathToZavaIcon.png",
237-
"package_family_name": "ZavaPackageFamilyName",
238-
"action_id": "ZavaAgentAction"
239-
},
240-
"message": "Agent registered successfully"
227+
"agent_id": "ZavaAgent_cw5n1h2txyewy_Zava.ZavaAgent",
228+
"extended_error": 0
241229
}
242230
```
243231

244232
### Remove an Agent Launcher dynamically
245233

246-
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.
247235

248236
```csharp
249237
using System.Diagnostics;
@@ -252,7 +240,7 @@ using System.Diagnostics;
252240
ProcessStartInfo startInfo = new ProcessStartInfo
253241
{
254242
FileName = "odr.exe",
255-
Arguments = $"remove-app-agent \"ZavaAgent_cw5n1h2txyewy_Zava.ZavaAgent\"",
243+
Arguments = $"agent-info remove \"<path to agentDefinition.json>\"",
256244
UseShellExecute = false,
257245
RedirectStandardOutput = true,
258246
RedirectStandardError = true,
@@ -274,20 +262,19 @@ The command returns:
274262

275263
```json
276264
{
277-
"success": true,
278-
"message": "Agent removed successfully"
265+
"extended_error": 0
279266
}
280267
```
281268

282269
> [!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.
284271
285272
## List available Agent Launchers
286273

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.
288275

289276
```powershell
290-
odr list-app-agents
277+
odr agent-info list
291278
```
292279

293280
This command returns a JSON array of agent definitions:
@@ -311,13 +298,63 @@ This command returns a JSON array of agent definitions:
311298

312299
Use the `package_family_name` and `action_id` fields together to identify and invoke the associated App Action.
313300

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.
304+
305+
| Qualifiers | Description |
306+
|------------|-------------|
307+
| contrast | Controls high‑contrast mode selection. Valid values: `standard`, `high`, `black`, `white` |
308+
| 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.
322+
323+
```json
324+
{
325+
"agents": [
326+
{
327+
"id": "ZavaAgent_cw5n1h2txyewy_Zava.ZavaAgent",
328+
"version": "1.0.0",
329+
"name": "Zava.ZavaAgent",
330+
"display_name": "Zava Agent",
331+
"description": "Description for Zava agent.",
332+
"package_family_name": "ZavaPackageFamilyName",
333+
"action_id": "ZavaAgentAction",
334+
"icons": [
335+
{
336+
"src": "C:\\Users\\[user name]\\AppData\\Local\\ZavaAgent\\Assets\\AgentIcon.scale-200_theme-dark.png",
337+
"theme": "dark",
338+
"scale": "200"
339+
},
340+
{
341+
"src": "C:\\Users\\[user name]\\AppData\\Local\\ZavaAgent\\Assets\\AgentIcon.scale-200_theme-light.png",
342+
"theme": "light",
343+
"scale": "200"
344+
}
345+
]
346+
}
347+
]
348+
}
349+
```
350+
314351
## Invoke an Agent Launcher
315352

316353
To invoke an Agent Launcher, follow these steps:
317354

318-
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.
319356
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
321358

322359
Here's an example of invoking an Agent Launcher by using the Windows.AI.Actions APIs:
323360

@@ -366,28 +403,56 @@ After you verify the functionality of your App Action, test your Agent Launcher
366403

367404
1. Build and deploy your packaged application with the agent extension in the manifest.
368405
1. Open a terminal and run:
406+
369407
```powershell
370-
odr list-app-agents
408+
odr agent-info list
371409
```
410+
372411
1. Verify that your Agent Launcher appears in the output with the correct `package_family_name` and `action_id`.
373412

374413
### Test dynamic registration
375414

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.
377416
1. Check the command output to confirm successful registration.
378417
1. Verify the registration by running:
418+
379419
```powershell
380-
odr list-app-agents
420+
odr agent-info list
381421
```
422+
382423
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.
385426

386427
### Test Agent Launcher invocation
387428

388429
After you register your Agent Launcher, test the end-to-end invocation:
389430

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.
391432
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.
392433
1. Verify that your app receives the inputs correctly and your agent logic executes as expected.
393434
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. |

docs/agent-launchers/agents-json.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ An Agent Launcher registration links an agent to an App Action that handles the
2020
"version": "1.0.0",
2121
"name": "Zava.ZavaAgent",
2222
"display_name": "ms-resource://zavaAgentDisplayName",
23-
"description": "ms-resource://zavaAgentDescription",
23+
"description": "ms-resource://zavaAgentDescription",
24+
"placeholder_text": "ms-resource://zavaAgentPlaceHolderText",
2425
"icon": "ms-resource://Files/Assets/ZavaLogo.png",
2526
"action_id": "ZavaAgentAction"
2627
}
@@ -39,6 +40,7 @@ The table below describes the properties of the agent definition JSON file.
3940
| 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 |
4041
| 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 |
4142
| 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 |
4244
| 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 |
4345
| 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 |
4446

@@ -64,7 +66,7 @@ To localize icon properties, use the following format:
6466
"icon": "ms-resource://Files/Assets/iconName.png"
6567
```
6668

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).
6870

6971
## Relationship to App Actions
7072

0 commit comments

Comments
 (0)