Sustainable Sourcing Through Agentic Ai: Trace emissions, materials, and vendor compliance across supply chain.
Procurement and logistics account for a large share of Scope 3 emissions, but tracking their impact is often fragmented, non-actionable, and without real-time tools to analyze environmental impact. This project builds an agentic AI system using LangChain’s ReAct framework to make carbon intelligence conversational, traceable, and decision-ready.
This AI agent aims to make carbon intelligence interactive and data-backed, helping users ask natural questions like:
- "What’s the carbon footprint of a 100kg shipment from Toronto to Vancouver by air?"
- "Who’s the most carbon-efficient packaging supplier for this kind of shipment and why?"
- "List the best certified suppliers with the lowest cost and the lowest emissions by kg of shipment"
It combines real emissions APIs, vector-based document search (RAG), and structured tool invocation to provide trustworthy, data-driven responses.
[Live Demo](https://n-zero-esg-scope3.vercel.app/)
- Making decisions on what tool to use
- Parsing and formatting structured inputs
- Executing external logic (APIs, functions)
- Referring to memory to avoid repeated work and API over-fetching
- Handling fallback paths when tools fail
- Retrieving semantically relevant supplier data using Chroma Vector DB (RAG)
- Returning structured metadata from embedded ESG supplier profiles
- Ranking supplier results based on similarity to the user’s intent
| Stack | Role |
|---|---|
| FastAPI | API framework for serving LLM + tool interactions |
| LangChain (ReAct Agent) | Agent loop + structured tool orchestration |
| OpenRouter / OpenAI | LLM model serving (configurable) |
| Carbon Interface + Climatiq API | Real-time CO₂ emission estimates |
| Transport-mode-aware API calls | Distance resolution from city pairs |
| Caching | Persistent in-memory emissions and queries (in-memory -> Redis) |
| Fallback Logic | Uses IPCC/ECTA factors if APIs fail or exceed limit |
| Chroma Vector DB | Supplier embeddings for semantic vendor search (RAG) |
| Stack | Purpose |
|---|---|
| React + TypeScript | Modern, typed UI for smooth UX (NextJS) |
| Tailwind CSS | Utility-first styling with responsive design |
| Recharts | Visualizes emissions comparisons and reporting |
| Framer Motion | UI animations, loading indicators, typing simulation |
Features:
- Follow-up and context-aware replies
- Auto-scrolling, error-friendly UX
- Typing indicators, graceful error handling, follow-up logic
- Resizable chat UI with drag-handle
- Real-time streaming messages with metadata (confidence, source, time)
- Tool metadata (confidence, processing time, sources)
- LangChain ReAct Agent with structured tool use
- Configurable LLM provider (OpenAI, OpenRouter)
- EmissionsCalculator tool (real API + fallback logic)
- DistanceResolver tool (OpenRouteServiceAPI + geopy + Nominatim)
- OptionComparer tool (supports truck, train, ship, plane)
- Input parser: extracts origin, destination, weight, transport mode
- Clear fallback to reliable emission factors (IPCC, ECTA, CN Rail)
- Conversation memory with LangChain
ConversationBufferMemory - Emissions caching via hash key (avoids redundant API calls)
- SmartSupplierSearch tool using Chroma vector DB for semantic supplier selection based on ESG criteria (materials, transport, certifications, etc.)
- RAG-enabled tool returns structured JSON with metadata (e.g., emissions, delivery time, certifications)
- SmartSupplierSearch (RAG + Chroma Vector DB) and document ingestion (in progress)
- GraphQL gateway - unify microservices and improve system design for scalability and UI integration (in progress)
- Improve Vector search metadata, Outputs
- Redis session and emissions cache
- Upload CSV of purchase orders and tool invocation for emissions analysis
- Procurement simulation tool: cost vs. emissions vs. delivery time tradeoffs
- Vector DB integration (RAG): ESG policy / vendor PDF retrieval
- Vendor compliance checker: e.g., match vendor to sustainability policies
- LangChain Expression Language (LCEL) dynamically adjust agent behavior and more!...
- Frontend improvement: structured rendering of supplier metadata (e.g., certifications, ratings, delivery time, emission intensity), user portal and dataset (file) uploads and management.
- Cloud Computing & IT Emissions
- Employee Commuting / Business Travel
- Waste Disposal Emissions
- Real-time chat interface with:
- Streaming message display
- Tool metadata (confidence, source, processing time)
- Typing indicators and error messages
- Resizable UI and auto-scroll
- Recharts.js integration for emissions comparison visualizations
- Frontend UI using React, TypeScript, TailwindCSS, Framer Motion
Author: David P.