Two services run side-by-side. Know which one to use.
# Terminal 1 - A2A Service (agents use this)
python ingredient_knowledge_service.py
# Terminal 2 - DB Explorer (frontend uses this)
python db_explorer_service.py| Service | Port | Purpose | Called By |
|---|---|---|---|
| Ingredient Knowledge | 8000 | Ingredient resolution & enrichment | Other agents (A2A) |
| DB Explorer | 8001 | Human-friendly DB exploration | Next.js frontend |
What it does:
- Resolves ingredient identities from names/CAS/INCI
- Enriches ingredient data from web sources (CosIng, PubChem, suppliers)
- Returns unified data structure via A2A protocol
Who calls it:
- Other agents via A2A JSON-RPC protocol
- Not called by frontend directly
Run it:
python ingredient_knowledge_service.pyKey endpoint:
POST /- A2A JSON-RPC endpoint (resolve, ingest, refresh, status)
What it does:
- Provides search UI endpoints (DB, Web, Deep search modes)
- Streams progress via Server-Sent Events (SSE)
- Compares DB vs Web data with side-by-side view
- Saves selected web fields to database
Who calls it:
- Next.js frontend at
http://localhost:8080
Run it:
python db_explorer_service.pyKey endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | /stream/search?mode=deep&query=Glycerin |
SSE streaming search |
| POST | /compare |
Compare DB vs Web data |
| POST | /save-selected |
Save web fields to DB |
| GET | /ingredients |
List all ingredients |
| GET | /enrichment-status |
Data completeness stats |
pip install -r requirements.txtCreate .env file with Azure OpenAI credentials:
AZURE_OPENAI_KEY_0=your_key_here
AZURE_OPENAI_ENDPOINT_0=https://your-resource.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT_0=gpt-4o-mini┌─────────────────┐ A2A (port 8000) ┌─────────────────────────┐
│ Other Agents │ ────────────────────────▶ │ Ingredient Knowledge │
│ (Python) │ JSON-RPC resolve() │ Service │
└─────────────────┘ │ • Identity matching │
│ • Web enrichment │
┌─────────────────┐ HTTP (port 8001) │ • Unified response │
│ Next.js │ ────────────────────────▶ └─────────────────────────┘
│ Frontend │ REST API + SSE ┌─────────────────────────┐
│ (localhost:8080)│ │ DB Explorer Service │
└─────────────────┘ │ • Search UI endpoints │
│ • Compare & Save │
│ • SSE progress streams │
└─────────────────────────┘