How aws-samples/sample-multi-agent-procure-to-pay works
ARIA is an agentic procure-to-pay platform: a user request is handled by specialized agents, approved or escalated, then carried through sourcing, purchase order, receiving, invoice matching and payment against ERPNext. The browser SPA presents operational workflows; FastAPI serves operational endpoints, while a canonical adapter mediates ERP data access and lifecycle services track runs and decisions. The README documents AgentCore, Cedar authorization, a formal-reasoning guardrail and optional simulation; unsampled implementation details are represented conservatively, and links without direct evidence are omitted.
Main entry points: agentcore_app.py AgentCore runtime · invoices.py Invoice processing · App.tsx ARIA SPA · canonical_api.py Canonical ERP API
Components 33
User experience
- ARIA SPA
frontend/src/App.tsx - Requisition workflow
frontend/src/pages/Requisitions.tsx - Invoice workflow
frontend/src/pages/Invoices.tsx - Agent stream hook
frontend/src/hooks/useAgentStream.ts
API and lifecycle
- Operational API
backend/main.py - Chat endpoints
backend/api/chat.py - Invoice processing
backend/api/invoices.py - User identity
backend/services/auth.py - Lifecycle tracking
backend/services/lifecycle.py - Lifecycle store
backend/services/dynamo.py - Invoice extraction
backend/services/textract.py
Procurement agents
- AgentCore runtime
backend/agentcore_app.py - Chat agent
backend/agents/chat_agent.py - Requisition agent
backend/agents/requisition_agent.py - Sourcing agent
backend/agents/sourcing_agent.py - P2P workflow agent
backend/agents/p2p_workflow.py - PO management agent
backend/agents/po_management_agent.py - Receiving agent
backend/agents/receiving_agent.py - Invoice matching
backend/agents/invoice_matching_agent.py - Payment agent
backend/agents/payment_agent.py - AgentCore Gateway
ERP integration
- Canonical ERP API
backend/adapters/canonical_api.py - ERP transport client
backend/services/erp_client.py - Adapter contract
backend/adapters/erp_adapter_base.py - ERPNext adapter
backend/adapters/erpnext/adapter.py - ERPNext REST client
backend/adapters/erpnext/client.py
Demo simulation
- Scenario simulator
utilities/simulation/simulator.py - Simulation API client
utilities/simulation/api_client.py - Scenario state
utilities/simulation/state_manager.py
Other components
- Procurement user
- ERPNext
- Amazon Bedrock
- Human approver
Connections 33
- Procurement user → ARIA SPA: uses
- ARIA SPA → Requisition workflow: routes to
frontend/src/App.tsx - ARIA SPA → Invoice workflow: routes to
frontend/src/App.tsx - Requisition workflow → Agent stream hook: invokes
frontend/src/pages/Requisitions.tsx - Agent stream hook → AgentCore runtime: streams invocation
frontend/src/hooks/useAgentStream.ts - ARIA SPA → Operational API: uses operations
- Operational API → Chat endpoints: registers routes
backend/main.py - Operational API → Invoice processing: registers routes
backend/main.py - Chat endpoints → User identity: authenticates user
- Invoice processing → User identity: gets user email
backend/api/invoices.py - Invoice processing → Invoice extraction: extracts invoice
backend/api/invoices.py - Invoice processing → ERP transport client: creates invoice
backend/api/invoices.py - Invoice processing → Lifecycle tracking: tracks progress
backend/api/invoices.py - Lifecycle tracking → Lifecycle store: reads and writes
backend/services/lifecycle.py - AgentCore runtime → Requisition agent: loads
backend/agentcore_app.py - AgentCore runtime → Sourcing agent: loads
backend/agentcore_app.py - AgentCore runtime → P2P workflow agent: loads
backend/agentcore_app.py - AgentCore runtime → PO management agent: loads
backend/agentcore_app.py - AgentCore runtime → Receiving agent: loads
backend/agentcore_app.py - AgentCore runtime → Invoice matching: loads
backend/agentcore_app.py - AgentCore runtime → Payment agent: loads
backend/agentcore_app.py - Chat agent → ERP transport client: calls
backend/agents/chat_agent.py - AgentCore runtime → AgentCore Gateway: connects tools
backend/agentcore_app.py - AgentCore Gateway → Canonical ERP API: routes ERP tools
- Canonical ERP API → Adapter contract: implements contract
backend/adapters/canonical_api.py - Canonical ERP API → ERPNext adapter: dispatches
backend/adapters/canonical_api.py - ERPNext adapter → ERPNext REST client: calls
backend/adapters/erpnext/adapter.py - ERPNext REST client → ERPNext: reads and writes
backend/adapters/erpnext/client.py - ERP transport client → Canonical ERP API: invokes adapter
backend/services/erp_client.py - Human approver → ARIA SPA: reviews decisions
- Scenario simulator → Simulation API client: calls API
utilities/simulation/api_client.py - Scenario simulator → Scenario state: tracks scenarios
- Scenario simulator → Amazon Bedrock: generates narratives