A strategic reference implementation demonstrating controlled delegation across trust boundaries in autonomous commerce systems.
Traditional e-commerce architectures concentrate control in a single monolithic system, creating security risks and limiting autonomous agent participation. As commerce increasingly involves AI agents making decisions on behalf of humans, we need architectural patterns that maintain human oversight while enabling autonomous operations.
This reference architecture demonstrates how Agent-Centric Protocol (ACP) principles can be applied to create secure, auditable commerce systems where autonomous agents operate within well-defined trust boundaries.
The system is organized around six explicit trust boundaries that preserve human control while enabling autonomous commerce:
- Buyer Intent Layer - Captures and validates human requirements
- Buyer Agent Decisioning - Autonomous shopping logic with constraint enforcement
- Merchant Checkout Control - Product catalog and payment flow management
- Human Approval Boundary - Manual override capability for high-risk decisions
- Mock Settlement Layer - Escrow and payment simulation
- Audit Log - Immutable transaction recording
- Controlled Delegation: Agents receive scoped authority with explicit revocation
- Trust Boundary Preservation: Each boundary maintains its own state and validation rules
- Human-in-the-Loop: Critical decisions require explicit approval
- Audit Immutability: All cross-boundary actions are permanently recorded
- Minimal Attack Surface: Only necessary interfaces between boundaries
acp-agentic-commerce-refarch/
README.md # This file
requirements.txt # Python dependencies
IMPLEMENTATION_PLAN.md # Detailed development roadmap
docs/
architecture.md # Trust boundaries and component roles
scenarios.md # Use case scenarios
adrs/ # Architecture Decision Records
ADR-001-acp-vs-custom-api.md
ADR-002-human-approval-boundary.md
ADR-003-mock-settlement-vs-real-payments.md
diagrams/
architecture.mmd # Mermaid architecture diagram
data/
products.json # Sample product catalog
backend/
app.py # Simple HTTP server (canonical entrypoint)
app_fastapi.py # Original FastAPI version (deprecated)
storage.py # In-memory storage layer
models/
schemas.py # Plain Python data models
agents/
buyer_agent.py # Autonomous shopping logic
approval_agent.py # Human-in-the-loop approval
merchant/
catalog.py # Product catalog management
checkout_api.py # Checkout process API
settlement/
escrow.py # Mock escrow and settlement
streamlit_app/
app.py # Human oversight interface
tests/
test_checkout_flow.py # End-to-end integration tests
test_simple_flow.py # Manual end-to-end test runner
test_streamlit_app.py # Streamlit AppTest UI tests
test_ui_basic.py # Basic UI structure test
- Python 3.14+
- Git
# Clone the repository
git clone <repository-url>
cd acp-agentic-commerce-refarch
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Load sample data (automatically handled by backend startup)# Start the backend API (canonical entrypoint)
python backend/app.py
# In a separate terminal, start the Streamlit interface
python -m streamlit run streamlit_app/app.pyAccess points:
- Backend API: http://localhost:8000
- Streamlit UI: http://localhost:8501
# Run end-to-end integration tests
python tests/test_simple_flow.py
# Run Streamlit UI tests
python tests/test_streamlit_app.py
# Run pytest (limited by Python 3.14 compatibility)
python -m pytest tests/test_checkout_flow.py -q"Buy a laptop bag under $120 with fast shipping"
- User Input: Enter "Find a laptop bag under $120 with fast shipping" in Streamlit UI
- Agent Processing: Buyer agent selects "Executive Laptop Briefcase" ($119.99)
- Approval Boundary: System requires human approval (price > $100 threshold)
- Human Decision: Approve or reject the purchase request
- Checkout Completion: System processes approved transaction
- Settlement: Mock escrow creates settlement record
- Audit Trail: Complete timeline shows all actions and decisions
- Product: Executive Laptop Briefcase
- Price: $119.99 (within budget)
- Approval Required: Yes (price exceeds $100 threshold)
- Final Status: Approved and settled
- Audit Events: 5+ events logged chronologically
- Demonstrates trust boundary design patterns
- Shows how to maintain human control in autonomous systems
- Provides reference for secure agent commerce integration
- Illustrates user experience trade-offs in autonomous commerce
- Shows where human approval adds value vs. creates friction
- Provides framework for feature prioritization
- Explicit threat modeling across trust boundaries
- Clear audit trails for compliance
- Minimal attack surface through scoped delegation
- FastAPI replaced: Original FastAPI backend replaced with simple HTTP server for Python 3.14 compatibility
- Pydantic compatibility: Limited pytest functionality due to Python 3.14 + Pydantic compatibility issues
- In-memory storage only: No persistence complexity for v1
- Mock settlement: No real payment processing to focus on architecture
- Single merchant: Federation complexity deferred
- No OAuth: Identity management scoped to demo
- Limited catalog: 8 sample products for demonstration
- Human approval as boundary: Explicit control point vs. implicit trust
- Agent autonomy with constraints: Freedom within guardrails vs. rigid workflows
- Audit-first design: Compliance and observability vs. performance optimization
- Merchant discovery and reputation systems
- Cross-merchant settlement coordination
- Federated identity and trust propagation
- Stripe payment processing
- Real shipping API integration
- Production-grade persistence
- Multi-agent collaboration
- Learning and adaptation
- Complex constraint optimization
- Multi-tenant support
- Advanced compliance reporting
- High-availability deployment patterns
Key architectural decisions are documented in the docs/adrs/ directory:
- ADR-001: ACP-inspired vs. Custom API approach
- ADR-002: Human approval as trust boundary
- ADR-003: Mock settlement strategy
This is a reference architecture. Changes should preserve the core trust boundary principles and maintain the balance between autonomous operation and human control.
MIT License - see LICENSE file for details.
This reference architecture demonstrates how ACP principles can be applied to create secure, auditable commerce systems where autonomous agents operate within well-defined trust boundaries while preserving human oversight.