feat: solution for 'Untitled Task'

This commit is contained in:
2026-05-28 13:09:30 +03:00
commit 130c4f20fb
4 changed files with 95 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
# LangGraph Streaming Agent
This project demonstrates how to use LangGraph's streaming capabilities to display LLM responses token by token in real time.
## Prerequisites
- Python 3.10+
- An OpenAI API key. Set it in a `.env` file or export `OPENAI_API_KEY`.
## Installation
bash
git clone <repo-url>
cd <repo-dir>
python -m venv .venv
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
pip install -r requirements.txt
## Usage
bash
python src/main.py
You will be prompted to enter a question. The answer will stream to the console as it is generated.
## How it works
The script builds a simple LangGraph agent that uses the OpenAI LLM. It calls `agent.stream()` with `stream_mode=['messages', 'updates']` and iterates over the returned chunks, printing each token as it arrives.
## License
MIT