{"id":28499802,"url":"https://github.com/sagarmaddela/multi-format-autonomous-ai-system","last_synced_at":"2026-04-18T17:03:36.811Z","repository":{"id":297763555,"uuid":"997593670","full_name":"SagarMaddela/Multi-Format-Autonomous-AI-System","owner":"SagarMaddela","description":"This is a multi-agent system that processes inputs from Email, JSON, and PDF, classifies both format + business intent, routes to specialized agents, and dynamically chains a follow-up action based on extracted data (e.g., triggering an alert, generating a summary, flagging a risk).","archived":false,"fork":false,"pushed_at":"2025-06-07T09:28:05.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-07T10:25:52.573Z","etag":null,"topics":["email-parsing","fastapi","genai","langchain","llama3","llm","ollama","pdf-parsing","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SagarMaddela.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-06T19:49:19.000Z","updated_at":"2025-06-07T09:28:09.000Z","dependencies_parsed_at":"2025-06-07T10:36:07.070Z","dependency_job_id":null,"html_url":"https://github.com/SagarMaddela/Multi-Format-Autonomous-AI-System","commit_stats":null,"previous_names":["sagarmaddela/multi-format-autonomous-ai-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SagarMaddela/Multi-Format-Autonomous-AI-System","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagarMaddela%2FMulti-Format-Autonomous-AI-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagarMaddela%2FMulti-Format-Autonomous-AI-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagarMaddela%2FMulti-Format-Autonomous-AI-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagarMaddela%2FMulti-Format-Autonomous-AI-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SagarMaddela","download_url":"https://codeload.github.com/SagarMaddela/Multi-Format-Autonomous-AI-System/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagarMaddela%2FMulti-Format-Autonomous-AI-System/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263445770,"owners_count":23467610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email-parsing","fastapi","genai","langchain","llama3","llm","ollama","pdf-parsing","python"],"created_at":"2025-06-08T15:00:45.376Z","updated_at":"2026-04-18T17:03:36.799Z","avatar_url":"https://github.com/SagarMaddela.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 Multi-Format Autonomous AI System with Contextual Decisioning \u0026 Chained Actions\n\nA smart, multi-agent system capable of autonomously processing Emails, PDFs, and JSON inputs to classify format and business intent, extract relevant fields, and dynamically trigger follow-up actions—while logging everything in a shared memory for audit and traceability.\n\n\n## 🚀 Features\n\n### 🔍 Classifier Agent\n\n* Detects input format: `Email`, `PDF`, or `JSON`\n* Identifies business intent: `RFQ`, `Complaint`, `Invoice`, `Regulation`, `Fraud Risk`\n* Uses few-shot examples and schema matching\n* Stores metadata in shared memory\n\n### 📩 Email Agent\n\n* Extracts sender, urgency, and request details\n* Detects tone: `Polite`, `Escalation`, `Threatening`\n* Triggers action:\n\n  * Escalation → `POST /crm/escalate`\n  * Routine → logs and closes\n\n### 📦 JSON Agent\n\n* Parses webhook-style JSON\n* Validates schema (e.g., required fields, types)\n* Flags anomalies and logs alerts to memory\n\n### 📄 PDF Agent\n\n* Parses PDF using `Tika` and `PyPDF2`\n* Extracts invoice or policy information\n* Triggers alert if:\n\n  * Invoice total \u003e 10,000\n  * Policy mentions \"GDPR\", \"FDA\", etc.\n\n### 🧠 Shared Memory Store\n\n* Maintains:\n\n  * Input metadata\n  * Extracted fields\n  * Chained actions taken\n  * Agent decision traces\n* Implemented using Redis\n\n### 🔁 Action Router\n\n* Routes outcomes to simulated REST endpoints:\n\n  * `POST /crm/escalate`\n  * `POST /risk_alert`\n  * `POST /invoice/flag`\n\n\n## 📂 Project Structure\n\n```\nmulti_agent_system/\n├─ api/\n│  ├─ fake_crm.py\n│  ├─ fake_invoice_api.py\n│  ├─ fake_risk_api.py\n│  ├─ main.py\n│  └─ schemas.py\n├─ classifier_agent/\n│  └─ agent.py\n├─ email_agent/\n│  └─ agent.py\n├─ json_agent/\n│  └─ agent.py\n├─ logs/\n├─ memory/\n│  └─ store.py\n├─ pdf_agent/\n│  └─ agent.py\n├─ router/\n│  └─ action_router.py\n├─ samples/\n│  ├─ emails/\n│  │  ├─ email_sample1.txt\n│  │  ├─ email_sample2.txt\n│  │  ├─ email_sample3.txt\n│  │  ├─ email_sample4.txt\n│  │  └─ email_sample5.txt\n│  ├─ json/\n│  │  ├─ webhook1.json\n│  │  ├─ webhook2.json\n│  │  ├─ webhook3.json\n│  │  ├─ webhook4.json\n│  │  └─ webhook5.json\n│  └─ pdf/\n│     ├─ invoice_sample.pdf (private)\n│     └─ invoice_sample2.pdf (private)\n├─ tests/\n│  ├─ test_classifier.py\n│  ├─ test_email_agent.py\n│  ├─ test_json_agent.py\n│  └─ test_pdf_agent.py\n├─ utils/\n│  └─ llm_utils.py\n├─ .gitignore\n├─ docker-compose.yml\n├─ Dockerfile\n├─ LICENSE\n├─ README.md\n├─ requirements.txt\n└─ supervisord.conf\n\n```\n\n---\n\n## 💡 Example Workflow\n\n1. User uploads an Email.\n2. **Classifier Agent** → Detects: `Email` + `Complaint`\n3. **Email Agent** → Tone: `Angry`, Urgency: `High`\n4. **Action Router** → Calls `POST /crm/escalate`\n5. **Memory** → Logs full trace for audit\n\n---\n\n## 🧪 Sample Inputs\n\n* `email_sample1.txt`: Escalated complaint email\n* `invoice_sample.pdf`: Invoice with line items\n* `webhook1.json`: Webhook with anomalies\n\n---\n\n## 📸 Screenshots\n\n| Email Classification            | PDF Invoice Parsing         | JSON Anomaly                  |\n| ------------------------------- | --------------------------- | ----------------------------- |\n| ![email](screenshots/email_output.png) | ![pdf](screenshots/pdf_output.png) | ![json](screenshots/json_output.png) |\n\n---\n\n## Detailed Working Video \n\n![video](screenshots/final.mp4)\n\n---\n\n## 🛠 Tech Stack\n\n* **Python** + **FastAPI** for microservice architecture\n* **LangChain** + **llama3** LLMs for intent classification and field extraction\n* **PyPDF2** for PDF parsing\n* **Redis** for shared memory\n* **Docker** for containerization\n\n---\n\n## 🧰 How to Run\n\n```bash\n\n# 1. Clone the repository\ngit clone https://github.com/SagarMaddela/Multi-Format-Autonomous-AI-System.git\ncd Multi-Format-Autonomous-AI-System\n\n# 2. Install and run the LLaMA3 model using Ollama\n# (Make sure Ollama is installed: https://ollama.com)\nollama pull llama3\nollama run llama3\n\n```\n\n---\n\n## 🐳 Docker\n\n```bash\n\ndocker compose up --build\n\n```\n\n## Postman or curl \n\n# Make a GET request \nGET/http://localhost:8000/ - Then u will get a response like this \n\n```bash \n{\n    \"message\": \"Classifier API is up and running\"\n}\n\n```\n\n# Make a POST request \nPOST/http://localhost:8000/classify --\u003e \nGo to body --\u003e form-data --\u003e Change the key to file and attach your sample file (email/pdf/json) as value , then u will get some response like this ( A sample response )\n\n```bash \n\n{\n    \"classification\": {\n        \"format\": \"email\",\n        \"intent\": \"complaint\",\n        \"confidence\": 0.9,\n        \"trace_id\": \"6aadf26f-0260-4c0b-b4df-97a635974fe0\",\n        \"logged_at\": \"2025-06-07T17:47:32.233307\"\n    },\n    \"agent_output\": {\n        \"urgency\": \"high\",\n        \"type\": \"complaint\",\n        \"tone\": \"angry\",\n        \"trigger_action\": true,\n        \"action\": \"escalated\",\n        \"agent\": \"EmailAgent\",\n        \"trace_id\": \"4e328014-47d1-4b40-b0c6-509b63bdd6d3\",\n        \"logged_at\": \"2025-06-07T17:47:50.759806\"\n    },\n    \"action_output\": {\n        \"action_triggered\": \"escalate\",\n        \"target_url\": \"http://localhost:9000/crm/escalate\",\n        \"status_code\": 200,\n        \"trace_id\": \"b282fc0c-14a8-4923-8241-78bf41c02950\",\n        \"timestamp\": \"2025-06-07T17:47:50.764720\",\n        \"logged_at\": \"2025-06-07T17:47:50.764763\"\n    }\n}\n```\n\n\n## 🧠 Agent Flow Diagram\n\n```bash\n\n                                        +-----------+                            \n                                        | Input     |                            \n                                        +-----------+\n                                              |\n                                              |\n                                              |\n          +-----------------------------------------------------------------------+\n          |                   SHARED MEMORY   |                                   |\n          |                                   |                                   |\n          |                                   |                                   |\n          |                              +-----------+                            |\n          |                              | Classifier|                            |\n          |                              | Agent     |                            |\n          |                              +-----------+                            |\n          |                                   |                                   |\n          |                                   |                                   |\n          |           ------------------------------------------------            |\n          |           |                       |                     |             |\n          |           |                       |                     |             |                                 \n          |      +-----------+         +-----------+         +-----------+        |\n          |      |  Email    |         |   Json    |         |   PDF     |        |\n          |      |  Agent    |         |  Agent    |         |  Agent    |        |\n          |      +-----------+         +-----------+         +-----------+        |\n          |            \\                    |                     /               |\n          |             \\                   |                    /                |\n          |              \\                  |                   /                 |\n          |             +---------------------------------------------+           |\n          |             |               Action Router                 |           |\n          |             +---------------------------------------------+           |\n          |                                                                       |\n          +----------------------------------------------------------------------+\n\n\n```\n\n---\n\n## 👨‍💻 Developed By\nSagar Maddela\nvenkatasagar.maddela2004@gmail.com\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License.\n\n---\n\n## 🙌 Acknowledgements\n\nSpecial thanks to Flowbit Private Limited for providing the challenge specification.\n\nFor questions or contributions, feel free to raise an issue or pull request!\n\nAll rights reserved © 2025\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagarmaddela%2Fmulti-format-autonomous-ai-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagarmaddela%2Fmulti-format-autonomous-ai-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagarmaddela%2Fmulti-format-autonomous-ai-system/lists"}