e-commerce-agents

nitin27may/e-commerce-agents Checked 3 days ago

A complete, end-to-end multi-agent e-commerce application on Microsoft Agent Framework, in Python and .NET: storefront, orchestrator and five specialist agents…

Recorded on the no-key stack (recorded model responses): ask, get cards, switch mode, watch the graph, a return waits for a person. Run it yourself with ./scripts/dev.sh --no-key. This is a working application, end to end, not a sample that stops at "the agent replied". A storefront with sign-in and roles sits in front of an orchestrator and five specialist agents that handle product search, orders, pricing, reviews and inventory, backed by PostgreSQL, with human approvals, guardrails, evals, tracing and deployment around them.

Summary extracted from the README.

E-Commerce Agents

Tests Build Images License: MIT Python 3.12+ .NET 11 Next.js 16 MAF 1.26.0 PostgreSQL + pgvector Docker Live preview

A complete multi-agent e-commerce application built on Microsoft Agent Framework (MAF), in Python and .NET, and a 38-chapter course that teaches every piece of it.

This is a working application, end to end, not a sample that stops at "the agent replied". A storefront with sign-in and roles sits in front of an orchestrator and five specialist agents that handle product search, orders, pricing, reviews and inventory, backed by PostgreSQL, with human approvals, guardrails, evals, tracing and deployment around them. The course starts from a first agent and builds up to it one mechanism at a time; chapter 1 runs with no API key and no Docker.

Chat with a side-by-side product comparison, the Compare button and the orchestration mode switcher

What is in the box

Layer What runs
Web app Next.js storefront, cart, checkout and orders; streaming chat that renders product cards, tables and charts; seller and admin dashboards; an approvals inbox
Orchestration One orchestrator, five selectable modes (below), a live graph of the run and a side-by-side compare view
Agents Five specialists as separate services, talking A2A 1.0, with optional MCP servers for product and inventory data
Data PostgreSQL with pgvector for semantic search, numbered migrations, a deterministic seeder, Redis for rate limiting
Identity JWT sign-in, five roles (customer, power user, seller, support, admin), identity carried to every agent and tool
Safety Policy-routed human approval, checkpoints and resume, guardrails, grounding checks, idempotency on money-moving actions
Quality An eval suite that replays without a key in CI, a red-team set, dozens of CI checks per pull request
Operations OpenTelemetry into the Aspire dashboard, per-request token and cost tracking, Docker Compose with prebuilt images, a draft Azure Container Apps deployment
Two backends All of the above in Python, and in .NET / C# behind the same frontend and database, with the differences listed in the parity matrix

One orchestrator, five orchestration modes

Most agent samples show one orchestration pattern in isolation. Here the orchestrator runs the same request through any of five, selected per request in the chat box, so "which one should I use?" has a measured answer:

Mode How the agents are coordinated p50 latency Model calls
tool (default) The orchestrator's model picks a specialist and calls it as a tool 10.6 s orchestrator + specialist
handoff A triage agent hands the conversation to a specialist, which can hand it on 5.1 s triage + specialist
group-chat Two specialists debate, then a moderator answers 3.2 s 2 panelists + moderator
workflow:pre-purchase A fixed graph fans out to several specialists at once and merges the results 0.26 s none
workflow:return-replace A fixed sequential graph that pauses for human approval before anything is created 0.10 s none

Compare dialog: one prompt run through four orchestration modes, each card showing latency, steps, tokens, cost and the graph it took

The two workflow modes call no model, so they are doing less work, not the same work faster. Method, token and cost figures: orchestration benchmark (gpt-4.1, 40 requests). How each pattern works: orchestration patterns.

Learn

New to MAF? Run chapter 1 now — no API key, no Docker:

uv sync --project tutorials
uv run --project tutorials python tutorials/01-first-agent/python/main.py

It replays a recorded model response, so it works offline. From there, follow a learning path — first agent, inside an agent, workflows, multi-agent orchestration, production concerns — or the short route in the course README.

Run it

git clone https://github.com/nitin27may/e-commerce-agents.git
cd e-commerce-agents
cp .env.minimal .env          # set OPENAI_API_KEY — the only variable a first run needs
./scripts/dev.sh --demo       # pulls prebuilt images, seeds, and starts everything

Then open http://localhost:3000 and sign in as alice.johnson@gmail.com / customer123. Docker is the only requirement — no Python, .NET or Node needed.

--demo pulls the eleven released images from GitHub Container Registry instead of building them, which is the difference between a first run of about a minute and one of about twelve (a rough figure; it depends on your network and machine). Images are published for linux/amd64 and linux/arm64, so Apple Silicon runs natively.

No API key? ./scripts/dev.sh --demo --no-key (PowerShell: ./scripts/dev.ps1 -Demo -NoKey) starts the whole stack with no model behind it: browsing, search, cart and checkout work, and chat replays recorded answers for the suggested prompts. The recordings ship in images built after this change; the released 1.4.0 images have none and report chat prompts as "not recorded". A local model through Ollama also needs no paid key: see docs/quick-start.md.

Building from source instead — drop the flag. This is the contributor path, and the one to use if you have changed any code:

./scripts/dev.sh              # builds all eleven images locally, then seeds and starts

On Windows, use scripts/dev.ps1 — the PowerShell twin of the bash script, same flags:

Copy-Item .env.minimal .env    # then set OPENAI_API_KEY in .env
./scripts/dev.ps1 -Demo

WSL2 still gives the best experience, and everything above works unchanged inside it.

In the browser, no install. The Codespaces badge above opens a ready environment (Python 3.12 + uv, Node 26 + pnpm, the .NET 11 SDK, Docker-in-Docker) and installs the dependencies (.devcontainer/). The creation screen asks for optional model-key secrets (OPENAI_API_KEY, or the Azure OpenAI endpoint, key and deployment, or an OpenAI-compatible LLM_BASE_URL); the provider is chosen from whichever you supply. With none, it runs key-free on recorded responses: the tutorials, Python tests and keyless evals work, and chat says a prompt was not recorded. Add secrets under Settings, Secrets and variables, Codespaces (or your personal ones at github.com/settings/codespaces, scoped to this repo); after the Codespace exists, add the secret and run Codespaces: Rebuild Container. The stack is not started for you: run ./scripts/dev.sh in the terminal, and check the setup with uv run --project agents/python python -m scripts.doctor. Details and gotchas: Quick Start, Configuration.

Full detail — the .NET stack, WSL2 notes, running with no API key, and what to do when something breaks: the Quick Start page.

Generative UI, not raw JSON. The chat surface never dumps a tool result as text or a code block. Every agent response is inspected by shape and rendered as the right interactive component: a single detailed result becomes a card, a list becomes a table, a distribution or trend becomes a chart, a status becomes a tone-coded badge — see it live in the screens gallery (review sentiment: rating distribution + 6-month trend, rendered from the same data an LLM would otherwise only describe in prose).

Full documentation: nitinksingh.com/e-commerce-agents — the concepts library, all 38 tutorial chapters, and the architecture reference, with every diagram rendered.

Companion demo repo for the AI article series on nitinksingh.com: MAF v1: Putting It All Together (the current Python + .NET series) and Building a Multi-Agent E-Commerce Platform — The Complete Guide (the original Python-only walkthrough). The articles are optional background — this repo and its documentation site are the canonical, always-current source.


Where to start

I want to... Go here
Learn MAF step by step — start with no key tutorials/README.md — 38 chapters; run chapter 1 now
Just run it Run it above — Docker, one command
Choose an orchestration pattern The five modes · benchmark · orchestration patterns
Run the .NET backend, or Windows, or with no API key Quick Start
Configure it Configuration — one .env, and how it reaches each service
Read the documentation nitinksingh.com/e-commerce-agents — rendered and searchable
Brand new to AI — never run a model or written an agent AI Knowledge Hub — eleven modules, ten labs, free and local
Learn what an agent even is — new to AI/agents Concepts — start at page 01
Understand how the agents work / add a new one Architecture · Adding an Agent
Use the MCP server MCP Integration
See what shipped and what is next Roadmap · CHANGELOG
Look at the UI right now, nothing to install Live preview (recorded answers, how it works)
See the generative UI, test users and scenarios to try Demo guide

Architecture

graph TB
    subgraph Client["Browser / Client"]
        FE["Next.js 16<br/>React 19 + Tailwind CSS"]
    end

    subgraph Orchestrator["Orchestrator Agent :8080"]
        FA["FastAPI + MAF"]
        AUTH["JWT Auth + RBAC"]
        ROUTER["Orchestration modes<br/>tool · handoff · workflows · group chat"]
        CONV["Conversation Mgmt"]
        MKT["Marketplace API"]
    end

    subgraph Specialists["Specialist Agents · A2A Protocol"]
        PD["Product Discovery<br/>:8081"]
        OM["Order Management<br/>:8082"]
        PP["Pricing &amp; Promotions<br/>:8083"]
        RS["Review &amp; Sentiment<br/>:8084"]
        IF["Inventory &amp; Fulfillment<br/>:8085"]
    end

    subgraph Infrastructure["Shared Infrastructure"]
        PG[("PostgreSQL 16<br/>+ pgvector")]
        RD[("Redis 8")]
        ASP["Aspire Dashboard<br/>:18888"]
    end

    subgraph LLM["LLM Provider"]
        OAI["OpenAI API<br/>(configurable model)"]
        AZ["Azure OpenAI<br/>(configurable)"]
    end

    FE -->|"HTTP/JSON"| FA
    FA --> AUTH
    AUTH --> ROUTER
    ROUTER -->|"A2A"| PD
    ROUTER -->|"A2A"| OM
    ROUTER -->|"A2A"| PP
    ROUTER -->|"A2A"| RS
    ROUTER -->|"A2A"| IF

    PD --> PG
    OM --> PG
    PP --> PG
    RS --> PG
    IF --> PG

    PD -->|"Embeddings"| OAI
    PD -.->|"or"| AZ
    Orchestrator --> RD
    Specialists -->|"OTLP"| ASP

    Orchestrator -->|"OTLP"| ASP
    Specialists --> OAI
    Specialists -.-> AZ

    style Client fill:#475569,stroke:#334155,stroke-width:2px,color:#fff
    style FE fill:#94a3b8,stroke:#64748b,color:#1e293b

    style Orchestrator fill:#0891b2,stroke:#0e7490,stroke-width:2px,color:#fff
    style FA fill:#22d3ee,stroke:#06b6d4,color:#0c4a6e
    style AUTH fill:#fca5a5,stroke:#f87171,color:#7f1d1d
    style ROUTER fill:#67e8f9,stroke:#22d3ee,color:#0c4a6e
    style CONV fill:#67e8f9,stroke:#22d3ee,color:#0c4a6e
    style MKT fill:#67e8f9,stroke:#22d3ee,color:#0c4a6e

    style Specialists fill:#0d9488,stroke:#0f766e,stroke-width:2px,color:#fff
    style PD fill:#2dd4bf,stroke:#14b8a6,color:#134e4a
    style OM fill:#2dd4bf,stroke:#14b8a6,color:#134e4a
    style PP fill:#2dd4bf,stroke:#14b8a6,color:#134e4a
    style RS fill:#2dd4bf,stroke:#14b8a6,color:#134e4a
    style IF fill:#2dd4bf,stroke:#14b8a6,color:#134e4a

    style Infrastructure fill:#475569,stroke:#334155,stroke-width:2px,color:#fff
    style PG fill:#94a3b8,stroke:#64748b,color:#1e293b
    style RD fill:#94a3b8,stroke:#64748b,color:#1e293b
    style ASP fill:#94a3b8,stroke:#64748b,color:#1e293b

    style LLM fill:#d97706,stroke:#b45309,stroke-width:2px,color:#fff
    style OAI fill:#fbbf24,stroke:#f59e0b,color:#78350f
    style AZ fill:#fbbf24,stroke:#f59e0b,color:#78350f

Six agents — five specialists behind one orchestrator, which coordinates them in any of the five modes; an opt-in sixth specialist, merchant-ops (Python only, port 8086), is off by default — over A2A (1.0 JSON-RPC and the legacy HTTP wire, docs/a2a.md), with the same schema and the same frontend for either backend. Full detail — request flow, agent internals, the database schema and the API surface — is in Architecture.

Pick your stack: agents/python/ or agents/dotnet/ — switch with ./scripts/dev.sh --dotnet. Parity is checked in CI by a keyless gate that boots both stacks under replay (.github/workflows/stack-parity.yml); the live dual-backend Playwright suite (scripts/e2e-both-stacks.sh) still runs locally. And docs/parity-matrix.md lists the remaining differences row by row.


Deploy to Azure

az login && azd auth login
scripts/azure-up.sh        # shows progress, then prints the URL and the demo accounts

That is the whole job: no model key, no Docker, no secrets to create. When you are finished, scripts/azure-down.sh --env <env> removes everything. It costs about 1.4 USD a day while it is up. What it creates, the options and the cost are in docs/azure-deployment.md. There is also a portal button, which needs a few more steps (details):

Deploy to Azure


Documentation

Everything below is published, searchable and cross-linked at nitinksingh.com/e-commerce-agents — with every Mermaid diagram rendered as a diagram. The site is generated from this repository by scripts/build_docs_site.py, so the files here are always the source of truth; nothing lives only on the site.

Section What's in it
Concepts 14 pages for readers new to agents — what an agent is, the agentic loop, tools, harnesses, why multi-agent, orchestration patterns, graphs, state and memory, grounding, guardrails, HITL, evaluation, observability and cost, production concerns
Tutorials 38 chapters. Chapters 00 to 32 ship Python and .NET (chapter 16's .NET side is a status stub and 20b is Python only); chapters 33 to 36 (injection and red team, structured output, memory, model providers) are Python only. Every chapter is gated in CI — the tests replay fixtures (Python) or drive a scripted client (.NET), so the whole suite runs with no key and no network
Architecture System design · agent flows · database schema · API reference · frontend · workflows
Guides Adding an agent · A2A 1.0 · approvals · merchant proposals · event autonomy · return lifecycle · DevUI · MCP integration · telemetry · security · agent quality and evals · MAF best practices · releasing
Getting Started Quick start · configuration · deployment · troubleshooting
Reference Python vs .NET parity matrix · agent audit matrix · orchestration benchmark · reported vs actual · glossary · Mermaid style guide
Demo guide Test users, the agent catalog, scenarios to try, and the screens gallery (source)
Roadmap What shipped, what is in progress, and what is deliberately not done (source)

Contributor-facing docs stay in the repo rather than on the site: CONTRIBUTING.md (setup, conventions, testing policy, PR checklist), CHANGELOG.md (what changed in each release) and CLAUDE.md.


Tech stack

Layer Technology
Agent framework Microsoft Agent Framework v1 — Python (agent-framework-core) and .NET (Microsoft.Agents.AI)
Agent communication A2A 1.0 JSON-RPC (/a2a/v1, agent card at /.well-known/agent-card.json) and the legacy /message:send wire, on both stacks (a2a.md), plus optional MCP for product and inventory data (flag-gated, MCP_ENABLED)
LLM OpenAI / Azure OpenAI, or any OpenAI-compatible endpoint (Ollama, vLLM, OpenRouter)
Backend Python 3.12 + FastAPI · .NET 11 + ASP.NET Core
Data PostgreSQL 16 + pgvector · Redis 8
Frontend Next.js 16, React 19, Tailwind 4, shadcn/ui
Telemetry OpenTelemetry → .NET Aspire Dashboard

Versions, ports and every environment variable: Deployment and Configuration.


What's next

This is an active project. The short version of where it goes from here — the full list, with checkboxes and the reasoning for the order, is on the Roadmap.

Next What it is
Azure and Microsoft Foundry The one-command Container Apps deployment ran from a clean subscription (Deploy to Azure). Next: Foundry features that need an Azure credential (hosted agents, evaluators logging to a project) and the measured cost of the larger topologies. The .NET 11 move is a separate, later change
Finish the gates The keyless parity gate runs in CI, but it covers only turns that call no model. A model-calling comparison across the two stacks needs a key, and the .NET eval suite still needs its baselines
Retrieval and tooling A typed filter DSL for search_products, the two MCP servers published to PyPI, and prompt caching — now measurable, because the cost counter ships

No third backend is planned. The roadmap also records what is deliberately not planned, and why, so those are not mistaken for oversights.

Watch this repository to be notified when these land — use Watch → Custom → Releases for release-only notifications, or Watch → All Activity to follow the work as it happens. Each release is written up in the CHANGELOG, which says plainly when something never worked and for how long.


Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes and ensure tests pass
  4. Submit a pull request

See CONTRIBUTING.md for detailed setup, conventions, testing policy, and PR checklist.


License

This project is licensed under the MIT License.


Built with Microsoft Agent Framework and the A2A protocol as its wire format (A2A 1.0 on both stacks, docs/a2a.md).

Built by Nitin Singh · Documentation · More projects