{"id":488662,"date":"2026-07-27T07:45:55","date_gmt":"2026-07-27T07:45:55","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=488662"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=488662","title":{"rendered":"\u0413\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u044b (Deep Agents) \u2014 \u0432\u0441\u0451 \u0441\u043e\u0431\u0440\u0430\u043b? \u041d\u043e \u043a\u0430\u043a\u043e\u0439 \u0446\u0435\u043d\u043e\u0439?"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 AI-\u0430\u0433\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. \u0413\u0434\u0435-\u0442\u043e \u0431\u0435\u0440\u0443\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u0432 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438. \u0413\u0434\u0435-\u0442\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0438\u0437 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 UI \u043d\u0430 \u0432\u0435\u0431-\u043f\u043e\u0440\u0442\u0430\u043b\u0435. \u0413\u0434\u0435-\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0451: \u0434\u0435\u0448\u0435\u0432\u043b\u0435, \u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043d\u0442\u0443\u0440\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0430\u0447\u0435. \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e &#8212; LangChain \/ LangGraph: \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b, \u0433\u0440\u0430\u0444\u044b, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043a\u0443\u0441\u043a\u0438 \u0430\u0433\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0430\u0433\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 <strong>ReAct<\/strong> (Reasoning + Acting &#8212; \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435): \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0435\u0442, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool), \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0441\u043d\u043e\u0432\u0430 \u0434\u0443\u043c\u0430\u0435\u0442 &#8212; \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0442\u0434\u0430\u0441\u0442 \u043e\u0442\u0432\u0435\u0442. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442. \u041d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 &#8212; \u0430\u0433\u0435\u043d\u0442 \u0441\u0430\u043c \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442: \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043b\u0430\u043d\u044b, \u0444\u0430\u0439\u043b\u044b. \u0412\u043e\u043f\u0440\u043e\u0441 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u00ab\u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u043f\u0442\u00bb \u043a \u00ab\u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439\u00bb. \u042d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <strong>\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433 (context engineering)<\/strong>. <strong>\u0413\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u044b (Deep Agents)<\/strong> &#8212; \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u0438\u0434\u0435\u0438 \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 LangChain: \u043d\u0435 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 (\u0432 API &#8212; <code>create_deep_agent<\/code> \u043f\u043e\u0432\u0435\u0440\u0445 <code>create_agent<\/code>).<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430 \u0441\u043b\u043e\u0432\u043e\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 (deep): \u043a\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430, \u0438\u0437 \u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u043e\u043d\u0430 \u0441\u043e\u0431\u0440\u0430\u043d\u0430, \u043a\u0430\u043a\u0443\u044e \u0446\u0435\u043d\u0443 \u0437\u0430 \u043d\u0438\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0438 \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u00ab\u0442\u044f\u0436\u0451\u043b\u044b\u0439 \u0440\u044e\u043a\u0437\u0430\u043a\u00bb \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0431\u0440\u0430\u0442\u044c.<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043f\u0443\u0442\u044c: \u043e\u0442 LangChain \u043a LangGraph \u043a Deep Agents<\/h2>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f LangChain: \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 <code>Runnable<\/code> \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b, \u0433\u0434\u0435 \u0432\u044b\u0445\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e. \u041e\u0442 <code>Runnable<\/code> \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0451\u0440\u0442\u043e\u043a &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c, \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u0432\u0441\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c: \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, RAG (Retrieval-Augmented Generation), \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u0430 (\u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <code>Runnable<\/code>) \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>|<\/code> (\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0432 LangChain):<\/p>\n<pre><code class=\"python\">from langchain.chat_models import init_chat_modelfrom langchain_core.output_parsers import StrOutputParserfrom langchain_core.prompts import ChatPromptTemplatefrom langchain_core.runnables import RunnablePassthrough# FAQ-\u0431\u0430\u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f\u043c\u0438 (\u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c)retriever = ...prompt = ChatPromptTemplate.from_template(    \"\u0422\u044b \u0430\u0433\u0435\u043d\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438. \u041e\u0442\u0432\u0435\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u043e FAQ.\\n\\nFAQ:\\n{context}\\n\\n\u0412\u043e\u043f\u0440\u043e\u0441: {question}\")model = init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\")inputs = {\"context\": retriever, \"question\": RunnablePassthrough()}chain = inputs | prompt | model | StrOutputParser()print(chain.invoke(\"\u0423 \u043c\u0435\u043d\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0430\"))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u043c\u0435\u043d\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b &#8212; \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043a\u0443\u0441\u043e\u043a, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c. \u0414\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 (\u00ab\u0434\u043e\u0441\u0442\u0430\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u2192 \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u2192 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u043e\u0442\u0432\u0435\u0442\u00bb) \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f LLM \u0432 \u043d\u0438\u0445 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u043c\u0430\u043b\u043e: RAG \u0432\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u044e\u0442 \u043a\u0430\u043a \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) \u043f\u043e\u0438\u0441\u043a\u0430, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0446\u0438\u043a\u043b\u0430 \u00ab\u043c\u043e\u0434\u0435\u043b\u044c \u2194 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools)\u00bb, \u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 if\/else \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c. \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f LangGraph &#8212; \u0433\u0440\u0430\u0444 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043b\u044e\u0431\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u041d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447 \u043d\u0443\u0436\u0435\u043d \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 ReAct-\u0446\u0438\u043a\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0441\u0431\u043e\u0440\u043a\u0443 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>create_agent<\/code>.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/fe5\/37f\/270\/fe537f2701145b5cc7b91e0e696826ae.png\" alt=\"ReAct-\u0446\u0438\u043a\u043b: \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/fe5\/37f\/270\/fe537f2701145b5cc7b91e0e696826ae.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/fe5\/37f\/270\/fe537f2701145b5cc7b91e0e696826ae.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>ReAct-\u0446\u0438\u043a\u043b: \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0433\u0435\u043d\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c (tool) \u00ab\u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u044f\u044f \u0434\u0430\u0442\u0430\u00bb &#8212; \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442:<\/p>\n<pre><code class=\"python\">from datetime import datefrom langchain.agents import create_agentfrom langchain.chat_models import init_chat_modelfrom langchain_core.tools import tool@tooldef today() -&gt; str:    \"\"\"\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u044e\u044e \u0434\u0430\u0442\u0443 \u0432 ISO-\u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u0435\u043d\u044c.\"\"\"    return date.today().isoformat()agent = create_agent(    model=init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\"),    tools=[today],    system_prompt=\"\u041e\u0442\u0432\u0435\u0447\u0430\u0439 \u043a\u0440\u0430\u0442\u043a\u043e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 tools, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.\",)# \u0431\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 today \u0432 tools \u043c\u043e\u0434\u0435\u043b\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0434\u0435\u043d\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f# \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043d\u0435\u0439 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043c\u0435\u0441\u044f\u0446\u0430result = agent.invoke(    {        \"messages\": [            {                \"role\": \"user\",                \"content\": \"\u0427\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043a\u043e\u043d\u0435\u0446 \u043c\u0435\u0441\u044f\u0446\u0430?\",            }        ]    })print(result[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 ReAct-\u0430\u0433\u0435\u043d\u0442 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0430\u0440\u0430\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0432\u044f\u0437\u043a\u0443, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443: \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u0431\u0449\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043e\u0431\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b, \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 (retry) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (guardrails). \u0427\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0430\u0433\u0435\u043d\u0442, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u043e\u0451\u0432 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u044b\u043a\u043e\u0432\u0430\u0442\u044c &#8212; \u0438 \u0447\u0430\u0441\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0435\u0448\u0430\u044e\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 LLM-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u043f\u0442: \u0442\u043e\u0447\u043d\u0435\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u043e\u043b\u044c, \u0437\u0430\u0434\u0430\u0447\u0443, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430. \u041f\u0440\u043e\u043c\u043f\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u0430\u0436\u0435\u043d &#8212; \u043d\u0435\u044f\u0441\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u044f\u0441\u043d\u043e\u0439 \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0451: \u0440\u044f\u0434\u043e\u043c \u043b\u0435\u0436\u0430\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u0438 \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e-\u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443, \u043f\u0440\u043e\u043c\u043f\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u043a\u0443 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0443: \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 &#8212; \u0432\u0435\u0441\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0442\u043e\u043b. \u041d\u0430 \u043d\u0451\u043c \u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0441\u0432\u0435\u0436\u0438\u0435 \u0446\u0438\u0444\u0440\u044b, \u0430 \u043c\u043e\u0433\u0443\u0442 &#8212; \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430, \u0432\u044b\u0432\u043e\u0434 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0435\u0437\u043a\u0438\u0439 \u0432\u0437\u043b\u0451\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u043a\u0438, \u0430 \u0447\u0435\u043c \u043e\u043d\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a; \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e: ReAct-\u0446\u0438\u043a\u043b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0434\u0430 \u0441\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool calls), \u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438, \u043e\u0442\u0447\u0451\u0442\u0430\u043c\u0438 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u043c\u0438; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043b\u0430\u043d\u044b \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u044b. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0451\u043c \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u0435\u043d. \u041d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0440\u0430\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0444\u0430\u043a\u0442, \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c &#8212; \u0443\u0442\u043e\u043d\u0443\u0442\u044c \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043b\u0438\u0448\u043d\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 &#8212; \u0443\u0432\u0435\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0430 \u0441\u0442\u0430\u0440\u0430\u044f \u0438 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <a href=\"https:\/\/www.langchain.com\/blog\/context-engineering-for-agents\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433\u043e\u043c (context engineering)<\/a>. \u0418\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0432\u0443\u0447\u0438\u0442 \u0448\u0438\u0440\u0435, \u0447\u0435\u043c \u00ab\u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u043f\u0442\u00bb: \u0447\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0438 \u043a\u0430\u043a\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0412 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0430\u0433\u0435\u043d\u0442\u0435 \u0442\u0430\u043a\u0430\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0430. \u0412 \u0434\u043b\u0438\u043d\u043d\u043e\u043c \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u0437\u0430\u0445\u043b\u0435\u0431\u043d\u0443\u0442\u044c\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0430\u0433\u0435\u043d\u0442 \u043d\u0430\u043a\u043e\u043f\u0438\u043b \u0441\u0430\u043c. \u0414\u0430\u043b\u044c\u0448\u0435 &#8212; \u043a\u0430\u043a Deep Agents \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u0451\u043c\u043e\u0432 \u0432 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043e\u0431\u0432\u044f\u0437\u043a\u0443.<\/p>\n<h2>Deep Agents: \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447<\/h2>\n<p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/langchain-ai\/deepagents\" rel=\"noopener noreferrer nofollow\"><code>deepagents<\/code><\/a>: \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f 2025-07-27, \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 PyPI <code>0.0.1<\/code> &#8212; 2025-07-29. \u041f\u0430\u043a\u0435\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 pre-1.0 \u0438 \u0436\u0438\u0432\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 LangGraph: \u0432 \u044f\u0434\u0440\u043e (core) \u0435\u0433\u043e \u043d\u0435 \u0432\u043b\u0438\u0432\u0430\u043b\u0438.<\/p>\n<p>\u041f\u043e <a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/overview\" rel=\"noopener noreferrer nofollow\">\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u043e\u0432<\/a>, <code>deepagents<\/code> &#8212; \u044d\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u0430\u044f <strong>\u043e\u0431\u0432\u044f\u0437\u043a\u0430 (harness) \u043f\u043e\u0432\u0435\u0440\u0445 <\/strong><code><strong>create_agent<\/strong><\/code>: \u0442\u043e\u0442 \u0436\u0435 \u0446\u0438\u043a\u043b \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool-calling loop) \u0438 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f LangGraph (runtime), \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0438\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 (middleware), \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools) \u0438 \u043f\u0440\u043e\u043c\u043f\u0442-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 &#8212; \u043f\u043b\u0430\u043d, \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b, \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0442\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b. <strong>\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware)<\/strong> \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u0430\u043f\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0433\u0435\u043d\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0448\u0430\u0433\u0430\u043c\u0438 \u0433\u0440\u0430\u0444\u0430 &#8212; <strong>\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (state)<\/strong>: \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (messages), \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043b\u0430\u043d\u0430 (todo), \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. <strong>\u0411\u044d\u043a\u0435\u043d\u0434 (backend)<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0433\u0434\u0435 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 &#8212; \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0440\u0435\u0434\u0430 (thread), \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (store) \u0438\u043b\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 <code>create_deep_agent<\/code>, \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c:<\/p>\n<ul>\n<li>\n<p>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (<code>write_todos<\/code>);<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b (pluggable backends) \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload) \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>task<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool calls).<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0432\u044b\u043a\u0438 (skills) &#8212; \u0447\u0435\u0440\u0435\u0437 <code>skills=<\/code>, \u043f\u0430\u043c\u044f\u0442\u044c (memory, <code>AGENTS.md<\/code>) &#8212; \u0447\u0435\u0440\u0435\u0437 <code>memory=<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0432 \u0446\u0438\u043a\u043b\u0435 (human-in-the-loop, HITL) &#8212; \u0447\u0435\u0440\u0435\u0437 <code>interrupt_on=<\/code>;<\/p>\n<\/li>\n<li>\n<p><code>execute<\/code> &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c-\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435\u0439 (sandbox backend);<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware) \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u043f\u0442\u0430 (prompt caching) \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0435\u043a, \u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u043a\u044d\u0448 (cache hits) \u0434\u0430\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 Anthropic \u0438 Bedrock.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043d\u0430\u0440\u0443\u0436\u0438 API \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 &#8212; \u043e\u0442\u0441\u044e\u0434\u0430 \u0441\u043e\u0431\u043b\u0430\u0437\u043d \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u0442\u044c Deep Agents \u043a\u0430\u043a \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043c\u043d\u0435\u0435\u00bb \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u043c. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">from deepagents import create_deep_agentfrom langchain.chat_models import init_chat_modelagent = create_deep_agent(    model=init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\"),    tools=[...],  # \u0432\u0430\u0448\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 tools, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b    system_prompt=\"...\",)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f &#8212; \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e. \u0412\u044b\u0431\u043e\u0440 \u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439: \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u0438\u0437 Deep Agents &#8212; \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0442\u0435\u043a\u0430, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 <code>create_agent<\/code> \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c.<\/p>\n<h2>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0445\u043e\u0436\u0435, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043e\u0431\u043b\u0430\u0437\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u0431\u0435\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"python\">agent = create_agent(    model=init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\"),    system_prompt=\"\u0422\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442.\",)state = agent.invoke({\"messages\": [\"\u041e\u0431\u044a\u044f\u0441\u043d\u0438 \u043a\u0440\u0430\u0442\u043a\u043e ReAct-\u0446\u0438\u043a\u043b \u0432 \u0430\u0433\u0435\u043d\u0442\u0430\u0445\"]})print(state[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt) \u0437\u0430\u043d\u044f\u043b <strong>35 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u043d\u0430 <code>create_deep_agent<\/code>:<\/p>\n<pre><code class=\"python\">agent = create_deep_agent(    model=init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\"),    system_prompt=\"\u0422\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442.\",)state = agent.invoke({\"messages\": [\"\u041e\u0431\u044a\u044f\u0441\u043d\u0438 \u043a\u0440\u0430\u0442\u043a\u043e ReAct-\u0446\u0438\u043a\u043b \u0432 \u0430\u0433\u0435\u043d\u0442\u0430\u0445\"]})print(state[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 \u0432\u044b\u0440\u043e\u0441 \u0441 <strong>35 \u0434\u043e 6215 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>, \u0430 \u0432 \u0441\u0445\u0435\u043c\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c <strong>8 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/strong>: <code>write_todos<\/code>, \u0448\u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 <code>task<\/code> \u0434\u043b\u044f \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0443\u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0435\u0439 \u043d\u0430 \u0432\u0445\u043e\u0434. \u0412 \u0442\u0430\u0440\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u043c API \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c, \u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0435\u0449\u0451 \u043c\u043e\u0433\u0443\u0442 \u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 (tools).<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u043e\u0441\u0442 &#8212; \u0443 \u043d\u0435\u0433\u043e \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0430\u043c <code>create_deep_agent<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 (middleware) \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0441\u0432\u043e\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438\u0445 \u0432 \u044d\u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/ed7\/dc2\/662\/ed7dc2662f8ffb1911334a843b1c91cc.png\" alt=\"\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 create_agent \u0438 create_deep_agent \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0443\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/ed7\/dc2\/662\/ed7dc2662f8ffb1911334a843b1c91cc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/ed7\/dc2\/662\/ed7dc2662f8ffb1911334a843b1c91cc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 create_agent \u0438 create_deep_agent \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0443<\/figcaption><\/div>\n<\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f: \u0447\u0442\u043e \u0430\u0433\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u043e \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u043c\u043f\u0442\u0430<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0440\u043e\u0441\u0442\u0430 &#8212; \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <code>BASE_AGENT_PROMPT<\/code> \u0438\u0437 <code>deepagents\/graph.py<\/code>. \u041e\u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0432\u0430\u0448\u0435\u043c\u0443 <code>system_prompt<\/code> \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u0433\u0435\u043d\u0442\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435.<\/p>\n<p><strong>\u0427\u0442\u043e \u043e\u043d\u0430 \u0437\u0430\u0434\u0430\u0451\u0442:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0442\u043e\u043d \u0430\u0433\u0435\u043d\u0442\u0430: \u043a\u043e\u0440\u043e\u0442\u043a\u043e, \u0431\u0435\u0437 \u00abCertainly!\u00bb, \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u043e\u0434\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0440\u043e\u043b\u044c \u00ab\u0441\u0434\u0435\u043b\u0430\u0439 \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043e \u043a\u043e\u043d\u0446\u0430\u00bb, \u0430 \u043d\u0435 \u00ab\u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0438, \u043a\u0430\u043a \u0431\u044b \u0442\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u00bb;<\/p>\n<\/li>\n<li>\n<p>\u0446\u0438\u043a\u043b \u043f\u043e\u043d\u044f\u0442\u044c \u2192 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u2192 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c (understand \u2192 act \u2192 verify), \u043f\u043b\u044e\u0441 \u00ab\u0435\u0441\u043b\u0438 \u0437\u0430\u0441\u0442\u0440\u044f\u043b &#8212; \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0441\u044c \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u00bb;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u0443\u0442\u043e\u0447\u043d\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f (\u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e);<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 &#8212; \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435 (progress updates).<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0437\u0430\u0434\u0430\u0451\u0442 \u043e\u0431\u0449\u0438\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430: \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u043e \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445, \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u041d\u0430 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435 \u0438\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c \u0442\u0435 \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442 \u0443\u0436\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b:<\/p>\n<details class=\"spoiler\">\n<summary>BASE_AGENT_PROMPT &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (43 \u0441\u0442\u0440\u043e\u043a\u0438)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>You are a deep agent, an AI assistant that helps users accomplish tasks using tools. You respond with text and tool calls. The user can see your responses and tool outputs in real time.## Core Behavior- Be concise and direct. Don't over-explain unless asked.- NEVER add unnecessary preamble (\"Sure!\", \"Great question!\", \"I'll now...\").- Don't say \"I'll now do X\" - just do it.- If the request is underspecified, ask only the minimum followup needed to take the next useful action.- If asked how to approach something, explain first, then act.## Professional Objectivity- Prioritize accuracy over validating the user's beliefs- Disagree respectfully when the user is incorrect- Avoid unnecessary superlatives, praise, or emotional validation## Doing TasksWhen the user asks you to do something:1. **Understand first** - read relevant files, check existing patterns. Quick but thorough - gather enough evidence to start, then iterate.2. **Act** - implement the solution. Work quickly but accurately.3. **Verify** - check your work against what was asked, not against your own output. Your first attempt is rarely correct - iterate.Keep working until the task is fully complete. Don't stop partway and explain what you would do - just do it. Only yield back to the user when the task is done or you're genuinely blocked.**When things go wrong:**- If something fails repeatedly, stop and analyze *why* - don't keep retrying the same approach.- If you're blocked, tell the user what's wrong and ask for guidance.## Clarifying Requests- Do not ask for details the user already supplied.- Use reasonable defaults when the request clearly implies them.- Prioritize missing semantics like content, delivery, detail level, or alert criteria.- Avoid opening with a long explanation of tool, scheduling, or integration limitations when a concise blocking followup question would move the task forward.- Ask domain-defining questions before implementation questions.- For monitoring or alerting requests, ask what signals, thresholds, or conditions should trigger an alert.## Progress UpdatesFor longer tasks, provide brief progress updates at reasonable intervals - a concise sentence recapping what you've done and what's next.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043d\u043e \u043d\u0435 \u0432\u0435\u0441\u044c \u0441\u043a\u0430\u0447\u043e\u043a \u0434\u043e 6215 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438 \u0432\u043e\u0441\u044c\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0435\u043a \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0451\u0432 (middleware). \u0427\u0442\u043e\u0431\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 ReAct-\u0446\u0438\u043a\u043b.<\/p>\n<h2>\u0413\u0434\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u0433\u043b\u0443\u0431\u0438\u043d\u0430\u00bb: middleware \u0432 \u0442\u043e\u043c \u0436\u0435 ReAct-\u0446\u0438\u043a\u043b\u0435<\/h2>\n<p>Deep Agents \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0432 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0446\u0438\u043a\u043b \u00ab\u043c\u043e\u0434\u0435\u043b\u044c \u2194 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b\u00bb, \u0430 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f. \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 LangChain \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c (middleware), \u0430 \u0442\u043e\u0447\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430.<\/p>\n<p><strong>\u0422\u043e\u0447\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 (lifecycle hooks): <\/strong><code><strong>before_*<\/strong><\/code><strong> \u0438 <\/strong><code><strong>after_*<\/strong><\/code><strong>.<\/strong> \u0421\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime) \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441\u0430\u043c\u0430 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0446\u0438\u043a\u043b\u0430:<\/p>\n<ul>\n<li>\n<p><code>before_agent<\/code> &#8212; \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<\/li>\n<li>\n<p><code>before_model<\/code> &#8212; \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043a \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>after_model<\/code> &#8212; \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>after_agent<\/code> &#8212; \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 <code>state<\/code> \u0438 <code>runtime<\/code>. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (state) \u0438\u043b\u0438 <code>None<\/code>.<\/p>\n<p><strong>\u041e\u0431\u0451\u0440\u0442\u043a\u0438 (wrappers): <\/strong><code><strong>wrap_model_call<\/strong><\/code><strong> \u0438 <\/strong><code><strong>wrap_tool_call<\/strong><\/code><strong>.<\/strong> \u041e\u043d\u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442 \u0441\u0430\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 <code>request<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>handler<\/code>. \u0412\u044b\u0437\u043e\u0432 <code>handler(request)<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u0434\u043e \u043d\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <strong>\u0434\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/strong>, \u0430 \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 &#8212; <strong>\u043f\u043e\u0441\u043b\u0435<\/strong>. \u041e\u0431\u0451\u0440\u0442\u043a\u0430 (wrapper) \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 (request) \u0438\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (result), \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u0434\u0430\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/cd1\/3e4\/ea4\/cd13e4ea4ae7dad422ea8e4e412fd14e.png\" alt=\"\u0425\u0443\u043a\u0438 \u043e\u0442\u043c\u0435\u0447\u0430\u044e\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b ReAct-\u0446\u0438\u043a\u043b\u0430, \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/cd1\/3e4\/ea4\/cd13e4ea4ae7dad422ea8e4e412fd14e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/cd1\/3e4\/ea4\/cd13e4ea4ae7dad422ea8e4e412fd14e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0425\u0443\u043a\u0438 \u043e\u0442\u043c\u0435\u0447\u0430\u044e\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b ReAct-\u0446\u0438\u043a\u043b\u0430, \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0423 \u043e\u0431\u043e\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b (async) \u0441 \u0442\u0435\u043c \u0436\u0435 \u0441\u043c\u044b\u0441\u043b\u043e\u043c: \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime) \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443 (coroutine), \u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0430 (wrapper) \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>await handler(request)<\/code>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0431\u0435\u0440\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware): \u0442\u043e\u0447\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 (lifecycle hooks) \u043f\u0435\u0447\u0430\u0442\u0430\u044e\u0442 \u0441\u0432\u043e\u0438 \u0438\u043c\u0435\u043d\u0430, \u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 (wrappers) &#8212; \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 <code>handler(request)<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>create_agent<\/code>: Deep Agents \u0437\u0434\u0435\u0441\u044c \u043d\u0438 \u043f\u0440\u0438 \u0447\u0451\u043c, \u0442\u0430\u043a \u0447\u0438\u0449\u0435 \u0432\u0438\u0434\u0435\u043d \u0441\u0430\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0451\u0432 (middleware).<\/p>\n<pre><code class=\"python\">from langchain.agents import create_agentfrom langchain.agents.middleware import AgentMiddlewarefrom langchain.chat_models import init_chat_modelfrom langchain_core.tools import tool@tooldef count_letter(word: str, letter: str) -&gt; int:    \"\"\"\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u0443\u043a\u0432\u0430 letter \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 word (\u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430).\"\"\"    return word.lower().count(letter.lower())class PrintHooksMiddleware(AgentMiddleware):    def before_agent(self, state, runtime):        print(\"\u0410\u0413\u0415\u041d\u0422: \u043d\u0430\u0447\u0430\u043b\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (before_agent)\")        return None    def before_model(self, state, runtime):        print(\"\\n\u041c\u041e\u0414\u0415\u041b\u042c: \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u044b\u0437\u043e\u0432\u0430\")        print(\"  hook before_model\")        return None    def wrap_model_call(self, request, handler):        print(\"    wrapper: \u0434\u043e handler(model)\")        result = handler(request)        print(\"    wrapper: \u043f\u043e\u0441\u043b\u0435 handler(model)\")        return result    def wrap_tool_call(self, request, handler):        tool_call = getattr(request, \"tool_call\", {})        print(f\"\\n\u0418\u041d\u0421\u0422\u0420\u0423\u041c\u0415\u041d\u0422: {tool_call.get('name')} {tool_call.get('args')}\")        print(\"    wrapper: \u0434\u043e handler(tool)\")        result = handler(request)        content = getattr(result, \"content\", result)        print(f\"    wrapper: \u043f\u043e\u0441\u043b\u0435 handler(tool), result={content}\")        return result    def after_model(self, state, runtime):        print(\"  hook after_model\")        return None    def after_agent(self, state, runtime):        print(\"\\n\u0410\u0413\u0415\u041d\u0422: \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (after_agent)\")        return Noneagent = create_agent(    model=init_chat_model(\"qwen\/qwen3.5-9b\", model_provider=\"openai\", base_url=\"http:\/\/localhost:1234\/v1\", api_key=\"x\"),    tools=[count_letter],    system_prompt=\"\u041e\u0442\u0432\u0435\u0447\u0430\u0439 \u043a\u0440\u0430\u0442\u043a\u043e.\",    middleware=[PrintHooksMiddleware()],)state = agent.invoke(    {\"messages\": [{\"role\": \"user\", \"content\": \"\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432 r \u0432 strawberry?\"}]})<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u043e\u043d\u0430:<\/p>\n<pre><code>\u0410\u0413\u0415\u041d\u0422: \u043d\u0430\u0447\u0430\u043b\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (before_agent)\u041c\u041e\u0414\u0415\u041b\u042c: \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u044b\u0437\u043e\u0432\u0430  hook before_model    wrapper: \u0434\u043e handler(model)    wrapper: \u043f\u043e\u0441\u043b\u0435 handler(model)  hook after_model\u0418\u041d\u0421\u0422\u0420\u0423\u041c\u0415\u041d\u0422: count_letter {'word': 'strawberry', 'letter': 'r'}    wrapper: \u0434\u043e handler(tool)    wrapper: \u043f\u043e\u0441\u043b\u0435 handler(tool), result=2\u041c\u041e\u0414\u0415\u041b\u042c: \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u044b\u0437\u043e\u0432\u0430  hook before_model    wrapper: \u0434\u043e handler(model)    wrapper: \u043f\u043e\u0441\u043b\u0435 handler(model)  hook after_model\u0410\u0413\u0415\u041d\u0422: \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (after_agent)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438 (middleware) \u043c\u044b \u0443\u0445\u043e\u0434\u0438\u043c \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u043e\u043a\u0440\u0443\u0433 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 ReAct-\u0446\u0438\u043a\u043b\u0430 &#8212; \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt) \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (state), \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool).<\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u0442\u0438 \u0442\u043e\u0447\u043a\u0438 \u0432 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b: \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043a\u044d\u0448\u0430. \u0412 Deep Agents \u0437\u0430 \u044d\u0442\u0438\u043c \u0441\u0442\u043e\u044f\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>FilesystemMiddleware<\/code>, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c HITL \u0438 \u0441\u043b\u043e\u0439 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u043f\u0442\u0430 (prompt caching). \u0421\u0430\u043c\u0430 \u0442\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f (hook) \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 &#8212; \u043e\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u0451\u0442 \u043a\u043e\u0434\u0443 \u043c\u0435\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0432 \u0446\u0438\u043a\u043b.<\/p>\n<p>\u041d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u043e\u0439 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442. <code>TodoListMiddleware<\/code>, <code>FilesystemMiddleware<\/code> \u0438 <code>SubAgentMiddleware<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b. <code>PatchToolCallsMiddleware<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439, \u0430 <code>SummarizationMiddleware<\/code> \u0432\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u043e\u0433\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, <strong>\u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e<\/strong> \u043e\u043d \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442: \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u043b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443 Deep Agents, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0438\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c:<\/p>\n<ul>\n<li>\n<p><strong>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (Write):<\/strong> todo, \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439; \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441\u0432\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p><strong>\u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442 \u043d\u0443\u0436\u043d\u043e\u0435 (Select):<\/strong> \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c \u0438 \u043d\u0430\u0432\u044b\u043a\u0438 (skills) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p><strong>\u0441\u0436\u0438\u043c\u0430\u044e\u0442 \u043d\u0430\u043a\u043e\u043f\u0438\u0432\u0448\u0435\u0435\u0441\u044f (Compress):<\/strong> \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload) \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u044f\u0436\u0451\u043b\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p><strong>\u0438\u0437\u043e\u043b\u0438\u0440\u0443\u044e\u0442 \u0432\u0435\u0442\u043a\u0438 (Isolate):<\/strong> \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u0438\u0442\u043e\u0433 \u0431\u0435\u0437 \u0432\u0441\u0435\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043a\u0430\u0440\u0442\u0430 \u0437\u0430\u0434\u0430\u0447 \u043e\u0431\u0432\u044f\u0437\u043a\u0438, \u0430 \u043d\u0435 \u043d\u043e\u0432\u044b\u0435 \u044d\u0442\u0430\u043f\u044b ReAct. \u0414\u0430\u043b\u044c\u0448\u0435 &#8212; \u043e\u0434\u043d\u0430 \u0441\u043a\u0432\u043e\u0437\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e &#8212; \u043a\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043e\u043d \u0440\u0435\u0448\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 LangChain \u0438 \u0433\u0434\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438.<\/p>\n<h3>\u042f\u0432\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u043c\u0435\u0436\u0434\u0443 \u0448\u0430\u0433\u0430\u043c\u0438 (TodoListMiddleware)<\/h3>\n<p>\u041d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043b\u0435\u0433\u043a\u043e \u0442\u0435\u0440\u044f\u0435\u0442 \u043d\u0438\u0442\u044c: \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u0434\u0432\u0430 \u0448\u0430\u0433\u0430, \u0437\u0430\u0431\u044b\u043b\u0430 \u0442\u0440\u0435\u0442\u0438\u0439, \u043f\u0435\u0440\u0435\u043f\u0440\u044b\u0433\u043d\u0443\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043b\u0438 \u00ab\u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0430\u00bb \u043d\u0430 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435. \u0427\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0433\u0435\u043d\u0442\u0443.<\/p>\n<p><code>TodoListMiddleware<\/code> \u0434\u0430\u0451\u0442 \u0430\u0433\u0435\u043d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u044f\u0432\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0448\u0430\u0433\u043e\u0432 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 (<code>pending<\/code> \/ <code>in_progress<\/code> \/ <code>completed<\/code>) \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state): \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e \u0445\u043e\u0434\u0443, \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438 \u0447\u0442\u043e \u0432\u043f\u0435\u0440\u0435\u0434\u0438, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u043d, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0430\u043a\u0442\u044b. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u00ab\u043e\u0442\u0432\u0435\u0442\u044c \u0432 \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u00bb \u0441\u043b\u043e\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0438\u0432\u0430\u0435\u0442. \u041d\u043e \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u043d\u043e\u0433\u043e\u044d\u0442\u0430\u043f\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0421\u043b\u043e\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u043a\u0443\u0441\u043e\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u043f\u0442\u0430 (system prompt) &#8212; \u043a\u043e\u0433\u0434\u0430 \u0432\u0435\u0441\u0442\u0438 todo, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0448\u0430\u0433\u0438 \u0438 \u043a\u0430\u043a \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>write_todos<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0435 \u043f\u043b\u0430\u043d\u0430 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state) \u0430\u0433\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u0442 \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0446\u0435\u043b\u0438, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>write_todos<\/code> \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0441 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0437\u0430 \u043c\u043e\u0434\u0435\u043b\u044c\u044e: \u0441\u043b\u043e\u0439 \u0434\u0430\u0451\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0430 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0451\u0442 \u043f\u0440\u043e\u043c\u043f\u0442. \u0414\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u043c\u0430\u043b\u043e &#8212; \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 (workflow), \u0435\u0433\u043e \u0441\u0442\u043e\u0438\u0442 \u044f\u0432\u043d\u043e \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u0435 (system prompt).<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>WRITE_TODOS_SYSTEM_PROMPT &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (18 \u0441\u0442\u0440\u043e\u043a)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>## `write_todos`You have access to the `write_todos` tool to help you manage and plan complex objectives.Use this tool for complex objectives to ensure that you are tracking each necessary step.This tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.It is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.For simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.Writing todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.## Important To-Do List Usage Notes to Remember- The `write_todos` tool should never be called multiple times in parallel.- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.## Finishing a taskWhen you finish all work, write your final answer in the message AFTER your last `write_todos` call - not in the same turn as that call. Start the final message with the substantive content the user asked for - the data, computation, summary, or analysis. The user wants the result, not confirmation that the work is done.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <a href=\"https:\/\/github.com\/langchain-ai\/deepagents\/blob\/main\/examples\/nvidia_deep_agent\/src\/AGENTS.md?plain=1\" rel=\"noopener noreferrer nofollow\"><code>nvidia_deep_agent<\/code><\/a> \u044d\u0442\u0430 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 \u0431\u043b\u043e\u043a <code>Progress Tracking<\/code>: \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0430\u0433\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c todo, \u0430 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u0432\u0435\u0442\u043e\u043c &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043b\u0430\u043d \u0437\u0430\u043a\u0440\u044b\u0442. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 <code>Workflow<\/code>, <code>Progress Tracking<\/code> \u0438 <code>Final Checklist<\/code>.<\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u0438\u0445 \u0438 \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>create_agent<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043a \u043d\u0435\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e <code>TodoListMiddleware<\/code>:<\/p>\n<pre><code class=\"python\">from langchain.agents import create_agentfrom langchain.agents.middleware import TodoListMiddlewarefrom langchain.chat_models import init_chat_modelTODO_SYSTEM_PROMPT = \"\"\"## Workflow1. **Plan and Track**: Always break initial request into focused steps using `write_todos`.2. Process each task one by one and update progress as you complete each step.## Progress Tracking (REQUIRED)You MUST invoke write_todos to update progress after completing each workflow step. Use status values: \"pending\", \"in_progress\", or \"completed\". Before returning, mark ALL tasks as \"completed\".## Final ChecklistBefore returning:1. Invoke write_todos to mark ALL items as \"completed\"2. Verify all aspects of the user's request are addressed\"\"\"model = init_chat_model(    \"google\/gemma-4-12b-qat\",    model_provider=\"openai\",    base_url=\"http:\/\/localhost:1234\/v1\",    api_key=\"x\",)agent = create_agent(    model=model,    system_prompt=TODO_SYSTEM_PROMPT,    middleware=[TodoListMiddleware()],)result = agent.invoke(    {\"messages\": [{\"role\": \"user\", \"content\": \"\u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u00ab\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\u00bb\"}]})print(result.get(\"todos\"))print(result[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 <code>google\/gemma-4-12b-qat<\/code> \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0437\u0432\u0430\u043b <code>write_todos<\/code> <strong>\u043f\u044f\u0442\u044c<\/strong> \u0440\u0430\u0437 \u0438 \u0441\u0430\u043c \u0441\u043e\u0431\u0440\u0430\u043b \u043f\u043b\u0430\u043d \u0438\u0437 \u043f\u044f\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0437\u0430\u043a\u0440\u044b\u043b; \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#8212; \u00ab\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u0438\u00bb &#8212; \u043e\u0441\u0442\u0430\u043b\u0441\u044f <code>in_progress<\/code>, \u0430 \u0432 \u0447\u0430\u0442 \u0443\u0436\u0435 \u0443\u0448\u043b\u0430 \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u043b\u043e\u0432\u0443\u0448\u043a\u0430: \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 <em>\u0438 \u0435\u0441\u0442\u044c<\/em> \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u0442 \u0435\u0449\u0451 \u0440\u0430\u0437 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c <code>completed<\/code>. \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f (middleware): \u043e\u043d \u0434\u0430\u0451\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u043b\u0430\u043d \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state), \u043d\u043e \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c todo. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0433\u043e\u043d\u0430:<\/p>\n<pre><code>[  {    \"content\": \"\u0410\u043d\u0430\u043b\u0438\u0437 \u0442\u0440\u0435\u043d\u0434\u043e\u0432 \u0440\u044b\u043d\u043a\u0430 IT \u043d\u0430 2026 \u0433\u043e\u0434 (\u0418\u0418, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u0434\u0435\u0444\u0438\u0446\u0438\u0442 \u043a\u0430\u0434\u0440\u043e\u0432)\",    \"status\": \"completed\"  },  {    \"content\": \"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0440\u043e\u043b\u0435\u0439 (\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b, AI-\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b)\",    \"status\": \"completed\"  },  {    \"content\": \"\u0421\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u043d\u0430\u0432\u044b\u043a\u043e\u0432 (Hard &amp; Soft Skills)\",    \"status\": \"completed\"  },  {    \"content\": \"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u043e\u0440\u0442\u0444\u043e\u043b\u0438\u043e \u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 (Networking, GitHub, LinkedIn)\",    \"status\": \"completed\"  },  {    \"content\": \"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u0438\",    \"status\": \"in_progress\"  }]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u0447 (todos) \u0432\u0430\u0436\u043d\u0430 \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 <code>result[\"todos\"]<\/code> \u0432 \u043a\u043e\u0434\u0435 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0411\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (prompt) \u043c\u043e\u0436\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043d\u043e \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u043d\u0435 \u0434\u0430\u0451\u0442.<\/p>\n<p>\u041f\u043b\u0430\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u00ab\u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435\u00bb, \u043d\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u043e\u0432 \u0438 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0439 &#8212; \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u0420\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 (FilesystemMiddleware)<\/h3>\n<p>\u0423 \u0444\u0430\u0439\u043b\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u0442\u0440\u0438 \u0440\u043e\u043b\u0438:<\/p>\n<ol>\n<li>\n<p><strong>\u0410\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b<\/strong> &#8212; \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438, \u043e\u0442\u0447\u0451\u0442\u044b, \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 JSON, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 (messages).<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload)<\/strong> &#8212; \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool result) \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439: \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 (backend), \u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043f\u0440\u0435\u0432\u044c\u044e \u0438 \u043f\u0443\u0442\u044c \u043a \u043d\u0435\u043c\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0449\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430<\/strong> \u0441 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438: \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b, \u043d\u0435 \u0437\u0430\u0431\u0438\u0440\u0430\u044f \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 \u0441\u043b\u043e\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u0442\u0438\u043b\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0438 \u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0447\u0430\u0441\u0442\u044f\u043c\u0438. \u0422\u0430\u043c \u0436\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432: \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u0439\u0442\u0438 \u0432 <code>\/large_tool_results\/<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 <code>read_file<\/code> \u0438\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0447\u0435\u0440\u0435\u0437 <code>grep<\/code>.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>FILESYSTEM_SYSTEM_PROMPT &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (20 \u0441\u0442\u0440\u043e\u043a)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>## Following Conventions- Read files before editing - understand existing content before making changes- Mimic existing style, naming conventions, and patterns## Filesystem Tools `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`You have access to a filesystem which you can interact with using these tools.All file paths must start with a \/. Follow the tool docs for the available tools, and use pagination (offset\/limit) when reading large files.- ls: list files in a directory (requires absolute path)- read_file: read a file from the filesystem- write_file: write to a file in the filesystem- edit_file: edit a file in the filesystem- glob: find files matching a pattern (e.g., \"**\/*.py\")- grep: search for text within files## Large Tool ResultsWhen a tool result is too large, it may be offloaded into the filesystem instead of being returned inline. In those cases, use `read_file` to inspect the saved result in chunks, or use `grep` within `\/large_tool_results\/` if you need to search across offloaded tool results and do not know the exact file path. Offloaded tool results are stored under `\/large_tool_results\/&lt;tool_call_id&gt;`.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload) \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool) \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u044e. \u0412 <code>deepagents 0.6.12<\/code> \u043f\u043e\u0440\u043e\u0433 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <strong>20 000 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>: \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0451\u043d\u043d\u043e, \u0438\u0437 \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d. \u041f\u043e\u043a\u0430 \u043e\u0442\u0432\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0432 <code>ToolMessage<\/code> \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u043e\u0433 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d, <code>FilesystemMiddleware<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0440\u0438 \u0448\u0430\u0433\u0430:<\/p>\n<ol>\n<li>\n<p>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 (backend) \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/large_tool_results\/&lt;tool_call_id&gt;<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>ToolMessage<\/code> \u043d\u0430 \u043f\u0440\u0435\u0432\u044c\u044e \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043a\u043e\u043d\u0446\u0430 \u043e\u0442\u0432\u0435\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0443\u0434\u0430 \u0436\u0435 \u043f\u0443\u0442\u044c \u043a \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u043e\u0442\u0432\u0435\u0442\u0430, \u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 (messages). \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c, \u0430\u0433\u0435\u043d\u0442 \u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 <code>read_file<\/code>; \u0435\u0441\u043b\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u043d\u0430 \u043b\u0435\u0436\u0438\u0442, \u0438\u0449\u0435\u0442 \u043f\u043e <code>\/large_tool_results\/<\/code> \u0447\u0435\u0440\u0435\u0437 <code>grep<\/code>. \u0421\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442 &#8212; \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<p>\u041f\u043e\u0440\u043e\u0433 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>tool_token_limit_before_evict<\/code> \u0443 <code>FilesystemMiddleware<\/code>. \u041f\u0440\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c <code>StateBackend<\/code> \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (state), \u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430: \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &#8212; \u043d\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0438\u0441\u043a, \u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 (backend). \u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f (<code>read_file<\/code>, <code>write_file<\/code> \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b). \u0414\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0431\u044d\u043a\u0435\u043d\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0433\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u0435\u0436\u0430\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0438\u0432\u0443\u0442 \u0438 \u043a\u0442\u043e \u0435\u0449\u0451 \u043c\u043e\u0436\u0435\u0442 \u0438\u0445 \u0443\u0432\u0438\u0434\u0435\u0442\u044c.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u043c \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0411\u044d\u043a\u0435\u043d\u0434 (backend)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0413\u0434\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0438\u0432\u0443\u0442 \u0444\u0430\u0439\u043b\u044b<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>StateBackend<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state) \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0440\u0435\u0434\u0430 (thread)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>FilesystemBackend<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0438\u0441\u043a\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0430\u0439\u043b\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u0438\u0434\u043d\u044b \u043b\u044e\u0434\u044f\u043c, CI \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>CompositeBackend<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0430\u0437\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b (backends)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438 \u0443\u0437\u043a\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>StoreBackend<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412 LangGraph Store \u043c\u0435\u0436\u0434\u0443 \u0442\u0440\u0435\u0434\u0430\u043c\u0438 (threads)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u043e\u043b\u0433\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043e\u0431\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430\u043c\u0438<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0441\u0441\u0438\u0438 (StateBackend)<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u00ab\u0444\u0430\u0439\u043b\u044b\u00bb \u043b\u0435\u0436\u0430\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state) \u0430\u0433\u0435\u043d\u0442\u0430 (<code>state[\"files\"]<\/code>), \u0430 \u043d\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 &#8212; \u043e\u0431\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 LangGraph: \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (messages), \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043b\u0430\u043d\u0430 (todos), \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044f. \u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0444\u0430\u0439\u043b\u044b \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 &#8212; \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u0430 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u043f\u043e\u043b\u044f \u0440\u044f\u0434\u043e\u043c \u0441 \u0447\u0430\u0442\u043e\u043c. \u0417\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0442\u0440\u0435\u0434 (thread) &#8212; \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0443\u0448\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0438 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0446\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 (FilesystemBackend)<\/h4>\n<p>\u0417\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u0435\u0437\u0442\u044c \u043d\u0430 \u0434\u0438\u0441\u043a: \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0436\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0431\u044b\u0442\u044c \u0432\u0438\u0434\u043d\u044b \u043b\u044e\u0434\u044f\u043c \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0432\u043d\u0435 \u0430\u0433\u0435\u043d\u0442\u0430. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 &#8212; \u0430\u0433\u0435\u043d\u0442 \u043f\u043e \u0445\u043e\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043f\u0438\u0442 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 <strong>\u043d\u0430\u0432\u044b\u043a\u0438 (skills)<\/strong> (<code>SKILL.md<\/code> \u0438 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 (skills)): \u0437\u0430\u0432\u0442\u0440\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0433\u043e\u043d \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442 \u0442\u0435 \u0436\u0435 \u0444\u0430\u0439\u043b\u044b \u0441 \u0434\u0438\u0441\u043a\u0430, \u0430 \u043d\u0435 \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e <code>state[\"files\"]<\/code>. \u0422\u043e \u0436\u0435 \u043f\u0440\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043f\u0440\u0430\u0432\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u0435, CI-\u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b.<\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <code>FilesystemBackend<\/code>. \u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u0430 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441 <code>root_dir<\/code> \u0438 \u0440\u0435\u0436\u0438\u043c\u043e\u043c \u043f\u0443\u0442\u0435\u0439: \u043f\u0440\u0438 \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0430\u0433\u0435\u043d\u0442 \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 (<code>..<\/code>, \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0432\u0440\u043e\u0434\u0435 <code>\/etc\/passwd<\/code>). \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442: \u0431\u0435\u0437 <code>virtual_mode=True<\/code> \u0434\u0430\u0436\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 <code>root_dir<\/code> <strong>\u043d\u0435<\/strong> \u0434\u0430\u0451\u0442 \u0437\u0430\u0449\u0438\u0442\u044b. \u041e\u0434\u043d\u043e \u043d\u0435\u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u044e\u0441 \u0433\u0430\u043b\u043b\u044e\u0446\u0438\u043d\u0430\u0446\u0438\u044f \u0438\u043b\u0438 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u043c\u043f\u0442 (prompt injection) &#8212; \u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u043b\u0438 \u043f\u0438\u0448\u0435\u0442 \u0442\u043e, \u0447\u0435\u0433\u043e \u0432 \u0437\u043e\u043d\u0435 \u0430\u0433\u0435\u043d\u0442\u0430 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. \u0414\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 API \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 <code>StateBackend<\/code>, <code>StoreBackend<\/code> \u0438\u043b\u0438 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0443 (sandbox), \u0430 \u043f\u0440\u044f\u043c\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0438\u0441\u043a\u0443 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043b\u044f CLI \u0438 CI.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0447\u0430\u0441\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c <code>FilesystemBackend<\/code> \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c, \u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0438\u0441\u043a \u0443\u0437\u043a\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 <code>CompositeBackend<\/code>.<\/p>\n<h4>\u0421\u043c\u0435\u0448\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f (CompositeBackend)<\/h4>\n<p><code>CompositeBackend<\/code> &#8212; \u044d\u0442\u043e \u043c\u0438\u043a\u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u0432 (backends): \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 <code>StateBackend<\/code>, \u0430 \u043a \u043d\u0435\u043c\u0443 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b (backends) &#8212; \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u00ab\u0436\u0438\u0432\u0443\u0442\u00bb \u0432 \u0441\u0432\u043e\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435. \u041d\u0430\u0432\u044b\u043a\u0438 (skills) \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a: \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438, \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload) \u0438 <code>\/large_tool_results\/<\/code> \u0436\u0438\u0432\u0443\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state); <code>\/skills\/<\/code> (\u0438\u043b\u0438 <code>\/workspace\/<\/code>) \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <code>FilesystemBackend<\/code> \u0441 \u0443\u0437\u043a\u0438\u043c <code>root_dir<\/code> \u0438 <code>virtual_mode=True<\/code>. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 &#8212; \u0441\u0431\u0435\u0436\u0430\u0442\u044c \u00ab\u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435\u00bb \u0447\u0435\u0440\u0435\u0437 <code>\/etc\/...<\/code> \u043d\u0435\u043a\u0443\u0434\u0430: \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0439\u0434\u0451\u0442 \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0433\u0434\u0435 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u043d\u0435\u0442 (\u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0430\u043c\u0438 \u0438\u0445 \u0442\u0443\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438).<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e <code>FilesystemBackend<\/code>: \u0435\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0441\u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c, \u0432\u0435\u0441\u044c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a, \u0438 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u043c\u0430\u0445 \u0432 \u043f\u0443\u0442\u044f\u0445 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0440\u0438\u0441\u043a. <code>CompositeBackend<\/code> \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u0435\u043d (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <code>\/skills\/<\/code>), \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0447\u0435\u0440\u0435\u0437 <code>StateBackend<\/code>.<\/p>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 (skills):<\/p>\n<pre><code class=\"python\">from deepagents.backends import CompositeBackend, FilesystemBackend, StateBackendbackend = CompositeBackend(    default=StateBackend(),    routes={        \"\/skills\/\": FilesystemBackend(            root_dir=\"\/srv\/agent-skills\",            virtual_mode=True,        ),    },)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u0451\u0442 \u0441\u0432\u044f\u0437\u043a\u0430 <strong>\u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f + <\/strong><code><strong>virtual_mode<\/strong><\/code><strong> \u043d\u0430 \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u043c \u043a\u0443\u0441\u043a\u0435<\/strong>, \u0430 \u043d\u0435 \u043c\u0430\u0433\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/70f\/ac1\/6df\/70fac16df2331601227c088dabec3bc1.png\" alt=\"\u041a\u0430\u043a CompositeBackend \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/70f\/ac1\/6df\/70fac16df2331601227c088dabec3bc1.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/70f\/ac1\/6df\/70fac16df2331601227c088dabec3bc1.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041a\u0430\u043a CompositeBackend \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b<\/figcaption><\/div>\n<\/figure>\n<h4>\u0424\u0430\u0439\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430\u043c\u0438 (StoreBackend)<\/h4>\n<p><code>StoreBackend<\/code> \u043a\u043b\u0430\u0434\u0451\u0442 \u0442\u0443 \u0436\u0435 \u00ab\u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e\u00bb \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043d\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state) \u043f\u0440\u043e\u0433\u043e\u043d\u0430, \u0430 \u0432 <strong>LangGraph Store<\/strong> (<code>BaseStore<\/code>): \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0451\u043d, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430\u043c\u0438 \u0438 \u0442\u0440\u0435\u0434\u0430\u043c\u0438 (threads). \u0414\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools) \u0442\u0435 \u0436\u0435 (<code>ls<\/code> \/ <code>read_file<\/code> \/ \u2026), \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u043e\u043a \u0436\u0438\u0437\u043d\u0438 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d &#8212; \u0441\u043d\u043e\u0432\u0430 <code>CompositeBackend<\/code>: \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438 \u0438 <code>\/large_tool_results\/<\/code> \u0436\u0438\u0432\u0443\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state), \u0430 <code>\/memories\/<\/code> (\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u044f, \u0434\u043e\u043b\u0433\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u0432\u044b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u044b) &#8212; \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (store). \u0421\u043b\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (memory) \u0432 Deep Agents \u0447\u0430\u0441\u0442\u043e \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u0443\u044e \u0441\u0432\u044f\u0437\u043a\u0443: \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0442\u0440\u0430, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0430 \u043d\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 (messages).<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u043d\u0438\u0436\u0435 \u0431\u0435\u0440\u0451\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>StateBackend<\/code>: \u0446\u0435\u043b\u044c &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u00ab\u0437\u0430\u0434\u0430\u0447\u0430 \u0438 \u043f\u043b\u0430\u043d \u043b\u0435\u0436\u0430\u0442 \u0444\u0430\u0439\u043b\u0430\u043c\u0438\u00bb, \u0430 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 (persistence) \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0434\u0438\u0441\u043a\u0443. \u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>\u0420\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043b\u0430\u043d\u043e\u043c. <code>write_todos<\/code> \u0432\u0435\u0434\u0451\u0442 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state); \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u044f\u0434\u043e\u043c \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442 <strong>\u0441\u0436\u0430\u0442\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/strong> \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432: \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u2192 <code>\/task.md<\/code>, \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043f\u043b\u0430\u043d \u2192 <code>\/plan.md<\/code>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2192 <code>\/article.md<\/code>. \u042d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435: \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u0437\u044f\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 <code>\/task.md<\/code> \u0438 <code>\/plan.md<\/code>, \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f \u0432 \u0441\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u0435\u0441\u044c \u0434\u0438\u0430\u043b\u043e\u0433 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u0439\u0434\u0451\u043c \u0442\u043e\u0439 \u0436\u0435 \u0434\u043e\u0440\u043e\u0433\u043e\u0439: \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c <code>create_agent<\/code> \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438 (middleware) \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0433\u043e <code>create_deep_agent<\/code>. \u041d\u0438\u0436\u0435 &#8212; \u043f\u0440\u0435\u0436\u043d\u044f\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0438 todo-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f:<\/p>\n<pre><code class=\"python\">from deepagents.middleware.filesystem import FilesystemMiddleware# model, create_agent \u0438 TodoListMiddleware \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435.# \u041a \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 TODO_SYSTEM_PROMPT \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.FILESYSTEM_RULES = \"\"\"## Filesystem workflow1. Persist context to the filesystem (StateBackend paths start with `\/`):   - Write the original user request to `\/task.md`   - After the plan exists, write a readable copy of the plan to `\/plan.md`2. Process each todo one by one and update progress via `write_todos`.3. Write the final article to `\/article.md` (Russian, at most 5000 characters).4. Before returning, mark ALL todos as `completed`, then give a short final message   that only confirms paths `\/task.md`, `\/plan.md`, `\/article.md` - do not paste the   full article into chat (it must live in the file).\"\"\"agent = create_agent(    model=model,    system_prompt=TODO_SYSTEM_PROMPT + FILESYSTEM_RULES,    middleware=[TodoListMiddleware(), FilesystemMiddleware()],)# \u0417\u0430\u043f\u0440\u043e\u0441 \u0442\u043e\u0442 \u0436\u0435, \u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435; \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u0432\u044f\u0437\u043a\u0430.result = agent.invoke(    {\"messages\": [{\"role\": \"user\", \"content\": \"\u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u00ab\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\u00bb\"}]})print(result.get(\"todos\"))print(sorted((result.get(\"files\") or {}).keys()))print(result[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 <code>google\/gemma-4-12b-qat<\/code>: 6\u00d7 <code>write_todos<\/code>, 3\u00d7 <code>write_file<\/code>, \u0432\u0441\u0435 \u043f\u044f\u0442\u044c \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043f\u043b\u0430\u043d\u0430 <code>completed<\/code>, \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state) \u043b\u0435\u0436\u0430\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0443\u0442\u0438. \u0424\u0438\u043d\u0430\u043b \u0432 \u0447\u0430\u0442\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 &#8212; \u0441\u0442\u0430\u0442\u044c\u044f \u0432 \u0444\u0430\u0439\u043b\u0435, \u043d\u0435 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 (messages). \u041d\u0438\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0443\u0442\u0435\u0439 \u0438 \u043f\u0440\u0435\u0432\u044c\u044e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e:<\/p>\n<pre><code>files keys: ['\/article.md', '\/plan.md', '\/task.md']\/task.md:\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\/plan.md:# \u041f\u043b\u0430\u043d \u0441\u0442\u0430\u0442\u044c\u0438 \u00ab\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\u00bb1. **\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435**   - \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u044b\u043d\u043a\u0430 (\u043f\u0435\u0440\u0435\u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c Junior-\u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438, \u0440\u043e\u0441\u0442 AI).   - \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f: \u043e\u0442 \u00ab\u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0434\u0438\u0442\u044c\u00bb \u043a \u00ab\u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439\u00bb.2. **\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u0440\u0435\u043d\u0434\u044b \u0440\u044b\u043d\u043a\u0430 \u043a 2026 \u0433\u043e\u0434\u0443**   - **AI-Native \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430**: \u0418\u0418 \u043a\u0430\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (Copilot, Cursor, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432).   - **\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u0430 \u043d\u0430 Soft Skills**: ...\/article.md:... \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043b\u0435\u0436\u0438\u0442 \u0442\u0443\u0442<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043b\u0430\u043d \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0447\u0430\u0442\u0430. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 &#8212; \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u0443 \u0442\u044f\u0436\u0451\u043b\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443: \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u043e\u043c, \u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435.<\/p>\n<h3>\u0414\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f (SubAgentMiddleware)<\/h3>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f: \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b (subagents) \u0440\u0435\u0448\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 <strong>\u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 (context bloat)<\/strong>. \u0422\u044f\u0436\u0451\u043b\u0430\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <strong>\u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c<\/strong> \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435; \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>task<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 <strong>\u043e\u0434\u0438\u043d<\/strong> \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0451\u0442, \u0430 \u043d\u0435 \u0432\u0441\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0433\u043e\u0432. \u0421\u043b\u043e\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043e \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 (prompt), \u0441\u0430\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 <code>task<\/code> \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e \u044d\u0442\u043e \u0441\u0445\u0435\u043c\u0430 \u00ab\u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440 + \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438\u00bb: \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 ReAct \u0436\u0438\u0432\u0451\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0435\u0441\u0442\u044c <code>general-purpose<\/code>. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0442\u044f\u0436\u0451\u043b\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c; \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>task<\/code> \u0434\u043b\u044f \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0433\u0434\u0435 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0448\u0430\u0433\u0438; \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>TASK_SYSTEM_PROMPT &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (31 \u0441\u0442\u0440\u043e\u043a\u0430)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>## `task` (subagent spawner)You have access to a `task` tool to launch short-lived subagents that handle isolated tasks. These agents are ephemeral - they live only for the duration of the task and return a single result.When to use the task tool:- When a task is complex and multi-step, and can be fully delegated in isolation- When a task is independent of other tasks and can run in parallel- When a task requires focused reasoning or heavy token\/context usage that would bloat the orchestrator thread- When sandboxing improves reliability (e.g. code execution, structured searches, data formatting)- When you only care about the output of the subagent, and not the intermediate steps (ex. performing a lot of research and then returned a synthesized report, performing a series of computations or lookups to achieve a concise, relevant answer.)Subagent lifecycle:1. **Spawn** \u2192 Provide clear role, instructions, and expected output2. **Run** \u2192 The subagent completes the task autonomously3. **Return** \u2192 The subagent provides a single structured result4. **Reconcile** \u2192 Incorporate or synthesize the result into the main threadWhen NOT to use the task tool:- If you need to see the intermediate reasoning or steps after the subagent has completed (the task tool hides them)- If the task is trivial (a few tool calls or simple lookup)- If delegating does not reduce token usage, complexity, or context switching- If splitting would add latency without benefit## Important Task Tool Usage Notes to Remember- Whenever possible, parallelize the work that you do. This is true for both tool_calls, and for tasks. Whenever you have independent steps to complete - make tool_calls, or kick off tasks (subagents) in parallel to accomplish them faster. This saves time for the user, which is incredibly important.- Remember to use the `task` tool to silo independent tasks within a multi-part objective.- You should use the `task` tool whenever you have a complex task that will take multiple steps, and is independent from other tasks that the agent needs to complete. These agents are highly competent and efficient.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Available subagents &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 (3 \u0441\u0442\u0440\u043e\u043a\u0438)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>Available subagent types:- general-purpose: General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. This agent has access to all tools as the main agent.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u0442\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0443\u0441\u0442\u044b\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c (state). \u0414\u043b\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c &#8212; \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 <code>task<\/code> &#8212; \u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 todo \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0443, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 <code>\/plan.md<\/code>, \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u0438 \u043e\u0442\u0434\u0430\u0442\u044c \u043d\u0430\u0432\u0435\u0440\u0445 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043e\u0442\u0447\u0451\u0442 \u0431\u0435\u0437 \u0432\u0441\u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430:<\/p>\n<ul>\n<li>\n<p>\u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 <strong>\u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (single handoff)<\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools) \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt);<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 Deep Agents \u0441\u0430\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430 <code>general-purpose<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>task<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u0432\u0430\u0448\u0438\u0445 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043e\u0431\u0432\u044f\u0437\u043a\u0438 (harness profile).<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/8a2\/c8a\/7d2\/8a2c8a7d2660192a864fe31272f66643.png\" alt=\"\u0421\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 ReAct-\u0446\u0438\u043a\u043b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043e\u0434\u0438\u043d ToolMessage\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/8a2\/c8a\/7d2\/8a2c8a7d2660192a864fe31272f66643.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/8a2\/c8a\/7d2\/8a2c8a7d2660192a864fe31272f66643.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 ReAct-\u0446\u0438\u043a\u043b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043e\u0434\u0438\u043d ToolMessage<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442<\/strong><\/p>\n<ul>\n<li>\n<p>\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\/\u043e\u0431\u0445\u043e\u0434 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u043f\u043e\u0438\u0441\u043a, \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432, \u043f\u0430\u0440\u0441\u0438\u043d\u0433);<\/p>\n<\/li>\n<li>\n<p>\u0443\u0437\u043a\u0430\u044f \u0440\u043e\u043b\u044c (\u00ab\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0440\u043a\u0430 \u0444\u0430\u043a\u0442\u043e\u0432\u00bb, \u00ab\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434-\u0441\u0442\u0438\u043b\u044c\u00bb) \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c (prompt);<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0432\u0435\u0442\u043e\u043a (\u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u2192 \u0434\u0432\u0430 task \u2192 \u0441\u0438\u043d\u0442\u0435\u0437 \u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f);<\/p>\n<\/li>\n<li>\n<p>\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u043e\u043c \u0438 \u043d\u0435 \u0443\u0442\u043e\u043d\u0443\u0442\u044c \u0432 \u043b\u043e\u0433\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tools).<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b (overhead)<\/strong><\/p>\n<ul>\n<li>\n<p>\u043e\u0434\u0438\u043d-\u0434\u0432\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool call) \u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0430\u043c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c <strong>\u0432\u0438\u0434\u0435\u043b<\/strong> \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0448\u0430\u0433\u0438 \u043a\u0430\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (messages);<\/p>\n<\/li>\n<li>\n<p>\u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043b\u0430\u0431\u0430\u044f \u0438 \u0443\u0436\u0435 \u043f\u0443\u0442\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u0444\u0430\u043a\u0442\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u044f <code>task<\/code> \u0441\u0440\u0435\u0434\u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tools).<\/p>\n<\/li>\n<\/ul>\n<p>\u0421 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0434\u0435\u0441\u044c \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0430\u0433\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0435\u0451 API \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c <strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <\/strong><code><strong>task<\/strong><\/code><strong> \u0432 \u043e\u0434\u043d\u043e\u043c <\/strong><code><strong>AIMessage<\/strong><\/code>. \u041f\u0440\u043e\u043c\u043f\u0442 (prompt) \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c, \u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u0430. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u043f\u0430\u0447\u043a\u0430 <code>tool_calls<\/code> \u043f\u0440\u0438\u0448\u043b\u0430, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <code>ToolNode<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e; \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0434\u0430\u0451\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 <code>task<\/code> \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0445\u043e\u0434\u0430\u0445, \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0421\u0430\u043c <code>task<\/code> \u043d\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0445\u043e\u0434\u043e\u0432 \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u043f\u043b\u0430\u043d \u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442<\/h4>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0442\u0443 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u044e \u00ab\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\u00bb. \u0420\u0430\u043d\u044c\u0448\u0435 \u043e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442 \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b, \u0438 \u043f\u0438\u0441\u0430\u043b \u0442\u0435\u043a\u0441\u0442 (\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u0447\u0430\u0442, \u043f\u043e\u0442\u043e\u043c \u0432 \u0444\u0430\u0439\u043b\u044b). \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0432\u043e\u0434\u0438\u043c \u0440\u043e\u043b\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u0431\u044b\u043b\u0430 <strong>\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430.<\/p>\n<p><strong>\u041a\u0430\u043a \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/strong><\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0430\u0451\u0442 \u043e\u0434\u043d\u0443 \u0444\u0440\u0430\u0437\u0443-\u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c<\/strong> \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442: \u043a\u043b\u0430\u0434\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 <code>\/task.md<\/code>, \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u043b\u0430\u043d (\u0440\u043e\u0432\u043d\u043e 3 \u0440\u0430\u0437\u0434\u0435\u043b\u0430) \u0432 <code>write_todos<\/code> \u0438 <code>\/plan.md<\/code>, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>task<\/code> \u2192 <code>section-writer<\/code> \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b, \u0437\u0430\u0442\u0435\u043c \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u0442 \u0441\u0435\u043a\u0446\u0438\u0438 \u0432 <code>\/article.md<\/code> \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043f\u0443\u0442\u0435\u0439. \u0422\u0435\u043b\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432 \u043e\u043d <strong>\u043d\u0435<\/strong> \u0441\u043e\u0447\u0438\u043d\u044f\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 <code>task<\/code> \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 <strong>\u043d\u043e\u0432\u043e\u0433\u043e<\/strong> <code>section-writer<\/code>: \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (messages) \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (state) \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u0447\u0438\u0442\u0430\u0435\u0442 <code>\/task.md<\/code> \u0438 <code>\/plan.md<\/code>, \u043f\u0438\u0448\u0435\u0442 \u043e\u0434\u0438\u043d <code>\/sections\/NN.md<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043f\u0443\u0442\u0451\u043c &#8212; \u043d\u0435 \u0432\u0435\u0441\u044c \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a. \u0420\u0430\u0437\u0434\u0435\u043b\u044b \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 <code>task<\/code> \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438: \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime) \u0441\u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>task<\/code> \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a (run), \u0430 \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0440\u0434\u0436\u0430\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (messages). \u041e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>StateBackend<\/code> \u043d\u0438\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u044f\u0432\u043d\u043e\u0439; \u0441\u0430\u043c \u043e\u0431\u043c\u0435\u043d \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u0436\u0435 \u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>create_agent<\/code> \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u0438. \u042d\u0442\u043e \u0442\u043e\u043d\u044c\u0448\u0435, \u0447\u0435\u043c <code>create_deep_agent(subagents=[...])<\/code>: Deep Agents \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u043c\u0443 \u0441\u0442\u0435\u043a\u0443 <code>TodoListMiddleware<\/code>, <code>FilesystemMiddleware<\/code>, <code>SummarizationMiddleware<\/code> \u0438 <code>PatchToolCallsMiddleware<\/code>. \u041d\u0430\u0448 <code>section-writer<\/code> \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0449\u0435 &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439, \u0431\u0435\u0437 \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432: \u0438\u0434\u0435\u044f \u00ab\u043e\u0434\u043d\u0430 \u0440\u043e\u043b\u044c \u2192 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b\u00bb, \u0430 \u043d\u0435 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<pre><code class=\"python\">from deepagents.backends import StateBackendfrom deepagents.middleware.subagents import SubAgentMiddleware# model, create_agent, TodoListMiddleware \u0438 FilesystemMiddleware# \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0434\u0432\u0443\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.# \u041f\u0440\u043e\u043c\u043f\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f: \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0431\u0435\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432PARENT_SYSTEM = \"\"\"You are an orchestrator only. Do not write article section bodies.1. Write the user request to `\/task.md` (short).2. write_todos: exactly 3 section items + 1 assemble item; mirror the 3 sections in `\/plan.md`.3. After `\/plan.md` exists, in ONE assistant turn call `task` three times in parallel   (three tool_calls in the same response), subagent_type=`section-writer`, for   `\/sections\/01.md`, `\/sections\/02.md`, `\/sections\/03.md`.   Each description: section title + output path + \"read \/task.md and \/plan.md first\".   Do not wait for one section before starting the others. Max 3 concurrent task calls.4. Only after all three return, write `\/article.md` by concatenating them (no new prose).5. Mark all todos completed. Final user message: only the file paths.\"\"\"# \u041f\u0440\u043e\u043c\u043f\u0442 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430: \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u0434\u0435\u043b \u2192 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043bSECTION_WRITER_PROMPT = \"\"\"Write ONE Russian article section.Read `\/task.md` and `\/plan.md`. Write only the requested section to the given`\/sections\/NN.md` path (max 1500 characters). Do not write other sections.Reply with one line confirming the path.\"\"\"# \u041e\u0434\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0424\u0421; \u0441\u0430\u043c handoff \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 statebackend = StateBackend()# \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u0430-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f (\u0435\u0433\u043e \u0432\u0438\u0434\u0438\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0432 tool `task`)section_writer = {    \"name\": \"section-writer\",    \"description\": (        \"Writes a single article section to \/sections\/*.md. \"        \"Reads \/task.md and \/plan.md. Call once per section.\"    ),    \"system_prompt\": SECTION_WRITER_PROMPT,    \"model\": model,    # \u0441\u0432\u043e\u0439 FS middleware; \u0444\u0430\u0439\u043b\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0434\u0443\u0442 \u0432 state \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430    \"middleware\": [FilesystemMiddleware(backend=backend)],    \"tools\": [],}# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f: \u043f\u043b\u0430\u043d + \u0444\u0430\u0439\u043b\u044b + \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0432\u0430\u0442\u044c \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u043e\u0432agent = create_agent(    model=model,    system_prompt=PARENT_SYSTEM,    middleware=[        TodoListMiddleware(),                       # \u043f\u043b\u0430\u043d \u0432 state        FilesystemMiddleware(backend=backend),      # \/task.md, \/plan.md, \u0441\u0431\u043e\u0440\u043a\u0430        SubAgentMiddleware(backend=backend, subagents=[section_writer]),  # tool task    ],)# \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043d\u043e\u0432\u0430 \u0442\u043e\u0442 \u0436\u0435; \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0440\u043e\u043b\u0438 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.result = agent.invoke(    {\"messages\": [{\"role\": \"user\", \"content\": \"\u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u00ab\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 IT \u0432 2026\u00bb\"}]})# \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043b\u0430\u043d, \u0444\u0430\u0439\u043b\u044b \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442print(result.get(\"todos\"))print(sorted((result.get(\"files\") or {}).keys()))print(result[\"messages\"][-1].content)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u0433\u043e\u043d\u0435<\/strong> (<code>google\/gemma-4-12b-qat<\/code>). \u0424\u0430\u0439\u043b\u044b \u0438 \u043f\u043b\u0430\u043d \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 (todos) \u0437\u0430\u043a\u0440\u044b\u0442. \u0412 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 (prompt) \u043f\u0440\u043e\u0441\u0438\u043b\u0438 \u0442\u0440\u0438 <code>task<\/code>:<\/p>\n<pre><code>\u0434\u043e \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: write_todos, write_file, write_todos, write_file, write_todos\u0445\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 1: task  # \/sections\/01.md\u0445\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 2: task  # \/sections\/02.md\u0445\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 3: task  # \/sections\/03.md\u043f\u043e\u0441\u043b\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: read_file, read_file, read_file, write_file, write_todostodos: 4\/4 completedfiles: \/task.md, \/plan.md, \/sections\/01.md, \/sections\/02.md, \/sections\/03.md, \/article.md<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0412\u044b\u0432\u043e\u0434.<\/strong> \u0421\u0445\u0435\u043c\u0430 \u00ab\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u2192 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u043f\u0438\u0448\u0435\u0442 \u043e\u0434\u0438\u043d \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u2192 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u00bb \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0421\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b \u0441\u0435\u0439\u0447\u0430\u0441 &#8212; \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0440\u0435\u043d\u0434, \u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430: \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c &#8212; \u043e\u0431\u044b\u0447\u043d\u044b\u0435 ReAct-\u0430\u0433\u0435\u043d\u0442\u044b, \u0430 \u0434\u043b\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>task<\/code>. \u041d\u043e\u0432\u0438\u0437\u043d\u0430 Deep Agents &#8212; \u0432 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0430 \u043d\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0421 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0447\u0438\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0435\u0441\u043b\u0438 \u0448\u0430\u0433 \u043e\u0431\u043e\u0440\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435.<\/p>\n<h3>\u0421\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430 (PatchToolCallsMiddleware)<\/h3>\n<p>\u0423 \u0434\u043b\u0438\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) \u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool result): \u043f\u0440\u0438\u0448\u043b\u043e \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u043b\u0438 \u0438\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u044b. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0432\u044b\u0437\u043e\u0432, \u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043a\u043b\u043e\u043d\u0451\u043d \u0438\u0437-\u0437\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u044b\u0442\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u0435\u0435: \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0451\u043d \u0443\u0436\u0435 \u0441\u0430\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. <code>PatchToolCallsMiddleware<\/code> \u043f\u0435\u0440\u0435\u0434 \u043d\u043e\u0432\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0439 <code>ToolMessage<\/code>: \u0432\u044b\u0437\u043e\u0432 \u0431\u044b\u043b \u043e\u0442\u043c\u0435\u043d\u0451\u043d \u043b\u0438\u0431\u043e \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0438\u0437-\u0437\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0421\u043b\u043e\u0439 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438 \u043d\u0435 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 &#8212; \u043e\u043d \u0447\u0438\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime), \u0447\u0442\u043e\u0431\u044b ReAct-\u0446\u0438\u043a\u043b \u043c\u043e\u0433 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c\u0441\u044f. Deep Agents \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<h3>\u0414\u043b\u0438\u043d\u043d\u0430\u044f \u0441\u0435\u0441\u0441\u0438\u044f: \u0441\u0436\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u043a\u0430\u043d\u043e\u043d (SummarizationMiddleware)<\/h3>\n<p>\u0414\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u044b \u0438 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u0442\u044f\u0436\u0451\u043b\u044b\u0445 \u0432\u0435\u0442\u043e\u043a \u0443 \u0430\u0433\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0440\u0430\u0441\u0442\u0438 \u0441\u0430\u043c\u0430 \u043b\u0435\u043d\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043e\u043d\u0430 \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u043a\u043d\u043e \u043c\u043e\u0434\u0435\u043b\u0438. \u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c LangChain \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 Deep Agents. \u0412 LangChain \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 <code>SummarizationMiddleware<\/code>: \u043e\u043d \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0430\u0440\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. Deep Agents \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0434\u043b\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438: \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0432\u044b\u0442\u0435\u0441\u043d\u0435\u043d\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 (backend), \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 <code>state[\"messages\"]<\/code> \u043d\u0435\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u043c, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433\u0438 \u043f\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0443\u043c\u0435\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u044d\u0442\u043e\u0442 \u0441\u043b\u043e\u0439 \u043d\u0435 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u00ab\u043a\u0430\u043a \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00bb. \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 <code>summary_prompt<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0438-\u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043f\u043e\u0440\u043e\u0433\u0430. \u041f\u043e\u0441\u043b\u0435 \u0441\u0436\u0430\u0442\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0441\u0432\u043e\u0434\u043a\u0443 \u0438 \u0441\u0432\u0435\u0436\u0438\u0439 \u0445\u0432\u043e\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c.<\/strong> \u0412 <code>create_deep_agent<\/code> \u0441\u043b\u043e\u0439 \u0443\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0451\u043d: \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0440\u043e\u0433\u0438, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <code>SummarizationMiddleware<\/code> \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043e\u0431\u0432\u044f\u0437\u043a\u0438 (harness profile), \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432 <code>middleware=<\/code>. \u0414\u0432\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u044f (middleware) \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c <code>.name<\/code> \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 &#8212; \u0442\u0430\u043a\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u0435.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u0431\u0435\u0437 \u0434\u043b\u0438\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0430:<\/p>\n<pre><code class=\"python\">from deepagents import (    HarnessProfile,    create_deep_agent,    register_harness_profile,)from deepagents.backends import StateBackendfrom deepagents.middleware.summarization import SummarizationMiddlewarefrom langchain.chat_models import init_chat_modelmodel = init_chat_model(    \"qwen\/qwen3.5-9b\",    model_provider=\"openai\",    base_url=\"http:\/\/localhost:1234\/v1\",    api_key=\"x\",)backend = StateBackend()# \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.register_harness_profile(    \"openai:qwen\/qwen3.5-9b\",    HarnessProfile(        excluded_middleware=frozenset({\"SummarizationMiddleware\"}),    ),)summarization = SummarizationMiddleware(    model=model,    backend=backend,    trigger=(\"tokens\", 20_000),       # \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441\u0436\u0430\u0442\u0438\u0435    keep=(\"messages\", 6),             # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u0435\u0441\u0442\u044c    trim_tokens_to_summarize=12_000,  # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0442\u0434\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0443)agent = create_deep_agent(    model=model,    backend=backend,    middleware=[summarization],)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0434\u043e <strong>20 000 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/strong>, \u043f\u0435\u0440\u0435\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware) \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u0441\u0442\u0430\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0432\u043e\u0434\u043a\u0443 (summary), \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0448\u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u043e\u0434\u043a\u0430 \u0438 \u0441\u0432\u0435\u0436\u0438\u0439 \u0445\u0432\u043e\u0441\u0442, \u043d\u043e \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 <code>state[\"messages\"]<\/code> \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0412\u044b\u0442\u0435\u0441\u043d\u0435\u043d\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u044d\u043a\u0435\u043d\u0434 (backend) \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/conversation_history\/{thread_id}.md<\/code>: \u0435\u0441\u043b\u0438 \u043f\u043e\u0437\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c, \u0430\u0433\u0435\u043d\u0442 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437 <code>read_file<\/code> \u0438\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0435\u0451 \u0447\u0435\u0440\u0435\u0437 <code>grep<\/code>.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/f93\/55f\/e18\/f9355fe18eda9517b9d25a41024368a5.png\" alt=\"\u0421\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0432 state\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/f93\/55f\/e18\/f9355fe18eda9517b9d25a41024368a5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/f93\/55f\/e18\/f9355fe18eda9517b9d25a41024368a5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0432 state<\/figcaption><\/div>\n<\/figure>\n<p>\u0423 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043f\u043e\u0440\u043e\u0433\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <code>max_input_tokens<\/code>, \u0441\u0436\u0430\u0442\u0438\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 <strong>85% \u043e\u043a\u043d\u0430<\/strong>, \u0430 \u043e\u043a\u043e\u043b\u043e 10% \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u0435\u0436\u0438\u043c \u0445\u0432\u043e\u0441\u0442\u043e\u043c. \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u043a\u043d\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u0432 <code>deepagents 0.6.12<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: <code>trigger<\/code> \u043d\u0430 170 000 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0448\u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044f. \u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 &#8212; \u0432 <a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/context-engineering\" rel=\"noopener noreferrer nofollow\">Context engineering<\/a>.<\/p>\n<p>\u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0441\u043b\u043e\u0439 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d. \u0412 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441\u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0430\u0433\u0435\u043d\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432: \u0441\u0442\u0430\u0440\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043d\u043e \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0432 \u0431\u044d\u043a\u0435\u043d\u0434\u0435 (backend).<\/p>\n<h3>\u041d\u0430\u0432\u044b\u043a\u0438 (skills) \u0438 \u043f\u0430\u043c\u044f\u0442\u044c (memory) &#8212; \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u043d\u0430\u0435\u0442<\/h3>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043a \u043d\u0430 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043d. \u041d\u0430\u0432\u044b\u043a\u0438 (skills) \u0438 \u043f\u0430\u043c\u044f\u0442\u044c (memory) &#8212; \u0434\u0432\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u044f (middleware), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0437\u0430 \u0445\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u044b, \u0430 \u0437\u0430 \u0442\u043e, <strong>\u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u043d\u0430\u0435\u0442 \u0438 \u043f\u043e\u043c\u043d\u0438\u0442<\/strong>. \u041e\u043d\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 <code>skills=<\/code> \/ <code>memory=<\/code> \u0438 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0432\u044b\u043a\u0438 (skills) \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u0434\u0430\u0447\u0435 &#8212; \u044d\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u043c\u043d\u043e\u0433\u0438\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f <code>SKILL.md<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u043c\u044f\u0442\u044c (memory) \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0444\u043e\u043d\u043e\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u0435 (system prompt) &#8212; \u044d\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u043c\u043d\u043e\u0433\u0438\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f <code>AGENTS.md<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0420\u0435\u0446\u0435\u043f\u0442\u044b \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 (SkillsMiddleware \/ SKILL.md)<\/h4>\n<p>\u041d\u0430\u0432\u044b\u043a\u0438 &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435 (progressive disclosure) \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439: \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0430\u0433\u0435\u043d\u0442 \u043f\u0438\u0448\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438: \u0434\u043b\u044f \u043e\u0442\u0447\u0451\u0442\u0430 \u043d\u0443\u0436\u043d\u044b \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 &#8212; \u0448\u0430\u0433\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0432\u044b\u043a (skill), \u0431\u0435\u0437 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0432 \u043e\u0431\u0449\u0438\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt).<\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u0434\u0432\u0430 \u043d\u0430\u0432\u044b\u043a\u0430 (skills) \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<p><code>.\/agent-data\/skills\/analytical-report\/SKILL.md<\/code>:<\/p>\n<pre><code>---name: analytical-reportdescription: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439.---\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0431\u0435\u0440\u0438 \u0444\u0430\u043a\u0442\u044b \u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438. \u0417\u0430\u0442\u0435\u043c \u0434\u0430\u0439 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434,\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>.\/agent-data\/skills\/user-guide\/SKILL.md<\/code>:<\/p>\n<pre><code>---name: user-guidedescription: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.---\u0423\u043a\u0430\u0436\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438, \u0440\u0430\u0437\u0431\u0435\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0435 \u0448\u0430\u0433\u0438,\u0434\u043e\u0431\u0430\u0432\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0447\u0430\u0441\u0442\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>CompositeBackend<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043f\u0443\u0442\u044c \u0432 <code>skills=<\/code>:<\/p>\n<pre><code class=\"python\">from deepagents import create_deep_agentfrom deepagents.backends import CompositeBackend, FilesystemBackend, StateBackendbackend = CompositeBackend(    default=StateBackend(),    routes={        \"\/skills\/\": FilesystemBackend(            root_dir=\".\/agent-data\/skills\",            virtual_mode=True,        ),    },)agent = create_deep_agent(    model=model,     backend=backend,    skills=[\"\/skills\/\"],    # \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \/skills\/)result = agent.invoke(    {\"messages\": [{\"role\": \"user\", \"content\": \"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u043e\u0447\u0442\u044b\"}]})<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt) \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f <code>analytical-report<\/code> \u0438 <code>user-guide<\/code>. \u041f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u043e\u0447\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c <code>user-guide<\/code>, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0434\u0438\u0441\u043a\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 &#8212; \u0432 <a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/skills\" rel=\"noopener noreferrer nofollow\">Skills<\/a>.<\/p>\n<h4>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0444\u043e\u043d \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 (MemoryMiddleware \/ AGENTS.md)<\/h4>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c (memory) \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b <strong>\u0432 \u043a\u0430\u0436\u0434\u043e\u043c<\/strong> \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0435: \u0441\u0442\u0438\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0451\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0437\u0430\u043f\u0440\u0435\u0442\u0430 \u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c <code>.env<\/code>, \u0442\u043e\u043d\u0430 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u042d\u0442\u043e \u043d\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u00ab\u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c X\u00bb, \u0430 \u0444\u043e\u043d, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044f\u0442 <code>AGENTS.md<\/code> &#8212; \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0443\u0442\u0435\u0439 &#8212; \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0438\u0445 \u0432 <code>memory=<\/code> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u0433\u0435\u043d\u0442\u0430. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0436\u0438\u0432\u0451\u0442 \u0432 \u0431\u044d\u043a\u0435\u043d\u0434\u0435 (backend). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 &#8212; \u0432 <a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/memory\" rel=\"noopener noreferrer nofollow\">Memory<\/a>.<\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 (skills): \u043f\u0430\u043c\u044f\u0442\u044c (memory) <strong>\u0432\u0441\u0435\u0433\u0434\u0430<\/strong> \u043f\u043e\u0434\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt), \u0430 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0421\u043b\u043e\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>AGENTS.md<\/code>, \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, &#8212; \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <code>memory=<\/code> \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0443\u0442\u044f\u0436\u0435\u043b\u044f\u0435\u0442 \u043e\u0431\u0432\u044f\u0437\u043a\u0443, \u0430 \u0444\u0430\u0439\u043b \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c. \u0414\u043b\u0438\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043b\u0443\u0447\u0448\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0432\u044b\u043a\u0430\u0445 (skills).<\/p>\n<p><code>MemoryMiddleware<\/code> \u0441\u0430\u043c \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0432\u0435\u0447\u043d\u044b\u043c: \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 <code>AGENTS.md<\/code> \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0430. \u0421\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c <code>StateBackend<\/code> \u043f\u0430\u043c\u044f\u0442\u044c \u0436\u0438\u0432\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0442\u0440\u0435\u0434\u0435 (thread); \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0432\u044b\u0439 \u0442\u0440\u0435\u0434 \u0443\u0432\u0438\u0434\u0435\u043b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u0435\u043d \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 <code>StoreBackend<\/code>, <code>FilesystemBackend<\/code> \u0438\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 <code>CompositeBackend<\/code>. \u0423\u0436\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 &#8212; \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043c\u043f\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u041f\u043e \u0442\u043e\u043a\u0435\u043d\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>AGENTS.md<\/code> \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e\u0442 \u0436\u0435 \u0442\u0435\u043a\u0441\u0442 \u0432 <code>system_prompt<\/code>, \u043f\u043b\u044e\u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u0432\u044f\u0437\u043a\u0430 \u0441\u043b\u043e\u044f. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043c\u044b\u0441\u043b \u0434\u0440\u0443\u0433\u043e\u0439: \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u0434\u0430, \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 &#8212; \u0441 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c &#8212; \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430\u043c\u0438. \u0412 <code>system_prompt=<\/code> \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u043b\u044c \u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430; \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 &#8212; \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0436\u0438\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435. \u0414\u043b\u044f \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u044d\u0442\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e; \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u043f\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044e &#8212; \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u041e\u0431\u0449\u0438\u0435 \u0441\u043e\u0432\u0435\u0442\u044b<\/h2>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u043a\u0430\u043a Deep Agents \u043d\u0430\u0440\u0430\u0449\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0442\u043e\u0433\u043e \u0436\u0435 ReAct-\u0446\u0438\u043a\u043b\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0451\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0438 \u0433\u0434\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043b\u0438\u0448\u043d\u044e\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p><strong>1. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0431\u0430\u043b\u0430\u043d\u0441, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u043c \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0430\u0433\u0435\u043d\u0442.<\/strong><\/p>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u043a\u0440\u0430\u044e &#8212; \u0431\u0430\u0437\u043e\u0432\u044b\u0439 ReAct \u0447\u0435\u0440\u0435\u0437 <code>create_agent<\/code>: \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u0441\u0432\u043e\u0439 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (prompt), \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0430. \u041d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c &#8212; <code>create_deep_agent<\/code> \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u043e\u0439 (harness): todo, \u0444\u0430\u0439\u043b\u044b, \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b, \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0433\u0438\u0433\u0438\u0435\u043d\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u041d\u0430\u0432\u044b\u043a\u0438 \u0438 \u043f\u0430\u043c\u044f\u0442\u044c &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u044b. \u0415\u0441\u0442\u044c \u0438 \u043f\u0443\u0442\u044c \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435: \u043a <code>create_agent<\/code> \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 (middleware), \u0430 \u043d\u0435 \u00ab\u0432\u0435\u0441\u044c \u0440\u044e\u043a\u0437\u0430\u043a \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u00bb.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u043e\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443: \u043a\u0430\u043a\u043e\u0439 \u0448\u0430\u0433 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0436\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u0430\u043a\u043e\u0439 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (messages), \u043a\u0430\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime). \u0415\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435\u0442 &#8212; \u0441\u043b\u043e\u0439 \u043f\u043e\u043a\u0430 \u043b\u0438\u0448\u043d\u0438\u0439. \u041e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 <code>FilesystemMiddleware<\/code> \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u043c \u0432 FAQ-\u0431\u043e\u0442\u0435 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0432 \u0430\u0433\u0435\u043d\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0442\u0447\u0451\u0442 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>\u0427\u0435\u043c \u0441\u043b\u0430\u0431\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c, \u0442\u0435\u043c \u0442\u044f\u0436\u0435\u043b\u0435\u0435 \u0435\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt), \u043c\u0435\u043d\u044e \u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tools) \u0438 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430. \u041f\u0443\u0442\u0430\u043d\u0438\u0446\u0430 \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0438\u043b\u0438 \u0441\u0440\u044b\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 &#8212; \u043f\u0440\u0438\u0437\u043d\u0430\u043a, \u0447\u0442\u043e \u0441\u0442\u0435\u043a \u0434\u043b\u044f \u043d\u0435\u0451 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0451\u043b.<\/p>\n<p><strong>2. \u041a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043f\u0442\u0430 (prompt caching) (Anthropic \/ Bedrock).<\/strong><\/p>\n<p>\u0412 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt), \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c. \u0414\u043b\u044f Anthropic \u0438 Amazon Bedrock <code>create_deep_agent<\/code> \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442 \u0435\u0433\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043a\u0430\u043a \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u043a\u044d\u0448\u0430 (cache-eligible) (<a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/overview#prompt-caching\" rel=\"noopener noreferrer nofollow\">prompt caching<\/a>): \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0441\u043d\u0438\u0436\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 (latency) \u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware) \u0443\u0436\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0435\u043a, \u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u044d\u0448 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 &#8212; \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 1-4 \u0442\u044b\u0441. \u0442\u043e\u043a\u0435\u043d\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0437 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u043a\u044d\u0448. \u041d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u0445 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 (no-op).<\/p>\n<p><strong>3. \u0427\u0435\u043b\u043e\u0432\u0435\u043a \u0432 \u0446\u0438\u043a\u043b\u0435 (HITL) &#8212; \u043f\u0430\u0443\u0437\u0430 \u043f\u0435\u0440\u0435\u0434 \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c.<\/strong><\/p>\n<p>Deep Agents \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u043f\u0440\u044f\u043c\u043e \u0432 \u0446\u0438\u043a\u043b \u0430\u0433\u0435\u043d\u0442\u0430. \u0412 <code>interrupt_on<\/code> \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443:<\/p>\n<pre><code class=\"python\">agent = create_deep_agent(    model=model,    interrupt_on={        \"write_file\": True,        \"edit_file\": True,    },)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0435\u0448\u0438\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445, \u0433\u0440\u0430\u0444 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f <strong>\u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/strong> \u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0438\u043c\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (tool) \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b. \u0412\u044b\u0437\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c, \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u043a (run). \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 (prompt), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u043f\u0430\u0443\u0437\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime).<\/p>\n<p>\u041d\u0430 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445 \u0441 <code>StateBackend<\/code> \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0430: \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0436\u0438\u0432\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (state). \u041e\u043d\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u043e\u0439, \u043a\u043e\u0433\u0434\u0430 \u0430\u0433\u0435\u043d\u0442 \u043f\u0438\u0448\u0435\u0442 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a, \u043c\u0435\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u0412 Deep Agents \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0444 &#8212; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u0433\u0435\u043d\u0442\u0430. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u043e\u0431\u0437\u043e\u0440\u0430; \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>4. \u041f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0430 (sandbox) \/ <\/strong><code><strong>execute<\/strong><\/code><strong>.<\/strong><\/p>\n<p>\u0412\u044b\u0448\u0435 \u043c\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043f\u0440\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0435\u0451 \u0437\u0430\u0449\u0438\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 (backend) (<code>StateBackend<\/code>, \u0443\u0437\u043a\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, <code>virtual_mode<\/code>). \u041d\u043e \u0430\u0433\u0435\u043d\u0442\u0430\u043c \u0432\u0441\u0451 \u0447\u0430\u0449\u0435 \u0434\u0430\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b, \u043d\u043e \u0438 <strong>\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u0434<\/strong> &#8212; \u043e\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 matplotlib \u0434\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u043f\u0430\u0441\u0435\u043d \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0430: \u0430\u0433\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u0443\u044e shell-\u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u0430\u043c \u0438\u043b\u0438 \u0443\u0440\u043e\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 Deep Agents \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u043d\u043e\u0441\u044f\u0442 \u0432 <strong>\u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u044d\u043a\u0435\u043d\u0434-\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0443 (sandbox backend)<\/strong> &#8212; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u0415\u0441\u043b\u0438 \u0431\u044d\u043a\u0435\u043d\u0434 (backend) \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u044b (sandbox protocol), Deep Agents \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) <code>execute<\/code>, \u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u043d\u0443 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443. \u0414\u0435\u0442\u0430\u043b\u0438 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439 \u0435\u0441\u0442\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/docs.langchain.com\/oss\/python\/deepagents\/sandboxes\" rel=\"noopener noreferrer nofollow\">Sandboxes<\/a>.<\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c LangChain <code>create_agent<\/code>: <a href=\"https:\/\/docs.langchain.com\/oss\/python\/langchain\/middleware\/built-in#shell-tool\" rel=\"noopener noreferrer nofollow\"><code>ShellToolMiddleware<\/code> \u0441 <code>DockerExecutionPolicy<\/code><\/a> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 \u0430\u0433\u0435\u043d\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (run). \u0417\u0430\u0434\u0430\u0447\u0430 \u0442\u0430 \u0436\u0435 &#8212; \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u0445\u043e\u0441\u0442\u0430. \u041d\u043e \u0442\u043e\u0447\u043a\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0430\u044f: LangChain \u0437\u0430\u0434\u0430\u0451\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f shell-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u0430 Deep Agents \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 <code>execute<\/code> \u0447\u0435\u0440\u0435\u0437 \u0431\u044d\u043a\u0435\u043d\u0434-\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0443 (sandbox backend).<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1063332\/\">https:\/\/habr.com\/ru\/articles\/1063332\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 AI-\u0430\u0433\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. \u0413\u0434\u0435-\u0442\u043e \u0431\u0435\u0440\u0443\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u0432 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438. \u0413\u0434\u0435-\u0442\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0438\u0437 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 UI \u043d\u0430 \u0432\u0435\u0431-\u043f\u043e\u0440\u0442\u0430\u043b\u0435. \u0413\u0434\u0435-\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0451: \u0434\u0435\u0448\u0435\u0432\u043b\u0435, \u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043d\u0442\u0443\u0440\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0430\u0447\u0435. \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e &#8212; LangChain \/ LangGraph: \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b, \u0433\u0440\u0430\u0444\u044b, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043a\u0443\u0441\u043a\u0438 \u0430\u0433\u0435\u043d\u0442\u0430.\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0430\u0433\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 ReAct (Reasoning + Acting &#8212; \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435): \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0435\u0442, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool), \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0441\u043d\u043e\u0432\u0430 \u0434\u0443\u043c\u0430\u0435\u0442 &#8212; \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0442\u0434\u0430\u0441\u0442 \u043e\u0442\u0432\u0435\u0442. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442. \u041d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 &#8212; \u0430\u0433\u0435\u043d\u0442 \u0441\u0430\u043c \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442: \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043b\u0430\u043d\u044b, \u0444\u0430\u0439\u043b\u044b. \u0412\u043e\u043f\u0440\u043e\u0441 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u00ab\u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u043f\u0442\u00bb \u043a \u00ab\u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439\u00bb. \u042d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433 (context engineering). \u0413\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u044b (Deep Agents) &#8212; \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u0438\u0434\u0435\u0438 \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 LangChain: \u043d\u0435 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 (\u0432 API &#8212; create_deep_agent \u043f\u043e\u0432\u0435\u0440\u0445 create_agent).\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430 \u0441\u043b\u043e\u0432\u043e\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 (deep): \u043a\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430, \u0438\u0437 \u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u043e\u043d\u0430 \u0441\u043e\u0431\u0440\u0430\u043d\u0430, \u043a\u0430\u043a\u0443\u044e \u0446\u0435\u043d\u0443 \u0437\u0430 \u043d\u0438\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0438 \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u00ab\u0442\u044f\u0436\u0451\u043b\u044b\u0439 \u0440\u044e\u043a\u0437\u0430\u043a\u00bb \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0431\u0440\u0430\u0442\u044c.\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043f\u0443\u0442\u044c: \u043e\u0442 LangChain \u043a LangGraph \u043a Deep Agents\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u043e\u0441\u044c.\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f LangChain: \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 Runnable \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b, \u0433\u0434\u0435 \u0432\u044b\u0445\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e. \u041e\u0442 Runnable \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0451\u0440\u0442\u043e\u043a &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c, \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u0432\u0441\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c: \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, RAG (Retrieval-Augmented Generation), \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u0430 (\u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a Runnable) \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 | (\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0432 LangChain):from langchain.chat_models import init_chat_modelfrom langchain_core.output_parsers import StrOutputParserfrom langchain_core.prompts import ChatPromptTemplatefrom langchain_core.runnables import RunnablePassthrough# FAQ-\u0431\u0430\u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f\u043c\u0438 (\u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c)retriever = &#8230;prompt = ChatPromptTemplate.from_template(    &#171;\u0422\u044b \u0430\u0433\u0435\u043d\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438. \u041e\u0442\u0432\u0435\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u043e FAQ.\\n\\nFAQ:\\n{context}\\n\\n\u0412\u043e\u043f\u0440\u043e\u0441: {question}&#187;)model = init_chat_model(&#171;qwen\/qwen3.5-9b&#187;, model_provider=&#187;openai&#187;, base_url=&#187;http:\/\/localhost:1234\/v1&#8243;, api_key=&#187;x&#187;)inputs = {&#171;context&#187;: retriever, &#171;question&#187;: RunnablePassthrough()}chain = inputs | prompt | model | StrOutputParser()print(chain.invoke(&#171;\u0423 \u043c\u0435\u043d\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0430&#187;))\u0421\u043c\u0435\u043d\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b &#8212; \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043a\u0443\u0441\u043e\u043a, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c. \u0414\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 (\u00ab\u0434\u043e\u0441\u0442\u0430\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u2192 \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u2192 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u043e\u0442\u0432\u0435\u0442\u00bb) \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f LLM \u0432 \u043d\u0438\u0445 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c.\u041b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u043c\u0430\u043b\u043e: RAG \u0432\u0441\u0451 \u0447\u0430\u0449\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u044e\u0442 \u043a\u0430\u043a \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) \u043f\u043e\u0438\u0441\u043a\u0430, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0446\u0438\u043a\u043b\u0430 \u00ab\u043c\u043e\u0434\u0435\u043b\u044c \u2194 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools)\u00bb, \u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 if\/else \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c. \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f LangGraph &#8212; \u0433\u0440\u0430\u0444 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043b\u044e\u0431\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u041d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447 \u043d\u0443\u0436\u0435\u043d \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 ReAct-\u0446\u0438\u043a\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0441\u0431\u043e\u0440\u043a\u0443 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 create_agent.ReAct-\u0446\u0438\u043a\u043b: \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0433\u0435\u043d\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c (tool) \u00ab\u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u044f\u044f \u0434\u0430\u0442\u0430\u00bb &#8212; \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442:from datetime import datefrom langchain.agents import create_agentfrom langchain.chat_models import init_chat_modelfrom langchain_core.tools import tool@tooldef today() -&gt; str:    &#171;&#187;&#187;\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u044e\u044e \u0434\u0430\u0442\u0443 \u0432 ISO-\u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u0435\u043d\u044c.&#187;&#187;&#187;    return date.today().isoformat()agent = create_agent(    model=init_chat_model(&#171;qwen\/qwen3.5-9b&#187;, model_provider=&#187;openai&#187;, base_url=&#187;http:\/\/localhost:1234\/v1&#8243;, api_key=&#187;x&#187;),    tools=[today],    system_prompt=&#187;\u041e\u0442\u0432\u0435\u0447\u0430\u0439 \u043a\u0440\u0430\u0442\u043a\u043e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 tools, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.&#187;,)# \u0431\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 today \u0432 tools \u043c\u043e\u0434\u0435\u043b\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0434\u0435\u043d\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f# \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043d\u0435\u0439 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043c\u0435\u0441\u044f\u0446\u0430result = agent.invoke(    {        &#171;messages&#187;: [            {                &#171;role&#187;: &#171;user&#187;,                &#171;content&#187;: &#171;\u0427\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043a\u043e\u043d\u0435\u0446 \u043c\u0435\u0441\u044f\u0446\u0430?&#187;,            }        ]    })print(result[&#171;messages&#187;][-1].content)\u041f\u0440\u043e\u0441\u0442\u043e\u0439 ReAct-\u0430\u0433\u0435\u043d\u0442 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0430\u0440\u0430\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0432\u044f\u0437\u043a\u0443, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443: \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u0431\u0449\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043e\u0431\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b, \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 (retry) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (guardrails). \u0427\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0430\u0433\u0435\u043d\u0442, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u043e\u0451\u0432 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u044b\u043a\u043e\u0432\u0430\u0442\u044c &#8212; \u0438 \u0447\u0430\u0441\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0435\u0448\u0430\u044e\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435.\u0412 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 LLM-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u043f\u0442: \u0442\u043e\u0447\u043d\u0435\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u043e\u043b\u044c, \u0437\u0430\u0434\u0430\u0447\u0443, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430. \u041f\u0440\u043e\u043c\u043f\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u0430\u0436\u0435\u043d &#8212; \u043d\u0435\u044f\u0441\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u044f\u0441\u043d\u043e\u0439 \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0451: \u0440\u044f\u0434\u043e\u043c \u043b\u0435\u0436\u0430\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u0438 \u043f\u0430\u043c\u044f\u0442\u044c.\u0415\u0441\u043b\u0438 \u043f\u043e-\u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443, \u043f\u0440\u043e\u043c\u043f\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u043a\u0443 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0443: \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 &#8212; \u0432\u0435\u0441\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0442\u043e\u043b. \u041d\u0430 \u043d\u0451\u043c \u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0441\u0432\u0435\u0436\u0438\u0435 \u0446\u0438\u0444\u0440\u044b, \u0430 \u043c\u043e\u0433\u0443\u0442 &#8212; \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430, \u0432\u044b\u0432\u043e\u0434 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0435\u0437\u043a\u0438\u0439 \u0432\u0437\u043b\u0451\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u043a\u0438, \u0430 \u0447\u0435\u043c \u043e\u043d\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a; \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0430.\u0414\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e: ReAct-\u0446\u0438\u043a\u043b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0434\u0430 \u0441\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool calls), \u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438, \u043e\u0442\u0447\u0451\u0442\u0430\u043c\u0438 \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u043c\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u043c\u0438; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043b\u0430\u043d\u044b \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u044b. \u041d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0451\u043c \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u0435\u043d. \u041d\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0440\u0430\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0444\u0430\u043a\u0442, \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c &#8212; \u0443\u0442\u043e\u043d\u0443\u0442\u044c \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043b\u0438\u0448\u043d\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 &#8212; \u0443\u0432\u0435\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0430 \u0441\u0442\u0430\u0440\u0430\u044f \u0438 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443.\u0420\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433\u043e\u043c (context engineering). \u0418\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0432\u0443\u0447\u0438\u0442 \u0448\u0438\u0440\u0435, \u0447\u0435\u043c \u00ab\u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u043f\u0442\u00bb: \u0447\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0438 \u043a\u0430\u043a\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0412 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0430\u0433\u0435\u043d\u0442\u0435 \u0442\u0430\u043a\u0430\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0430. \u0412 \u0434\u043b\u0438\u043d\u043d\u043e\u043c \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u0437\u0430\u0445\u043b\u0435\u0431\u043d\u0443\u0442\u044c\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0430\u0433\u0435\u043d\u0442 \u043d\u0430\u043a\u043e\u043f\u0438\u043b \u0441\u0430\u043c. \u0414\u0430\u043b\u044c\u0448\u0435 &#8212; \u043a\u0430\u043a Deep Agents \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u0451\u043c\u043e\u0432 \u0432 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043e\u0431\u0432\u044f\u0437\u043a\u0443.Deep Agents: \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 deepagents: \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f 2025-07-27, \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 PyPI 0.0.1 &#8212; 2025-07-29. \u041f\u0430\u043a\u0435\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 pre-1.0 \u0438 \u0436\u0438\u0432\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 LangGraph: \u0432 \u044f\u0434\u0440\u043e (core) \u0435\u0433\u043e \u043d\u0435 \u0432\u043b\u0438\u0432\u0430\u043b\u0438.\u041f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u043e\u0432, deepagents &#8212; \u044d\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u043e\u0431\u0432\u044f\u0437\u043a\u0430 (harness) \u043f\u043e\u0432\u0435\u0440\u0445 create_agent: \u0442\u043e\u0442 \u0436\u0435 \u0446\u0438\u043a\u043b \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool-calling loop) \u0438 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f LangGraph (runtime), \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0438\u0445 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 (middleware), \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools) \u0438 \u043f\u0440\u043e\u043c\u043f\u0442-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 &#8212; \u043f\u043b\u0430\u043d, \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b, \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0442\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b. \u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware) \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u0430\u043f\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0433\u0435\u043d\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041e\u0431\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0448\u0430\u0433\u0430\u043c\u0438 \u0433\u0440\u0430\u0444\u0430 &#8212; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (state): \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (messages), \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043b\u0430\u043d\u0430 (todo), \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0411\u044d\u043a\u0435\u043d\u0434 (backend) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0433\u0434\u0435 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 &#8212; \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0440\u0435\u0434\u0430 (thread), \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (store) \u0438\u043b\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 create_deep_agent, \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c:\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (write_todos);\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (tools), \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u044b (pluggable backends) \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 (offload) \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432;\u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 (tool) task;\u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (tool calls).\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:\u043d\u0430\u0432\u044b\u043a\u0438 (skills) &#8212; \u0447\u0435\u0440\u0435\u0437 skills=, \u043f\u0430\u043c\u044f\u0442\u044c (memory, AGENTS.md) &#8212; \u0447\u0435\u0440\u0435\u0437 memory=;\u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0432 \u0446\u0438\u043a\u043b\u0435 (human-in-the-loop, HITL) &#8212; \u0447\u0435\u0440\u0435\u0437 interrupt_on=;execute &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c-\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435\u0439 (sandbox backend);\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (middleware) \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u043f\u0442\u0430 (prompt caching) \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0435\u043a, \u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u043a\u044d\u0448 (cache hits) \u0434\u0430\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 Anthropic \u0438 Bedrock.\u0421\u043d\u0430\u0440\u0443\u0436\u0438 API \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 &#8212; \u043e\u0442\u0441\u044e\u0434\u0430 \u0441\u043e\u0431\u043b\u0430\u0437\u043d \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u0442\u044c Deep Agents \u043a\u0430\u043a \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043c\u043d\u0435\u0435\u00bb \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u043c. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b:from deepagents import create_deep_agentfrom langchain.chat_models import init_chat_modelagent = create_deep_agent(    model=init_chat_model(&#171;qwen\/qwen3.5-9b&#187;, model_provider=&#187;openai&#187;, base_url=&#187;http:\/\/localhost:1234\/v1&#8243;, api_key=&#187;x&#187;),    tools=[&#8230;],  # \u0432\u0430\u0448\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 tools, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u044b    system_prompt=&#187;&#8230;&#187;,)\u041d\u0438\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f &#8212; \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e. \u0412\u044b\u0431\u043e\u0440 \u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439: \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u0438\u0437 Deep Agents &#8212; \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0442\u0435\u043a\u0430, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 create_agent \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c.\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0445\u043e\u0436\u0435, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043e\u0431\u043b\u0430\u0437\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u0431\u0435\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432:agent = create_agent(    model=init_chat_model(&#171;qwen\/qwen3.5-9b&#187;, model_provider=&#187;openai&#187;, base_url=&#187;http:\/\/localhost:1234\/v1&#8243;, api_key=&#187;x&#187;),    system_prompt=&#187;\u0422\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442.&#187;,)state = agent.invoke({&#171;messages&#187;: [&#171;\u041e\u0431\u044a\u044f\u0441\u043d\u0438 \u043a\u0440\u0430\u0442\u043a\u043e ReAct-\u0446\u0438\u043a\u043b \u0432 \u0430\u0433\u0435\u043d\u0442\u0430\u0445&#187;]})print(state[&#171;messages&#187;][-1].content)\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 (system prompt) \u0437\u0430\u043d\u044f\u043b 35 \u0442\u043e\u043a\u0435\u043d\u043e\u0432. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u043d\u0430 create_deep_agent:agent =&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-488662","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/488662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=488662"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/488662\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=488662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=488662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=488662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}