@@ -4,20 +4,15 @@ This sample demonstrates how to create a minimal API application that uses the `
44
55## Overview
66
7- The sample creates a minimal ASP.NET Core web API with:
7+ The sample creates an absolutely minimal ASP.NET Core web API with:
88- Multiple AI agents registered with custom metadata
9- - An ` /agents ` endpoint that returns a JSON list of all agents
10- - Custom additional properties for each agent (icon URL, beta status, visibility)
9+ - An ` /agents ` endpoint that returns a JSON array of all agents with their names and additional properties
1110
1211## Features
1312
1413- ** AgentCatalog Integration** : Uses the ` AgentCatalog ` to enumerate all registered agents
15- - ** Custom Metadata** : Each agent includes additional properties:
16- - ` icon ` : A URL pointing to the agent's icon
17- - ` beta ` : A boolean indicating if the agent is in beta
18- - ` visibility ` : An enum (` Visible ` or ` Unlisted ` ) indicating the agent's visibility
19- - ** RESTful API** : Exposes a GET ` /agents ` endpoint that returns agent information as JSON
20- - ** OpenAPI/Swagger** : Includes OpenAPI documentation for easy API exploration
14+ - ** Custom Metadata** : Each agent includes additional properties stored in ` AdditionalProperties ` dictionary
15+ - ** Simple API** : Returns anonymous objects with agent name and properties - clients can handle the data as needed
2116
2217## Prerequisites
2318
@@ -46,12 +41,7 @@ export AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini"
4641 dotnet run
4742 ```
4843
49- 3 . Open a browser and navigate to the OpenAPI documentation:
50- ```
51- http://localhost:5000/openapi/v1.json
52- ```
53-
54- 4 . Test the ` /agents ` endpoint:
44+ 3 . Test the ` /agents ` endpoint:
5545 ``` bash
5646 curl http://localhost:5000/agents
5747 ```
@@ -62,21 +52,27 @@ export AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini"
6252[
6353 {
6454 "name" : " weather-agent" ,
65- "icon" : " https://example.com/icons/weather.png" ,
66- "beta" : false ,
67- "visibility" : " Visible"
55+ "properties" : {
56+ "icon" : " https://example.com/icons/weather.png" ,
57+ "beta" : false ,
58+ "visibility" : " Visible"
59+ }
6860 },
6961 {
7062 "name" : " travel-agent" ,
71- "icon" : " https://example.com/icons/travel.png" ,
72- "beta" : true ,
73- "visibility" : " Visible"
63+ "properties" : {
64+ "icon" : " https://example.com/icons/travel.png" ,
65+ "beta" : true ,
66+ "visibility" : " Visible"
67+ }
7468 },
7569 {
7670 "name" : " experimental-agent" ,
77- "icon" : " https://example.com/icons/experimental.png" ,
78- "beta" : true ,
79- "visibility" : " Unlisted"
71+ "properties" : {
72+ "icon" : " https://example.com/icons/experimental.png" ,
73+ "beta" : true ,
74+ "visibility" : " Unlisted"
75+ }
8076 }
8177]
8278```
@@ -87,8 +83,7 @@ The sample demonstrates:
8783
88841 . ** Agent Registration** : Multiple agents are registered using ` builder.AddAIAgent() ` with custom additional properties
89852 . ** AgentCatalog Usage** : The ` AgentCatalog ` service is injected into the endpoint handler
90- 3 . ** Metadata Extraction** : Additional properties are extracted from each agent and mapped to a response model
91- 4 . ** Type Safety** : Uses strongly-typed classes and enums for the API response
86+ 3 . ** Simple Response** : Returns anonymous objects with ` name ` and ` properties ` - clients handle parsing as needed
9287
9388## Key Concepts
9489
0 commit comments