This is a multi-agent system that accepts email (.eml) files or JSON files, extracts structured and useful information from them using LLMs, and logs everything into a Redis-based memory system.
- Classifier Agent: Routes incoming documents (emails or JSON) to the correct processing agent
- Email Agent: Extracts metadata and summaries from emails
- JSON Agent: Uses an LLM to normalize unstructured JSON into a predefined schema (e.g., invoice format)
- Redis Memory: All results are stored and organized by document and thread in Redis
git clone <url>
OR If using VSCode use command pallate (By CTRL + SHIFT + P ) then type git -> select git:clone -> paste the url of repo -> select forlder and ENTER.
Make sure you're in a virtual environment, then run:
pip install -r requirements.txt- Recommended: Use WSL (Windows Subsystem for Linux) if on Windows
- Alternatively, you can install Redis using official Redis installation docs
- Run the server and in the config add the port, host and database
- Then add your
OPENAI_API_KEYin theconfig.py
python main.py sample_inputs/tes_json.jsonpython main.py sample_inputs/test_email.emlThe system will:
- Print extracted structured output in the terminal
- Log documents and threads in Redis (with
doc:<id>andthread:<id>format)
You can inspect stored documents via:
- RedisInsight GUI (recommended)
Check requirements.txt — includes:
redis— Redis client for PythonPyMuPDF (fitz)— for PDF/EML parsingopenai— for LLM-based JSON extraction
project/
├── agents/
│ ├── classifier_agent.py
│ ├── email_agent.py
│ └── json_agent.py
├── memory/
│ └── redis_memory.py
├── utils/
│ ├── file_loader.py
│ └── llm_helper.py
|
├── sample_inputs/
│ ├── tes_json.json
│ └── test_email.eml
├── output_samples/
│ ├── screenshots
| | └──(screenshots of output)
| └── Demo.mp4
├── config.py
├── main.py
├── README.md
└── requirements.txt
The folder output_samples/ contains screenshots,demo video and sample outputs of:
- Terminal logs showing extracted information
- RedisInsight views of stored documents and threads
This folder helps in verifying the system's functionality visually.
- Make sure Redis server is running before executing
main.py main.pyautomatically detects the input file type (email or JSON) and routes accordingly- The system can be extended with new agents (e.g., PDFAgent) by plugging into the same interface.
- The classifier agent can be extended to take one ,ore input thread_id to add conversation of a particular thread for easy access with some modification and simple logic