Skip to content

SimoneFiorellino/langgraph-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangGraph Basics

A minimal LangGraph example that powers an RPG-style chatbot. Each user turn is:

  1. summarized into a running campaign recap,
  2. classified into a message type (exploration, combat, or social interaction),
  3. routed to a specialized agent that responds in that mode.

Features

  • Structured classification with Pydantic (MessageClassifier)
  • Persistent state across turns (messages, type, summary)
  • Conditional routing to specialized agents
  • Concise session summary updated every turn

Requirements

  • Python 3.13+
  • A Google Gemini API key (set in .env as GEMINI_API_KEY)

Setup

# from the repo root
uv sync

Create a .env file in the project root:

GEMINI_API_KEY=YOUR_KEY_HERE

Run

python src/main.py

Type messages at the prompt. Use exit to quit.

How it works (high level)

  • summarize_turn maintains a compact session summary
  • classify_message uses structured output to pick a message type
  • router sends the flow to one of three agents
  • Each agent responds with domain-specific guidance

Project layout

.
├── src/
│   └── main.py
├── pyproject.toml
└── README.md

Notes

  • The model is set to gemini-2.5-flash in src/main.py. Adjust if needed.
  • The summary is printed each turn; comment it out if noisy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages