-
Notifications
You must be signed in to change notification settings - Fork 2
Knowledge System
The knowledge system provides agents with runtime access to Microsoft Learn documentation and web search results. It enables agents to look up current Azure documentation, patterns, and troubleshooting information during prototype generation, supplementing their built-in knowledge with up-to-date external sources.
The system has three components: web search functions, an in-memory search cache, and a knowledge contribution command for feeding project-specific learnings back into the knowledge base.
The knowledge/web_search.py module provides module-level functions (following the deploy_helpers.py pattern) that search the Microsoft Learn API and fetch page content. All functions return empty results on failure -- they never raise exceptions.
| Function | Description |
|---|---|
search_learn(query, max_results=3) |
Search the Microsoft Learn API. Returns a list of {title, url, description} dicts. |
fetch_page_content(url) |
Fetch a page and convert HTML to plain text using a minimal stdlib-based HTML parser. |
search_and_fetch(query, max_results=3) |
Combines search and fetch: searches Learn, then fetches and concatenates the top results. |
format_search_results(results) |
Format search results for injection into agent context. |
The search endpoint is https://learn.microsoft.com/api/search with a 10-second HTTP timeout.
The SearchCache class (in knowledge/search_cache.py) provides session-scoped caching to avoid redundant HTTP requests when multiple agents search for similar queries.
| Setting | Default | Description |
|---|---|---|
| TTL | 30 minutes (1800 seconds) | Time-to-live for cached entries |
| Max entries | 50 | Maximum number of cached entries |
| Eviction | LRU | Oldest entry evicted when capacity is reached |
The cache is attached to AgentContext._search_cache on first search, so it is shared across all agents within a session. Cache keys are normalized (lowercased, whitespace-collapsed) to improve hit rates for similar queries.
Cache statistics (hits, misses, entry count) are available via cache.stats().
The az prototype knowledge contribute command allows users and agents to feed learnings back into the knowledge base.
az prototype knowledge contribute [options]
| Parameter | Type | Default | Description |
|---|---|---|---|
--service |
string | (required) | Azure service name (e.g., cosmos-db, key-vault). |
--description |
string | (required) | Brief description of the knowledge contribution. |
--file |
string | (required) | Path to a file containing the contribution content. |
--draft |
flag | false |
Preview the contribution without submitting. |
--type |
enum | Pitfall |
Type of contribution. One of: Service pattern update, New service, Tool pattern, Language pattern, Pitfall. |
--section |
string | None | Target section within the knowledge file. |
--json / -j
|
flag | false |
Output machine-readable JSON instead of formatted display. |
Contributions are also made automatically during sessions. For example, the build session's QA remediation loop contributes findings from QA review to the knowledge base as fire-and-forget operations.
Five agents have web search enabled (_enable_web_search = True):
- cloud-architect -- looks up cross-service patterns and Azure architecture guidance
- terraform-agent -- searches for Terraform provider documentation and module references
- bicep-agent -- searches for Bicep template references and ARM API documentation
- app-developer -- looks up SDK documentation and application patterns
- qa-engineer -- searches for error messages, known issues, and troubleshooting guides
Agents request web searches by including [SEARCH: query] markers in their AI responses. The _resolve_searches() method in BaseAgent:
- Detects
[SEARCH: query]markers in the AI response (up to 3 per response) - Executes each search via
search_and_fetch() - Re-invokes the AI with the fetched documentation appended to the context
- Merges token usage from both AI calls
This allows agents to self-direct their information gathering based on what they encounter during task execution.
The compose_context(mode="poc") function strips the ## Production Backlog Items section from knowledge service files by default. This keeps agent context focused on prototype-relevant information. Production backlog items are extracted separately via extract_production_items(service) and used during backlog generation as deferred epic material.
Contribute a pitfall learned during development:
az prototype knowledge contribute \
--service cosmos-db \
--description "Connection string requires AccountEndpoint format for SDK v4" \
--file ./learnings/cosmos-connection.md \
--type PitfallPreview a contribution without submitting:
az prototype knowledge contribute \
--service key-vault \
--description "Soft-delete enabled by default since 2021" \
--file ./learnings/keyvault-softdelete.md \
--draftContribute a new service pattern:
az prototype knowledge contribute \
--service container-apps \
--description "Dapr sidecar configuration pattern" \
--file ./patterns/dapr-sidecar.md \
--type "Service pattern update" \
--section "Configuration"- MCP Integration -- external tool access for agents
- Escalation -- Level 3 escalation uses web search
- Error Analysis -- QA agent uses web search during diagnosis
Getting Started
Stages
Interfaces
Configuration
Agent System
Features
- Backlog Generation
- Cost Analysis
- Error Analysis
- Docs & Spec Kit
- MCP Integration
- Knowledge System
- Escalation
Quality
Help
Policies — Azure
AI Services
Compute
Data Services
- Azure SQL
- Backup Vault
- Cosmos Db
- Data Factory
- Databricks
- Event Grid
- Event Hubs
- Fabric
- IoT Hub
- Mysql Flexible
- Postgresql Flexible
- Recovery Services
- Redis Cache
- Service Bus
- Stream Analytics
- Synapse Workspace
Identity
Management
Messaging
Monitoring
Networking
- Application Gateway
- Bastion
- CDN
- DDoS Protection
- DNS Zones
- Expressroute
- Firewall
- Load Balancer
- Nat Gateway
- Network Interface
- Private Endpoints
- Public Ip
- Route Tables
- Traffic Manager
- Virtual Network
- Vpn Gateway
- WAF Policy
Security
Storage
Web & App
Policies — Well-Architected
Reliability
Security
Cost Optimization
Operational Excellence
Performance Efficiency
Integration