How nagarjundas1994-aiagents/enterprise-ai-procurement works
This is an enterprise procurement application: users create and track requisitions, approvals and purchase orders, while invoices undergo three-way matching. The Next.js ProcureChat UI proxies requests to SAP CAP services; MCP and A2A expose business capabilities to agents and clients. Backend handlers apply authentication, tenant-scoped authorization, validation, workflow policy and audit. The README documents PostgreSQL persistence and the wider procurement domain. Some listed capabilities, including catalog, supplier and audit handlers, were not excerpted; their placement and links rely on README documentation, not inspection of their implementation.
Main entry points: server.js CAP server · procurement-service.ts Requisitions and orders · agent-service.ts Agent orchestration · context.ts Request identity
Components 30
User interfaces
- ProcureChat UI
frontend/app/page.js - Chat panel
frontend/components/ChatPanel.js - Procurement worklist
frontend/components/Worklist.js - Charts and diagrams
frontend/components/ChartBlock.js - Backend client
frontend/lib/backend.js
Procurement services
- CAP server
srv/server.js - Requisitions and orders
srv/procurement-service.ts - Approvals
srv/approval-service.ts - Invoice matching
srv/invoice-service.ts - Catalog
srv/catalog-service.ts - Supplier management
srv/supplier-service.ts - Audit queries
srv/audit-service.ts
Security and workflow
- Request identity
lib/auth/context.ts - Authentication
lib/auth/authentication.ts - RBAC and tenant checks
lib/authorization/authorization.ts - Entity access guards
lib/authorization/entity-guard.ts - Validation and sanitization
lib/validation/validation.ts - State transitions
lib/workflow/lifecycle.ts - Policy and human review
lib/workflow/policy.ts - Audit logging
lib/audit/audit.ts
AI and integrations
- Agent orchestration
srv/agent-service.ts - MCP tools
srv/mcp-service.ts - Agent permissions
lib/agents/agent-auth.ts - AI service
lib/agents/ai-service.ts - A2A client
lib/agents/a2a-client.ts
Persistence
- PostgreSQL
Other components
- Human user
- REST and OData clients
- MCP and A2A clients
- Remote supplier agent
remote-supplier-agent/server.js
Connections 42
- Human user → ProcureChat UI: uses
README.md - ProcureChat UI → Chat panel: renders
frontend/app/page.js - ProcureChat UI → Procurement worklist: renders
frontend/app/page.js - Chat panel → Backend client: requests data
frontend/components/ChatPanel.js - Procurement worklist → Backend client: requests data
frontend/components/Worklist.js - Chat panel → Charts and diagrams: renders
frontend/components/ChatPanel.js - Backend client → CAP server: proxies requests
README.md - REST and OData clients → CAP server: calls API
README.md - MCP and A2A clients → MCP tools: calls tools
README.md - CAP server → Requisitions and orders: serves
- CAP server → Approvals: serves
- CAP server → Invoice matching: serves
- CAP server → Catalog: serves
- CAP server → Supplier management: serves
- CAP server → Audit queries: serves
- Requisitions and orders → Request identity: resolves context
srv/procurement-service.ts - Requisitions and orders → Validation and sanitization: validates input
srv/procurement-service.ts - Requisitions and orders → State transitions: checks transitions
srv/procurement-service.ts - Requisitions and orders → Audit logging: writes events
srv/procurement-service.ts - Approvals → Request identity: resolves context
srv/approval-service.ts - Approvals → State transitions: checks transitions
srv/approval-service.ts - Approvals → Audit logging: writes events
srv/approval-service.ts - Invoice matching → Validation and sanitization: validates and matches
srv/invoice-service.ts - Invoice matching → State transitions: checks transitions
srv/invoice-service.ts - Invoice matching → Audit logging: writes events
srv/invoice-service.ts - Request identity → Authentication: authenticates
lib/auth/context.ts - Request identity → RBAC and tenant checks: requires authentication
lib/auth/context.ts - Request identity → Agent permissions: resolves agent grants
lib/auth/context.ts - Entity access guards → RBAC and tenant checks: enforces permissions
lib/authorization/entity-guard.ts - Agent orchestration → Request identity: resolves context
srv/agent-service.ts - Agent orchestration → Agent permissions: authorizes tools
srv/agent-service.ts - Agent orchestration → AI service: generates plan
srv/agent-service.ts - Agent orchestration → Validation and sanitization: sanitizes input
srv/agent-service.ts - Agent orchestration → A2A client: calls remote agent
srv/agent-service.ts - A2A client → Remote supplier agent: sends A2A request
lib/agents/a2a-client.ts - MCP tools → Request identity: uses context
srv/mcp-service.ts - MCP tools → Agent permissions: checks agent grants
srv/mcp-service.ts - Requisitions and orders → Policy and human review: evaluates policy
README.md - Agent orchestration → Requisitions and orders: invokes business actions
- Agent orchestration → Policy and human review: checks decisions
srv/agent-service.ts - Requisitions and orders → PostgreSQL: persists records
README.md - MCP tools → PostgreSQL: uses CAP data
README.md