How ethanz-zh/commerce-pilot works
CommercePilot is an e-commerce operations platform whose main workflow analyzes sales, inventory and pricing, retrieves policy evidence, checks compliance, then stages a campaign draft for human approval. The React console starts workflows and displays progress and results; the API also exposes a deterministic baseline and approval operations. The graph includes documented RAG, evaluation and platform-sync capabilities. Some subsystem links come from the README and tree rather than sampled implementation, so uncertain call-level wiring is omitted.
Main entry points: database.py Commerce database · multi_agent.py Multi-agent workflow · routes.py API routes · retrieval.py Hybrid policy retrieval
Components 32
Console and API
- Operations console
frontend/src/App.tsx - API client
frontend/src/api.ts - API routes
app/api/routes.py
Workflow orchestration
- Multi-agent workflow
app/workflows/multi_agent.py - Deterministic baseline
app/workflows/baseline.py - Supervisor
app/workflows/multi_agent.py - Sales analysis
app/workflows/multi_agent.py - Inventory pricing
app/workflows/multi_agent.py - Policy worker
app/workflows/multi_agent.py - Strategy planner
app/workflows/multi_agent.py - Compliance reviewer
app/workflows/multi_agent.py - Draft execution
app/workflows/multi_agent.py
Commerce data and tools
- Sales tools
app/tools/sales.py - Inventory and pricing tools
app/tools/inventory.py - Campaign tools
app/tools/campaigns.py - Commerce database
app/infrastructure/database.py - Business models
app/domain/models.py
Models and policy RAG
- Hybrid policy retrieval
app/rag/retrieval.py - Policy indexing
app/rag/indexing.py - Embedding and reranking
app/rag/providers.py - Agent model provider
app/llm/providers.py - Agent evaluation
app/evaluation/agent.py - Retrieval evaluation
app/evaluation/retrieval.py
Approval and platforms
- Human approval
app/workflows/approval.py - Workflow checkpointer
app/infrastructure/checkpoint.py - Platform data sync
app/platform/sync.py - Gateway factory
app/platform/factory.py - Shop gateways
app/platform/contracts.py - Taobao adapter
app/platform/taobao.py - Mock gateway
app/platform/mock.py
Other components
- Operator
- DashScope services
Connections 38
- Operator → Operations console: uses
- Operations console → API client: requests workflows
- API client → API routes: calls API
- API routes → Multi-agent workflow: runs
- API routes → Deterministic baseline: runs baseline
- Multi-agent workflow → Supervisor: starts graph
- Supervisor → Sales analysis: dispatches
- Supervisor → Inventory pricing: dispatches
- Supervisor → Policy worker: dispatches
- Sales analysis → Sales tools: queries sales
- Inventory pricing → Inventory and pricing tools: calculates pricing
- Policy worker → Hybrid policy retrieval: retrieves evidence
- Multi-agent workflow → Strategy planner: plans from evidence
- Multi-agent workflow → Compliance reviewer: reviews plan
- Multi-agent workflow → Draft execution: creates draft
- Draft execution → Campaign tools: stages campaign
- Sales tools → Commerce database: reads data
- Inventory and pricing tools → Commerce database: reads data
- Campaign tools → Commerce database: writes draft
- Commerce database → Business models: stores
- Hybrid policy retrieval → Commerce database: reads policies and chunks
- Hybrid policy retrieval → Embedding and reranking: embeds and reranks
- Policy indexing → Embedding and reranking: creates embeddings
- Policy indexing → Commerce database: stores indexed chunks
- Multi-agent workflow → Agent model provider: requests decisions
- Agent model provider → DashScope services: calls model
- Embedding and reranking → DashScope services: calls embedding and reranker
- API routes → Human approval: starts and decides
- Human approval → Workflow checkpointer: persists graph state
- Human approval → Commerce database: stores tasks and decisions
- Operations console → Human approval: views approval center
- Agent evaluation → Multi-agent workflow: evaluates runs
- Retrieval evaluation → Hybrid policy retrieval: scores retrieval
- Platform data sync → Gateway factory: selects gateway
- Gateway factory → Shop gateways: provides gateway
- Shop gateways → Mock gateway: implemented by
- Shop gateways → Taobao adapter: implemented by
- Platform data sync → Commerce database: synchronizes business data