A production-grade agentic AI application built with LangGraph and OpenAI GPT-4o that automatically transforms any research topic into a structured blog post draft.
User Topic β Planner β Researcher (parallel Tavily searches) β Writer β Reviewer
β______β (revision loop, max 2x)
β
Final Blog Draft
| Agent | Role | Model |
|---|---|---|
| Planner | Decomposes topic into 4β6 research questions + outline | GPT-4o |
| Researcher | Parallel web searches via Tavily | Tavily API |
| Writer | Synthesizes research β Markdown blog post | GPT-4o |
| Reviewer | Quality gate with revision loop (max 2 cycles) | GPT-4o |
git clone https://github.com/swapyface/research-agent.git
cd research-agent
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # add OPENAI_API_KEY + TAVILY_API_KEY
python main.py --topic "The impact of LLMs on software engineering"uvicorn api:app --reload
curl -X POST http://localhost:8000/research -H "Content-Type: application/json" -d '"'"'{"topic": "Quantum computing in finance"}'"'"'research-agent/
βββ main.py # CLI entrypoint
βββ api.py # FastAPI async REST server
βββ requirements.txt
βββ .env.example
βββ src/
β βββ graph.py # LangGraph StateGraph orchestrator
β βββ agents/ # planner, researcher, writer, reviewer
β βββ prompts/ # All LLM prompts
β βββ utils/ # logger, parsers
βββ tests/
MIT