This project demonstrates a creative‑writing agent built with LangGraph and Google Gemini. The underlying graph strings together several LLM powered nodes so a story can evolve from an initial idea to a polished draft.
- Query rewriter – interprets the user prompt and expands it into a detailed description.
- Story ideas generator – proposes multiple plot options.
- Human feedback handler – lets you pick an idea or provide guidance, looping back for more ideas if needed.
- Character & scene generation – creates casts and outlines while a supervisor node rates their quality.
- Draft writer – produces a first draft from the approved outline.
- Macro & micro editors – give structural and line‑level feedback.
- Revision orchestrator – decides whether to loop back for another draft or finish the story. ======= The graph coordinates multiple LLM driven nodes to iterate from a user query all the way to a revised story draft.
- ReAct style reasoning powers decision making between nodes.
- Human‑in‑the‑loop feedback influences story ideas and outlines.
- A Supervisor node evaluates outlines before drafting.
The graph is rendered below and can also be explored in the
writer.ipynb notebook.
- Install Python 3.10+.
- Install dependencies:
pip install -e . - Set environment variables required by
langchain-google-genai(e.g.GOOGLE_API_KEY). You can use a.envfile which is loaded automatically.
Run the graph to compile and visualize it:
python graph.pyThis will build the StateGraph and display the workflow image. From here you
can experiment by calling individual nodes or adapting the graph for your own
projects.
