agentleFS
Azure-SamplesAzure-Samples/eShopLite/AGENTS.md

eShopLite

AGENTS.md169 starsChanged 6 months agoMITView on GitHub

eShopLite is a modular Aspire-based reference eCommerce platform demonstrating advanced AI, search, and orchestration patterns. This is a scenario-driven monorepo where each scenario in scenarios/ is a self-contained solution showcasing different capabilities like Semantic Search, Model Context Protocol (MCP), Reasoning models, vector databases, real-time audio, and more. Key Technologies: - .NET 10 with Aspire 13.0.1 for orchestration - Blazor for UI - Azure OpenAI (GPT-4o, GPT-4o-mini, embeddings) - Microsoft.Extensions.AI (MEAI) IChatClient / IEmbeddingGenerator abstractions - Vector databases (In-memory via CommunityToolkit.VectorData,…

  • Pipes a download into a shell
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

31 rules. About 2 are common, 19 are distinctive, and 10 are very specific to this project.

  • ≈2

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All service endpoints are auto-wired and displayed in the dashboard

    line 88
  2. Common:

    No manual secret management needed

    line 125
  3. Very specific:

    Test projects follow the pattern <ProjectName>.Tests:

    line 150
  4. Distinctive:

    Follow existing test patterns when adding new tests

    line 171
  5. Very specific:

    Ensure tests pass before committing: dotnet test

    line 172
  6. Distinctive:

    Follow C# and .NET 10 best practices

    line 194
  7. Distinctive:

    Use modern C# features (top-level statements, nullable reference types, file-scoped namespaces)

    line 195
  8. Distinctive:

    Follow async/await patterns consistently

    line 196
  9. Distinctive:

    Use dependency injection for service registration

    line 197
  10. Distinctive:

    Document public APIs and complex logic with XML comments

    line 198
  11. Distinctive:

    Keep code accessible for beginners - add explanatory comments where helpful

    line 199
  12. Very specific:

    Use the aspire secret CLI (or scripts/Set-AzureOpenAISecrets.ps1) for local development

    line 352
  13. Distinctive:

    Use Azure Managed Identity for production (automatically configured by azd)

    line 353
  14. Common:

    All scenarios use secure credential management

    line 358
  15. Distinctive:

    Follow Azure OpenAI security guidelines

    line 361
  16. Distinctive:

    Use HTTPS endpoints for all Azure services

    line 362
  17. Distinctive:

    Use Virtual Networks for production deployments

    line 366
  18. Very specific:

    All tests must pass: dotnet test

    line 399
  19. Distinctive:

    Update relevant documentation (README files, XML comments)

    line 401
  20. Distinctive:

    Add tests for new features

    line 402
  21. Distinctive:

    Follow existing patterns and conventions

    line 403
  22. Distinctive:

    Keep changes focused and minimal

    line 404
  23. Distinctive:

    All CI checks must pass

    line 411
  24. Very specific:

    Solution: Start Docker Desktop or Podman service before running dotnet run

    line 446
  25. Very specific:

    Solution: Ensure azd auth login is authenticated and subscription has correct permissions

    line 452
  26. Very specific:

    Solution: Run dotnet restore and dotnet build before dotnet test

    line 455
  27. Very specific:

    Use find or grep to locate files across scenarios:

    line 473
  28. Very specific:

    Check copilot-instructions.md for additional coding guidelines

    line 479
  29. Very specific:

    Start with 01-SemanticSearch scenario to understand the base architecture

    line 491
  30. Distinctive:

    Use Application Insights for production monitoring

    line 494
  31. Distinctive:

    Test locally before deploying to Azure to save costs

    line 495

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Project Overview

eShopLite is a modular Aspire-based reference eCommerce platform demonstrating advanced AI, search, and orchestration patterns. This is a scenario-driven monorepo where each scenario in scenarios/ is a self-contained solution showcasing different capabilities like Semantic Search, Model Context Protocol (MCP), Reasoning models, vector databases, real-time audio, and more.

Key Technologies:

  • .NET 10 with Aspire 13.0.1 for orchestration
  • Blazor for UI
  • Azure OpenAI (GPT-4o, GPT-4o-mini, embeddings)
  • Microsoft.Extensions.AI (MEAI) IChatClient / IEmbeddingGenerator abstractions
  • Vector databases (In-memory via CommunityToolkit.VectorData, Azure AI Search, Chroma DB, SQL Server 2025)
  • Model Context Protocol (MCP) for agent interactions
  • Microsoft Agent Framework (MAF) for concurrent agent orchestration
  • Azure services (Container Apps, AI Search, Application Insights, Functions)
  • Docker/Podman for containerized services

Architecture: Each scenario is a complete, runnable Aspire solution with an eShopAppHost orchestrating multiple services (APIs, databases, UI). Services are reused across scenarios, making this a true monorepo with shared components.

Setup Commands

Prerequisites Installation

Install the following prerequisites:

# Install .NET 10 SDK
# Download from: https://dotnet.microsoft.com/download/dotnet/10.0

# Install Azure Developer CLI
# macOS/Linux:
curl -fsSL https://aka.ms/install-azd.sh | bash
# Windows (PowerShell):
# powershell -ex AllSigned -c "Invoke-RestMethod 'https://aka.ms/install-azd.ps1' | Invoke-Expression"

# Install Docker Desktop or Podman
# Docker: https://www.docker.com/products/docker-desktop/
# Podman: https://podman.io/

# Install Aspire CLI
dotnet tool install --global Aspire.Cli

# Verify installations
dotnet --version  # Should be 10.0 or higher
azd version
docker --version  # or podman --version

Clone and Navigate

# Clone the repository
git clone https://github.com/Azure-Samples/eShopLite.git
cd eShopLite

# Navigate to a specific scenario (e.g., Semantic Search)
cd scenarios/01-SemanticSearch

Development Workflow

Running a Scenario Locally

Each scenario is designed to run independently. The general pattern:

# Navigate to the scenario's AppHost
cd scenarios/<scenario-name>/src/eShopAppHost

# Run the solution
dotnet run

# The Aspire Dashboard will open in your browser
# Access URLs for services (Store, Products API, etc.) will be displayed in the console

Example for Semantic Search:

cd scenarios/01-SemanticSearch/src/eShopAppHost
dotnet run

What happens:

  • Aspire orchestrates all services (Store UI, Products API, databases)
  • Aspire Dashboard opens at http://localhost:15888 (or similar)
  • Store UI is available at a dynamically assigned port (check console output)
  • All service endpoints are auto-wired and displayed in the dashboard

Hot Reload and Watch Mode

.NET 10 includes hot reload by default. Code changes in Blazor and API projects will auto-refresh without full restart.

Configuration and Secrets

Local development requires Azure OpenAI credentials:

  1. Set AppHost parameter secrets with the Aspire CLI (parameter-based approach):

    Easiest: run scripts/Set-AzureOpenAISecrets.ps1 from the repo root to set the four common values for every scenario at once (-DryRun previews). Or set them per scenario with the aspire secret command:

# Set Azure OpenAI parameters (required for most scenarios) — point --apphost at the scenario's AppHost
aspire secret set Parameters:AzureOpenAIEndpoint "https://<your-endpoint>.openai.azure.com/" --apphost scenarios/<scenario-name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIApiKey "<your-key>" --apphost scenarios/<scenario-name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIDeploymentName "gpt-4.1-mini" --apphost scenarios/<scenario-name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIEmbeddingsDeploymentName "text-embedding-3-small" --apphost scenarios/<scenario-name>/src/eShopAppHost/eShopAppHost.csproj

# Scenario-specific extras:
# 03-RealtimeAudio: also set Parameters:AzureOpenAIRealtimeDeploymentName
# 05-deepseek: also set Parameters:DeepSeekEndpoint, Parameters:DeepSeekApiKey, Parameters:DeepSeekDeploymentName
# 11-GitHubModels (local): set Parameters:GitHubModelsToken instead of the AOAI params
  1. Or configure via Aspire Dashboard at first run:
    • On first run, Aspire Dashboard will prompt for missing parameters
    • Enter values in the dashboard UI
    • Values are stored as user secrets automatically

For Azure deployment via azd:

  • Configuration is handled automatically
  • Resources are provisioned with Managed Identity
  • No manual secret management needed

Testing Instructions

Run All Tests

From the repository root or scenario root:

# Run all tests in the repository
dotnet test

# Run tests for a specific scenario
cd scenarios/01-SemanticSearch/src
dotnet test

# Run tests with verbose output
dotnet test --verbosity normal

# Run tests with coverage (if configured)
dotnet test --collect:"XPlat Code Coverage"

Test Projects

Test projects follow the pattern <ProjectName>.Tests:

  • Products.Tests - Tests for Products API
  • Store.Tests - Tests for Store UI

Example - Run specific test project:

cd scenarios/01-SemanticSearch/src/Products.Tests
dotnet test

Example - Run specific test by name:

dotnet test --filter "FullyQualifiedName~SemanticSearchTests"

Testing Patterns

  • Unit tests use xUnit framework
  • Tests are located alongside the projects they test
  • Follow existing test patterns when adding new tests
  • Ensure tests pass before committing: dotnet test

Code Style

Formatting and Linting

Before each commit:

# Format all C# code (required)
dotnet format

# Verify formatting without making changes
dotnet format --verify-no-changes

# Format specific solution
cd scenarios/01-SemanticSearch/src
dotnet format eShopLite-Aspire.slnx

Coding Conventions

  • Follow C# and .NET 10 best practices
  • Use modern C# features (top-level statements, nullable reference types, file-scoped namespaces)
  • Follow async/await patterns consistently
  • Use dependency injection for service registration
  • Document public APIs and complex logic with XML comments
  • Keep code accessible for beginners - add explanatory comments where helpful

File Organization

  • Each scenario has its own src/ directory with all projects
  • Shared entities: DataEntities, VectorEntities, SearchEntities, CartEntities
  • Service projects: Products (API), Store (Blazor UI)
  • Orchestration: eShopAppHost (Aspire host)
  • Configuration: eShopServiceDefaults (shared Aspire settings)

Naming Conventions

  • Projects: PascalCase (e.g., Products, VectorEntities)
  • Aspire resource names: lowercase (e.g., products, store, sql)
  • Configuration sections: Follow .NET conventions (e.g., ConnectionStrings)

Build and Deployment

Build Commands

# Build entire repository
dotnet build

# Build specific scenario
cd scenarios/01-SemanticSearch/src
dotnet build

# Build specific project
cd scenarios/01-SemanticSearch/src/Products
dotnet build

# Build in Release mode
dotnet build --configuration Release

Local Development Build

# Clean and rebuild
dotnet clean
dotnet build

# Restore dependencies
dotnet restore

Deploy to Azure

Using Azure Developer CLI (azd):

# Navigate to the eShopAppHost directory (where azure.yaml is located)
cd scenarios/01-SemanticSearch/src/eShopAppHost

# Login to Azure (first time only)
azd auth login

# Provision and deploy all resources
azd up
# You'll be prompted for:
# - Environment name (e.g., "eshoplite")
# - Azure subscription
# - Azure region (e.g., "eastus2")

# After successful deployment, URLs will be displayed in console output

What azd up does:

  • Creates Azure resource group
  • Provisions Azure OpenAI, Container Apps, AI Search, Application Insights, etc.
  • Builds and containerizes services
  • Deploys to Azure Container Apps
  • Configures Managed Identity for secure access

Other useful azd commands:

# Deploy code changes without reprovisioning
azd deploy

# Tear down all Azure resources
azd down

# View environment configuration
azd env get-values

# Monitor deployed app
azd monitor

Environment Configurations

  • Local: Uses Docker containers, user secrets, local Aspire Dashboard
  • Azure: Uses Azure Container Apps, Managed Identity, Azure Application Insights

Monorepo Navigation

Scenario Structure

scenarios/
├── 01-SemanticSearch/          # Keyword + semantic search with in-memory vector DB
├── 02-AzureAISearch/           # Azure AI Search integration
├── 03-RealtimeAudio/           # GPT-4o Realtime Audio API
├── 04-chromadb/                # Chroma DB vector database
├── 05-deepseek/                # DeepSeek-R1 reasoning model
├── 06-mcp/                     # Model Context Protocol servers/clients
├── 07-AgentsConcurrent/        # Multi-agent orchestration
├── 08-Sql2025/                 # SQL Server 2025 vector search
├── 09-AzureAppService/         # Azure App Service deployment
├── 10-A2ANet/                  # Agent-to-Agent (A2A) protocol
├── 11-GitHubModels/            # GitHub Models integration
├── 12-AzureFunctions/          # Azure Functions façade
└── 14-MAFDevUI/                # MAF Development UI

Working with Multiple Scenarios

Each scenario is independent and self-contained:

  • Has its own src/ directory with all projects
  • Has its own azure.yaml for deployment
  • Has its own README.md with specific instructions
  • Shares common project patterns (Products, Store, Entities)

To switch scenarios:

# Stop current scenario (Ctrl+C)
# Navigate to new scenario
cd ../02-AzureAISearch/src/eShopAppHost
dotnet run

To work on multiple scenarios simultaneously:

  • Each scenario runs on different ports (managed by Aspire)
  • Can run multiple scenarios in separate terminal windows
  • Each has its own Aspire Dashboard instance

Scenario-Specific Commands

Each scenario's README contains specific setup instructions. Always check:

cd scenarios/<scenario-name>
cat README.md

Security Considerations

Authentication and Secrets

  • Never commit secrets or API keys to source control
  • Use the aspire secret CLI (or scripts/Set-AzureOpenAISecrets.ps1) for local development
  • Use Azure Managed Identity for production (automatically configured by azd)
  • Azure OpenAI keys are stored in user secrets or Key Vault

Security Best Practices

  • All scenarios use secure credential management
  • GitHub Actions include security scanning (see .github/workflows/codeql.yml)
  • Enable GitHub secret scanning in your fork
  • Follow Azure OpenAI security guidelines
  • Use HTTPS endpoints for all Azure services

Recommended Additional Security

  • Use Virtual Networks for production deployments
  • Enable Azure Container Apps firewall
  • Implement rate limiting for APIs
  • Review Azure security baselines

Pull Request Guidelines

Before Submitting PR

# Format code
dotnet format

# Run all tests
dotnet test

# Ensure clean build
dotnet build --configuration Release

PR Title Format

[Component/Scenario] Brief description

Examples:
[01-SemanticSearch] Add product filtering feature
[Products API] Fix vector search performance
[Documentation] Update setup instructions

PR Requirements

  • All tests must pass: dotnet test
  • Code must be formatted: dotnet format --verify-no-changes
  • Update relevant documentation (README files, XML comments)
  • Add tests for new features
  • Follow existing patterns and conventions
  • Keep changes focused and minimal

Review Process

  • CLA must be signed (automated via bot)
  • Security scans must pass (CodeQL, secret scanning)
  • At least one reviewer approval required
  • All CI checks must pass

Additional Notes

Common Commands Quick Reference

# Format code
dotnet format

# Build solution
dotnet build

# Run tests
dotnet test

# Run scenario
cd scenarios/<name>/src/eShopAppHost && dotnet run

# Deploy to Azure
cd scenarios/<name>/src/eShopAppHost && azd up

# Set secrets (Aspire parameter-based approach) — or run scripts/Set-AzureOpenAISecrets.ps1
aspire secret set Parameters:AzureOpenAIEndpoint "<your-endpoint>" --apphost scenarios/<name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIApiKey "<your-key>" --apphost scenarios/<name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIDeploymentName "gpt-4.1-mini" --apphost scenarios/<name>/src/eShopAppHost/eShopAppHost.csproj
aspire secret set Parameters:AzureOpenAIEmbeddingsDeploymentName "text-embedding-3-small" --apphost scenarios/<name>/src/eShopAppHost/eShopAppHost.csproj

Troubleshooting

Issue: Azure OpenAI parameters are missing

  • Solution: Set user secrets as described in Configuration section

Issue: Docker/Podman not running

  • Solution: Start Docker Desktop or Podman service before running dotnet run

Issue: Port conflicts

  • Solution: Aspire automatically assigns ports. Check Aspire Dashboard for actual URLs

Issue: Azure deployment fails

  • Solution: Ensure azd auth login is authenticated and subscription has correct permissions

Issue: Tests failing after changes

  • Solution: Run dotnet restore and dotnet build before dotnet test

Performance Considerations

  • Vector searches are compute-intensive; consider caching strategies
  • Azure OpenAI has rate limits; implement retry logic for production
  • Aspire Dashboard adds overhead; disable telemetry for production builds if needed
  • SQL Server 2025 vector indexes improve performance for large datasets

Useful Resources

Quick Navigation Tips

  • Use find or grep to locate files across scenarios:
    find . -name "*.csproj" | grep Products
    grep -r "SemanticSearch" --include="*.cs"
  • Each scenario has a docs/ folder with detailed technical documentation
  • Check copilot-instructions.md for additional coding guidelines
  • Review scenario READMEs for specific configuration requirements

CI/CD Integration

  • GitHub Actions workflows are in .github/workflows/
  • CodeQL security scanning runs automatically on PRs
  • Profanity filter and documentation link validation run on commits
  • Welcome bot greets new contributors

Development Tips

  • Start with 01-SemanticSearch scenario to understand the base architecture
  • Each scenario builds on concepts from previous ones
  • Aspire Dashboard provides real-time telemetry and logs
  • Use Application Insights for production monitoring
  • Test locally before deploying to Azure to save costs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.