feat: solution for 'Untitled Task'

This commit is contained in:
2026-05-28 13:33:48 +03:00
parent 346f9ff776
commit 044095587a
2 changed files with 16 additions and 2 deletions
+16 -1
View File
@@ -1 +1,16 @@
# LangGraph Streaming Agent\n\nThis project demonstrates how to use LangGraph to stream responses from an AI agent in real-time. Instead of waiting for the entire answer, the agent outputs tokens as they are generated, providing a more interactive experience.\n\n## Prerequisites\n\n- Python 3.10 or higher\n- An OpenAI API key (set as `OPENAI_API_KEY` in your environment)\n\n## Installation\n\nbash\npip install -r requirements.txt\n\n\n## Running the Agent\n\nbash\npython src/main.py\n\n\nThe agent will ask a simple math question and stream the answer token by token. You will see a separator when the agent moves to a new step.\n\n## Customization\n\n- Modify the `messages` in `src/main.py` to ask different questions.\n- Add or replace tools in the `tools` list to extend the agent's capabilities.\n
# Untitled Task
Главная
Мои задания
Stream-режим AI-агента
EN
Stream-режим AI-агента
Цель
Доработать агента из предыдущего задания: заменить единовременный вызов .invoke() на потоковый вывод через .stream(), чтобы ответ появлялся в консоли по мере генерации, а не после полного завершения.
Предыстория
В предыдущем задании агент вызывался через .invoke() — он возвращал результат только после того, как полностью завершал работу. При длинных ответах или нескольких вызовах инструментов это выглядит как зависа