This project is a compact, friendly example of agentic AI in action. You give it a topic, it builds a complete blog post (title + content). If you add a language, the graph routes the output through translation nodes (Hindi or French). The goal is to be easy to read, easy to run, and easy to extend.
- The graph is explicit: you can see every step of the workflow.
- The code is modular: state, nodes, graph builder, and LLM are separated.
- The API is simple: one POST request gives you a full blog.
- It is designed to hack on: add new nodes or languages quickly.
- Generates a blog title and long-form content from a topic.
- Routes content through translation nodes when a language is provided.
- Exposes the pipeline via a FastAPI endpoint.
- Documents the graphs with Mermaid diagrams.
Topic -> Title Creation -> Content Generation -> Route -> Translation (optional)
+-------------------+
| Title Creation |
+-------------------+
|
v
+-------------------+
| Content Generator |
+-------------------+
|
v
+-------------------+
| Route Node |
+-------------------+
/ \
v v
+----------------+ +----------------+
| Hindi Translate| | French Translate|
+----------------+ +----------------+
Simple agent graph (Content Generation):
flowchart TD
A[Title Generation] --> B[Content Generation]
Full routing graph (Title + Route + Translations):
flowchart TD
A[Title Creation] --> B[Content Generation] --> C[Route Node]
C --> D[Hindi Translation]
C --> E[French Translation]
Graph files live in Graphical Representation/:
Graphical Representation/content-generation-graph.mdGraphical Representation/translation-routing-graph.md
- Create a
.envfile (see Environment variables). - Install dependencies.
- Run the API.
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app:app --reloadCreate .env with the following keys:
GROQ_API_KEY=your_groq_key
LANGCHAIN_API_KEY=your_langsmith_keyPOST /blogs with JSON payload:
{ "topic": "Agentic AI" }Optional translation:
{ "topic": "Agentic AI", "language": "french" }Example curl:
curl -X POST http://localhost:8000/blogs ^
-H "Content-Type: application/json" ^
-d "{\"topic\":\"Agentic AI\",\"language\":\"french\"}".
+-- Graphical Representation
� +-- content-generation-graph.md
� +-- translation-routing-graph.md
+-- app.py
+-- langgraph.json
+-- main.py
+-- pyproject.toml
+-- README.md
+-- request.json
+-- requirements.txt
+-- uv.lock
+-- src
+-- __init__.py
+-- graphs
� +-- __init__.py
� +-- graph_builder.py
+-- llms
� +-- __init__.py
� +-- groqllm.py
+-- nodes
� +-- __init__.py
� +-- blog_node.py
+-- states
+-- __init__.py
+-- blogstare.py
app.py: FastAPI app and/blogsendpoint orchestration.src/graphs/graph_builder.py: LangGraph assembly and conditional routing.src/nodes/blog_node.py: LLM prompts for title, content, and translation.src/llms/groqllm.py: Groq LLM initialization via LangChain.src/states/blogstare.py: Typed state schema for the graph.langgraph.json: LangGraph API discovery entry.request.json: Sample requests for quick testing.
- Python 3.12
- FastAPI + Uvicorn
- LangChain + LangGraph
- Groq (Llama 3.1 8B Instant)
- Pydantic
- python-dotenv
- LangGraph CLI (in-memory)
- Language routing currently supports Hindi and French; add more routes in
src/nodes/blog_node.pyandsrc/graphs/graph_builder.py. main.pyis a simple entry stub and does not run the API.