How ahmadarif238/smart-supplychain-agent works
Smart Supply Chain Agent is a web application for coordinating inventory replenishment under demand and finance constraints. Managers use the React dashboard to inspect operations and launch an agent cycle; the API runs a stateful workflow that fetches supply-chain data, forecasts demand, optimizes reorder decisions, applies finance constraints, negotiates rejected proposals, and records purchase actions. The product also exposes operational views, feedback, and persistent agent memory. README documents the principal decision loop; unsampled route and UI details are represented only at their existing directory paths.
Main entry points: langgraph_workflow.py Workflow orchestration · agent.py Agent endpoints · database.py Application database · App.tsx Web application
Components 21
Manager interface
- Web application
react-app/src/App.tsx - Agent cycle views
react-app/src/pages - Operations views
react-app/src/pages
API and operations
- FastAPI application
main.py - Agent endpoints
app/routes/agent.py - Supply-chain endpoints
app/routes - Authentication
app/auth/dependencies.py - Memory endpoints
app/routes/persistence.py
Agent workflow
- Workflow orchestration
app/agents/langgraph_workflow.py - Cycle state
app/agents/state.py - Data fetch
app/agents/nodes/fetch_data_node.py - Demand forecast
app/agents/nodes/forecast_node.py - Order optimization
app/agents/nodes/intelligent_decision_node.py - Budget review
app/agents/nodes/finance_node.py - Proposal negotiation
app/agents/nodes/review_node.py - Purchase actions
app/agents/nodes/action_node.py - Progress streaming
app/agents/streaming.py - LLM service
app/services/llm_service.py
State and persistence
- Application database
app/models/database.py - Persistent memory
app/persistence/persistent_memory.py
Other components
- Supply manager
Connections 26
- Supply manager → Web application: uses
react-app/src/App.tsx - Web application → Agent cycle views: opens
react-app/src/App.tsx - Web application → Operations views: opens
react-app/src/App.tsx - Agent cycle views → Agent endpoints: requests cycle
- Operations views → Supply-chain endpoints: requests data
- FastAPI application → Agent endpoints: registers
main.py - FastAPI application → Supply-chain endpoints: registers
main.py - Agent endpoints → Authentication: depends on
app/routes/agent.py - Agent endpoints → Workflow orchestration: invokes workflow
app/routes/agent.py - Workflow orchestration → Data fetch: runs stage
app/agents/langgraph_workflow.py - Workflow orchestration → Demand forecast: runs stage
app/agents/langgraph_workflow.py - Workflow orchestration → Order optimization: runs stage
app/agents/langgraph_workflow.py - Workflow orchestration → Budget review: runs stage
app/agents/langgraph_workflow.py - Workflow orchestration → Proposal negotiation: reviews proposals
- Workflow orchestration → Purchase actions: runs stage
app/agents/langgraph_workflow.py - Workflow orchestration → Cycle state: shares state
app/agents/langgraph_workflow.py - Data fetch → Application database: reads supply data
app/agents/nodes/fetch_data_node.py - Demand forecast → LLM service: uses model service
- Demand forecast → Progress streaming: emits progress
app/agents/nodes/forecast_node.py - Proposal negotiation → Progress streaming: emits progress
app/agents/nodes/review_node.py - Purchase actions → Application database: writes orders
app/agents/nodes/action_node.py - Workflow orchestration → Persistent memory: saves run summary
app/agents/langgraph_workflow.py - Supply-chain endpoints → Application database: accesses records
app/routes/persistence.py - Memory endpoints → Application database: accesses memory
app/routes/persistence.py - Persistent memory → Application database: persists records
app/persistence/persistent_memory.py - Agent endpoints → Progress streaming: streams job updates
app/routes/agent.py