|
| 1 | +# Example: Nested Catalogs |
| 2 | + |
| 3 | +This example shows how an enterprise organizes a large artifact inventory using nested catalogs. The root catalog provides an overview; each department maintains its own sub-catalog. |
| 4 | + |
| 5 | +## Root catalog |
| 6 | + |
| 7 | +The root catalog is served at `/.well-known/ai-catalog.json`: |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "specVersion": "1.0", |
| 12 | + "host": { |
| 13 | + "displayName": "Acme Enterprise AI", |
| 14 | + "identifier": "did:web:acme-corp.com", |
| 15 | + "documentationUrl": "https://docs.acme-corp.com/ai" |
| 16 | + }, |
| 17 | + "entries": [ |
| 18 | + { |
| 19 | + "identifier": "urn:air:acme-corp.com:a2a:assistant", |
| 20 | + "version": "3.0.0", |
| 21 | + "type": "application/a2a-agent-card+json", |
| 22 | + "url": "https://api.acme-corp.com/agents/assistant.json", |
| 23 | + "description": "General-purpose corporate assistant agent." |
| 24 | + }, |
| 25 | + { |
| 26 | + "identifier": "urn:air:acme-corp.com:catalog:finance", |
| 27 | + "displayName": "Finance Services", |
| 28 | + "type": "application/ai-catalog+json", |
| 29 | + "url": "https://acme-corp.com/catalogs/finance.json", |
| 30 | + "description": "Financial agents, MCP servers, and datasets.", |
| 31 | + "tags": ["finance", "trading", "compliance"] |
| 32 | + }, |
| 33 | + { |
| 34 | + "identifier": "urn:air:acme-corp.com:catalog:engineering", |
| 35 | + "displayName": "Engineering Tools", |
| 36 | + "type": "application/ai-catalog+json", |
| 37 | + "url": "https://acme-corp.com/catalogs/engineering.json", |
| 38 | + "description": "CI/CD agents, code review tools, and DevOps servers.", |
| 39 | + "tags": ["engineering", "devops", "ci-cd"] |
| 40 | + } |
| 41 | + ] |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Finance sub-catalog |
| 46 | + |
| 47 | +The Finance team owns and hosts `finance.json`. It can be updated independently of the root: |
| 48 | + |
| 49 | +```json |
| 50 | +{ |
| 51 | + "specVersion": "1.0", |
| 52 | + "host": { |
| 53 | + "displayName": "Acme Finance Team", |
| 54 | + "identifier": "did:web:finance.acme-corp.com" |
| 55 | + }, |
| 56 | + "entries": [ |
| 57 | + { |
| 58 | + "identifier": "urn:air:acme-corp.com:a2a:finance", |
| 59 | + "type": "application/a2a-agent-card+json", |
| 60 | + "url": "https://api.acme-corp.com/agents/finance.json", |
| 61 | + "tags": ["finance", "trading"] |
| 62 | + }, |
| 63 | + { |
| 64 | + "identifier": "urn:air:acme-corp.com:mcp:finance", |
| 65 | + "type": "application/mcp-server-card+json", |
| 66 | + "url": "https://api.acme-corp.com/.well-known/mcp/server-card.json", |
| 67 | + "tags": ["finance", "mcp"] |
| 68 | + }, |
| 69 | + { |
| 70 | + "identifier": "urn:air:acme-corp.com:data:market-2026q1", |
| 71 | + "displayName": "Market Dataset Q1 2026", |
| 72 | + "type": "application/parquet", |
| 73 | + "url": "https://data.acme-corp.com/market-2026q1.parquet", |
| 74 | + "tags": ["dataset", "finance"] |
| 75 | + } |
| 76 | + ] |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## How it works |
| 81 | + |
| 82 | +**Direct entries** (like `urn:air:acme-corp.com:a2a:assistant`) appear directly in the root catalog. Clients see them without any additional fetching. The `displayName` is omitted for A2A entries since the agent card itself carries a canonical name. |
| 83 | + |
| 84 | +**Nested catalog entries** (like `urn:air:acme-corp.com:catalog:finance`) have `type: "application/ai-catalog+json"` and set `displayName` since catalogs don't embed their own name. Clients follow the `url` to fetch the sub-catalog and process it as another AI Catalog. |
| 85 | + |
| 86 | +**Dataset entries** set `displayName` since Parquet files don't carry a human-readable name. |
| 87 | + |
| 88 | +**Independent ownership**: each sub-catalog has its own `host` object. The Finance team updates their catalog without touching the root. |
| 89 | + |
| 90 | +**Mix and match**: a catalog can contain both direct entries and nested catalog references in the same `entries` array. |
| 91 | + |
| 92 | +## Client traversal |
| 93 | + |
| 94 | +A client that wants all artifacts walks the tree: |
| 95 | + |
| 96 | +1. Fetch root at `/.well-known/ai-catalog.json` |
| 97 | +2. Find entries with `type: "application/ai-catalog+json"` → these are sub-catalogs |
| 98 | +3. Fetch each sub-catalog URL |
| 99 | +4. Repeat (up to depth limit of 4) |
| 100 | +5. Collect all non-catalog entries |
| 101 | + |
| 102 | +See [Consuming Catalogs — Handling nested catalogs](../guides/consuming-catalogs.md#handling-nested-catalogs) for implementation details including cycle detection. |
| 103 | + |
| 104 | +## Related guides |
| 105 | + |
| 106 | +- [Organizing Catalogs](../guides/organizing-catalogs.md) |
| 107 | +- [Consuming Catalogs](../guides/consuming-catalogs.md) |
0 commit comments