How mihirkothari04/ai-newsroom-team works
Project Type and Purpose
• This is a backend‐only, multi-agent orchestration system written in Python.
• Purpose: automate the end-to-end workflow of “newsroom” tasks—gathering, writing, fact-checking, and optionally editing—by coordinating specialized AI agents via a message‐passing architecture.
File Structure Analysis
• src/agents: implementations of GatherBot, WriterBot, FactCheckBot (+ optional EditorBot).
• src/messaging: the central MessageBus, message definitions, and integration helpers.
• src/orchestrator: NewsroomOrchestrator and its StateManager, which kick off tasks and track progress.
• src/tools: external-integration clients (LLM, News API, web scraper).
• docs/: design and usage docs (API, deployment, examples).
• tests/: unit, integration, and end-to-end workflow tests.
• demo.sh, requirements.txt, todo.md, README.md.
Core Architectural Pattern
• Message-passing / Publish-Subscribe model.
• Orchestrator publishes “new task” messages → Agents subscribe, process, and publish result messages → Orchestrator/state manager collates outputs.
Main Components
a. Orchestrator
• “NewsroomOrchestrator” + “StateManager”
• Role: Accepts client API calls, creates tasks, publishes initial messages, monitors completion.
b. Message Bus
• Central pub/sub broker implemented in src/messaging/message_bus.py
• Handles topic registration, message routing, and delivery guarantees.
c. Agents
• GatherBot
• WriterBot
• FactCheckBot
• (Optional) EditorBot
• Each: subscribes to specific message types, processes payloads, uses tools, publishes results.
d. Tools / External Services
• LLM Client (e.g., OpenAI)
• News API (e.g., newsapi.org)
• Web scraper (custom or third-party)
• These are invoked by agents to fetch or generate content.
e. Clients / Consumers
• CLI/demo script (demo.sh) or any external client that invokes the orchestrator API.
f. Data Persistence (optional)
• StateManager may persist to file, in-memory store, or database (if extended).
• For now: shown as in-memory within StateManager.
Relationships and Data Flow
• External Client → Orchestrator.create_task() → Orchestrator publishes “TaskCreated” message to MessageBus.
• GatherBot listens for “TaskCreated” → uses News API + WebScraper → publishes “GatherComplete” with structured data.
• WriterBot listens for “GatherComplete” → uses LLM Client → publishes “WriteComplete” with draft article.
• FactCheckBot listens for “WriteComplete” → uses News API + credibility logic → publishes “FactCheckComplete” with accuracy report.
• (Optional) EditorBot listens for “FactCheckComplete” → publishes “EditComplete”.
• Orchestrator/state manager listens for final completion messages → aggregates results → client polls Orchestrator.get_task_results().
Key Architectural Patterns and Principles
• Loose coupling via MessageBus (publish/subscribe)
• Single Responsibility: each agent handles a discrete phase
• Extensibility: plug in new agents by subscribing to message types
• Asynchronous workflow enabling parallelism