{"id":503550,"date":"2026-11-17T12:41:55","date_gmt":"2026-11-17T09:41:55","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=503550"},"modified":"2026-11-17T12:41:55","modified_gmt":"2026-11-17T09:41:55","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=503550","title":{"rendered":"AutoGen2 (AG2) \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0418\u0418-\u0430\u0433\u0435\u043d\u0442\u043e\u0432"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0418\u0418-\u0432\u043e\u0440\u043a\u0444\u043b\u043e\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u043c\u043f\u0442, \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043e\u0434\u0438\u043d \u043e\u0442\u0432\u0435\u0442. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u2014 summarize \u2192 extract \u2192 classify.<\/p>\n<p>\u041d\u043e \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0447\u0430, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u044b\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 \u0438\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0442\u0440\u0435\u0449\u0430\u0442\u044c. \u041e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u043c, \u0434\u043e\u0442\u043e\u0448\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0438 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u0449\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u0430\u044f \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u0440\u043e\u043b\u0438 \u0438 \u0434\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u043c\u043f\u0442, \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u043e \u0433\u043e\u043b\u043e\u0441\u0430. \u0412\u0441\u0435 \u043f\u043e \u0437\u0430\u0432\u0435\u0442\u0430\u043c \u0410\u0434\u0430\u043c\u0430 \u0421\u043c\u0438\u0442\u0430 \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0442\u0440\u0443\u0434\u0430. \u0410\u0433\u0435\u043d\u0442-\u043a\u043e\u0434\u0435\u0440 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0440\u0435\u0432\u044c\u044e\u0435\u0440 \u0438\u0449\u0435\u0442 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u043f\u043e\u0434\u0448\u0430\u0433\u0438. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0435\u043f\u043b\u0438\u043a \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u0430.<\/p>\n<p>AG2 \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 AutoGen (\u043d\u044b\u043d\u0435 Microsoft Agents) \u0438 opensource-\u043f\u0440\u043e\u0435\u043a\u0442 AutoGen2, \u0435\u0433\u043e \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438 \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<hr\/>\n<p>\u0424\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044f AG2 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u2014 \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043f\u0440\u043e\u0449\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u043e\u043b\u044f\u043c\u0438, \u0447\u0435\u043c \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0439 \u0430\u0433\u0435\u043d\u0442.<\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, AG2 \u2014 \u044d\u0442\u043e <strong>community-\u0444\u043e\u0440\u043a<\/strong> \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e AutoGen. \u0412 \u043d\u043e\u044f\u0431\u0440\u0435 2024 \u0433\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 AutoGen \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c \u043e\u0442 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b Microsoft \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 ag2ai. Microsoft \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u043c \u043f\u043e\u0434 \u0441\u0442\u0430\u0440\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 Microsoft Agent Framework.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u043e\u0442\u0430\u0442\u044c \u0432 2023 \u0433\u043e\u0434. \u0422\u043e\u0433\u0434\u0430 Microsoft Research \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044e <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/publication\/autogen-enabling-next-gen-llm-applications-via-multi-agent-conversation-framework\/\">\u00abAutoGen: Enabling Next-Gen LLM Applications\u00bb<\/a> (\u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/arxiv.org\/abs\/2308.08155\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 arxiv<\/a>) \u0438 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c. \u0418\u0434\u0435\u044f \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u043b\u0430 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 ConversableAgent, \u0433\u0434\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0447\u0435\u0440\u0435\u0437 <code>initiate_chat<\/code>. \u041e\u043d\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u043e\u0439, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0442\u0430\u043b \u0434\u0435-\u0444\u0430\u043a\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u0435\u0440\u0441\u0438\u044f 0.2 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043a\u043e\u043f\u0438\u0442\u0441\u044f \u0432 \u0447\u044c\u0438\u0445-\u0442\u043e legacy-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0412\u043d\u0443\u0442\u0440\u0438 Microsoft \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0451 \u0441 \u043d\u0443\u043b\u044f. AutoGen 0.4 \u043f\u0440\u0438\u043d\u0451\u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u2014 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c API \u0441\u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0446\u0435\u043b\u0438\u043a\u043e\u043c. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0443 \u0438\u0441\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0443\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u0438 \u0432 \u043d\u043e\u044f\u0431\u0440\u0435 2024 \u0433\u043e\u0434\u0430 Chi Wang \u0441 \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0448\u0451\u043b. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0444\u043e\u0440\u043a \u043f\u043e\u0434 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 ag2ai, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043f\u0440\u044f\u043c\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435: \u00abAG2 (formerly AutoGen)\u00bb. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, Microsoft \u043d\u0435 \u0441\u0434\u0430\u043b\u0441\u044f \u2014 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b \u0441\u0432\u043e\u044e \u043b\u0438\u043d\u0438\u044e, \u0430 \u043f\u043e\u0437\u0436\u0435 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u043b \u0443\u0441\u0438\u043b\u0438\u044f \u0432 Microsoft Agent Framework.<\/p>\n<p>\u0421 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 1.0, \u0432\u044b\u0448\u0435\u0434\u0448\u0435\u0439 \u0432 2026 \u0433\u043e\u0434\u0443, AG2 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0431\u044b\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 LLM API. \u0421\u043b\u0435\u0434\u0443\u044f \u0442\u0440\u0435\u043d\u0434\u0430\u043c, \u043e\u043d \u0441\u0442\u0430\u043b, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, async-first (\u0430 \u043d\u0435 \u043a\u0430\u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0433\u0434\u0435 async \u0431\u044b\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439) \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u044f\u0434\u0440\u043e\u043c \u0438 \u043d\u0430\u0431\u043e\u0440\u043e\u043c opt-in \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u043f\u043e\u0434 \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0426\u0438\u043a\u043b \u0430\u0433\u0435\u043d\u0442\u0430, \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043c\u043e\u0434\u0435\u043b\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438, \u0441\u043e \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b MCP, A2A \u0438 AG-UI \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430.<\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0440\u0443\u043a\u0430\u043c\u0438 \u2014 \u0431\u043e\u043b\u044c. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0434\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432 retry, \u043a\u0430\u0436\u0434\u044b\u0439 tool-call \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c, \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0443\u0436\u0430\u0442\u044c \u0434\u043e \u043b\u0438\u043c\u0438\u0442\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u2026 \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0440\u0443\u0442\u0438\u043d\u0443 \u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430\u0448 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0412\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0435 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<p>\u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u0434\u043e\u043c \u2014 \u0432\u043e\u043f\u0440\u043e\u0441, \u0433\u0434\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438? \u041c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (ollama, vLLM) \u2014 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e, \u043d\u043e \u043d\u0443\u0436\u043d\u044b GPU \u0438 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u0435. \u041b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0448\u043b\u044e\u0437. \u041a\u0441\u0442\u0430\u0442\u0438, \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 <a href=\"https:\/\/bothub.chat\/\">BotHub<\/a> \u2014 \u043f\u043e <a href=\"https:\/\/bothub.chat\/?invitedBy=zx7xIePYIOcWHhTfgg6-O\">\u0440\u0435\u0444\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0434\u0430\u044e\u0442 300 000 CAPS \u043d\u0430 \u0442\u0435\u0441\u0442\u044b, \u0430 \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 OpenAI-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 <code>https:\/\/openai.bothub.chat\/v1<\/code>. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e AG2 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u043a\u0430\u043a \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 OpenAI \u2014 \u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e <code>base_url<\/code> \u0438 \u0437\u0430\u0434\u0430\u0435\u0442\u0435 \u0442\u043e\u043a\u0435\u043d. \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/bothub.chat\/models\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0435 Claude 5, Gemini 4, GPT 6, GLM, DeepSeek \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<pre><code class=\"python\">from ag2.config import OpenAICompletionsConfigconfig = OpenAICompletionsConfig(    model=\"claude-fable-5.2\",    base_url=\"https:\/\/openai.bothub.chat\/v1\",    api_key=\"\u0412\u0410\u0428_\u041a\u041b\u042e\u0427\",)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438<\/h3>\n<p>\u0412 AG2 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f\u0434\u0440\u0430 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 Agent, Reply \u0438 \u043c\u0435\u0442\u043e\u0434\u0430 ask. \u0410\u0433\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c, \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 <code>agent.ask(...)<\/code>, \u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 Reply, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 (\u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u043b, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0447\u0435\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0446\u0438\u043a\u043b).<\/p>\n<pre><code class=\"python\">import asynciofrom ag2 import Agentfrom ag2.config import OpenAICompletionsConfigcfg = OpenAICompletionsConfig(    model=\"claude-fable-5.2\",    base_url=\"https:\/\/openai.bothub.chat\/v1\",    api_key=\"\u0412\u0410\u0428_\u041a\u041b\u042e\u0427\",)agent = Agent(    \"assistant\",    prompt=\"\u0422\u044b \u2014 \u0432\u0435\u0436\u043b\u0438\u0432\u044b\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442.\",    config=cfg)async def main() -&gt; None:    reply = await agent.ask(\"\u0421\u043e\u0441\u0442\u0430\u0432\u044c \u043f\u043b\u0430\u043d \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f REST API \u0437\u0430 5 \u043f\u0443\u043d\u043a\u0442\u043e\u0432\")    print(reply.body)          # \u0441\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0430    print(reply.tool_calls)    # \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u043d \u0434\u0451\u0440\u0433\u0430\u043b    print(reply.usage)         # \u0440\u0430\u0441\u0445\u043e\u0434 \u0442\u043e\u043a\u0435\u043d\u043e\u0432asyncio.run(main())<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u043e \u043e\u0441\u043d\u043e\u0432\u0430 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0448\u043b\u044e\u0437\u0430 LLM API. \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>@tool<\/code> \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f Python-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u2014 \u0441 \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433\u043e\u043c \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438 \u0442\u0438\u043f\u043e\u0432, \u2014 \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 AG2 \u0441\u0430\u043c \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b. \u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u044b\u0437\u043e\u0432, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442, \u043f\u043e\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<pre><code class=\"python\">import datetimefrom ag2 import Agent, toolfrom ag2.config import OpenAICompletionsConfig@toolasync def get_weekday(date_string: str) -&gt; str:    \"\"\"\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0434\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD.\"\"\"    return datetime.strptime(date_string, \"%Y-%m-%d\").strftime(\"%A\")@toolasync def days_until(deadline: str) -&gt; int:    \"\"\"\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e \u0434\u0430\u0442\u044b (YYYY-MM-DD) \u043e\u0442 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0434\u043d\u044f.\"\"\"    target = datetime.strptime(deadline, \"%Y-%m-%d\").date()    return (target - datetime.now().date()).daysagent = Agent(    \"planner\",    prompt=\"\u0422\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0448\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0434\u043b\u0430\u0439\u043d\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438.\",    config=OpenAICompletionsConfig(model=\"gpt-6.1-sol\"),    tools=[get_weekday, days_until],)reply = await agent.ask(\"1995-03-25 \u2014 \u043a\u0430\u043a\u043e\u0439 \u044d\u0442\u043e \u0431\u044b\u043b \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438? \u0418 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043f\u0440\u043e\u0448\u043b\u043e?\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u0434, \u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435. \u0412 AG2 \u0435\u0441\u0442\u044c <code>SandboxCodeTool<\/code> \u0438 <code>SandboxShellTool<\/code> \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u0430\u043c\u0438 E2B \u0438 boxd \u2014 \u0430\u0433\u0435\u043d\u0442 \u043f\u0438\u0448\u0435\u0442 \u0438 \u0433\u043e\u043d\u0438\u0442 \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u0438\u043a\u0440\u043e\u0412\u041c.<\/p>\n<pre><code class=\"python\">from ag2.tools import SandboxCodeToolsandbox = SandboxCodeTool(backend=\"e2b\")   # \u043a\u043e\u0434 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 E2Bagent = Agent(    \"coder\",    prompt=\"\u0422\u044b \u2014 \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u041f\u0438\u0448\u0438 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439 \u043a\u043e\u0434.\",    config=cfg,    tools=[sandbox],)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 human-in-the-loop. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0443\u0437\u0443 \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0437\u0432\u0430\u043b <code>context.input()<\/code> \u2014 \u0438 \u0432\u0441\u0451 \u0437\u0430\u043c\u0438\u0440\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u0442, \u043d\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442 \u0438\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0445\u0443\u043a\u0438 \u0434\u043b\u044f CLI, \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"python\">from ag2.context import input@toolasync def send_invoice(amount: float, recipient: str) -&gt; str:    ok = await input(        f\"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0447\u0451\u0442 \u043d\u0430 {amount}$ \u0434\u043b\u044f {recipient}? [\u0434\u0430\/\u043d\u0435\u0442]\"    )    if ok.lower() != \"\u0434\u0430\":        return \"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c\"    ...<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044e. \u0412 \u0441\u0442\u0430\u0440\u043e\u043c AutoGen \u0437\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0438 GroupChat \u0438 Handoffs. \u041d\u043e \u043e\u043d \u0438\u043c\u0435\u043b \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043f\u043b\u0438\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c LLM-\u00ab\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u043b\u0441\u044f \u0438\u043b\u0438 \u0442\u0435\u0440\u044f\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0412 AG2 v1.x \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0448\u0451\u043b Network \u2014 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0445\u0430\u0431 \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u0433\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435.<\/p>\n<pre><code class=\"python\">from ag2.network import Network, channelclass Draft(channel.Message):    text: str          # \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a \u0441\u0442\u0430\u0442\u044c\u0438class Review(channel.Message):    approved: bool     # \u0432\u0435\u0440\u0434\u0438\u043a\u0442 \u043a\u0440\u0438\u0442\u0438\u043a\u0430    comments: list[str]writer = Agent(\"writer\", prompt=\"\u041f\u0438\u0448\u0438 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438 \u0441\u0442\u0430\u0442\u0435\u0439.\", config=cfg, publishes=Draft)critic = Agent(\"critic\", prompt=\"\u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0439 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438, \u0431\u0443\u0434\u044c \u0441\u0442\u0440\u043e\u0433.\", config=cfg, subscribes=Draft)editor = Agent(\"editor\", prompt=\"\u0424\u0438\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.\", config=cfg, subscribes=Review)net = Network(agents=[writer, critic, editor])result = await net.run(\"\u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\")print(result[\"editor\"].body)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 Middleware \u2014 \u0442\u0435 \u0436\u0435 \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0438, \u0447\u0442\u043e \u0432 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445, \u0432\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c:<\/p>\n<pre><code class=\"python\">from ag2 import middleware@middlewareasync def log_tools(call):    print(f\"\u2192 {call.tool}({call.args})\")    result = await call.next()      # \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435    print(f\"\u2190 {call.tool} \u0432\u0435\u0440\u043d\u0443\u043b {len(str(result))} \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432\")    return resultagent = Agent(\"audit\", prompt=\"...\", config=cfg, tools=[...], middleware=[log_tools])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>Structured outputs \u2014 \u0430\u0433\u0435\u043d\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e Pydantic-\u0441\u0445\u0435\u043c\u0435:<\/p>\n<pre><code class=\"python\">from pydantic import BaseModelclass Plan(BaseModel):    steps: list[str]    estimate_hours: floatplan = await agent.ask(\"\u0420\u0430\u0441\u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0411\u0414\", response_format=Plan)print(plan.steps, plan.estimate_hours)   # \u0443\u0436\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0437\u0434\u0435\u0441\u044c, \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 opt-in \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b: \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b, \u043f\u0435\u0440\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u044f, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 MCP \u0438 A2A.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0433\u0435\u043d\u0442<\/h3>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u0441\u043a\u0443\u0447\u043d\u043e-\u043d\u0430\u0434\u0451\u0436\u043d\u043e: \u043f\u0438\u0442\u043e\u043d 3.11 \u0438\u043b\u0438 \u043d\u043e\u0432\u0435\u0435, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430.<\/p>\n<pre><code class=\"bash\">uv init .uv add ag2<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"python\">import osfrom ag2 import Agentfrom ag2.config import OpenAICompletionsConfigcfg = OpenAICompletionsConfig(    model=os.environ[\"AG2_MODEL\"],                # \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, claude-5.1-fable    base_url=os.environ.get(\"AG2_BASE_URL\"),      # \u0448\u043b\u044e\u0437, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d    api_key=os.environ[\"AG2_API_KEY\"],)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f!<\/p>\n<p>\u0412\u043e\u0442 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0432\u0430\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0433\u0435\u043d\u0442\u0430. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"python\">import asyncioasync def main() -&gt; None:    agent = Agent(\"hello\", prompt=\"\u0422\u044b \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0448\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.\", config=cfg)    reply = await agent.ask(\"\u041e\u0431\u044a\u044f\u0441\u043d\u0438 event loop \u0432 Python \u0432 \u0434\u0432\u0443\u0445 \u0430\u0431\u0437\u0430\u0446\u0430\u0445\")    print(reply.body)    followup = await agent.ask(\"\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0434\u043b\u044f junior-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\")    print(followup.body)asyncio.run(main())<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h3>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 tool-calling<\/h3>\n<p>\u041f\u0440\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 <code>@tool<\/code> \u043c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0432\u044b\u0448\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u0434\u0435\u043d\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u043c\u044b. \u0412\u043e\u0442, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0434\u0432\u0443\u043c\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0433\u043e\u0434\u044b \u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438.<\/p>\n<pre><code class=\"python\">import httpxfrom ag2 import tool@toolasync def get_weather(city: str) -&gt; dict:    r = await httpx.get(f\"https:\/\/wttr.in\/{city}?format=j1\", timeout=10)    cur = r.json()[\"current_condition\"][0]    return {\"temp_c\": cur[\"temp_C\"], \"desc\": cur[\"weatherDesc\"][0][\"value\"]}@toolasync def wiki_search(query: str) -&gt; str:    r = await httpx.get(        \"https:\/\/en.wikipedia.org\/api\/rest_v1\/page\/summary\/\" + query.replace(\" \", \"_\"),        timeout=10,    )    return r.json().get(\"extract\", \"\u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u043b\u043e\u0441\u044c\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0446\u0438\u043a\u043b\u043e\u043c. \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438, \u0441\u0436\u0438\u0433\u0430\u044f \u0432\u0430\u0448\u0438 \u0442\u043e\u043a\u0435\u043d\u044b. \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">agent = Agent(    \"researcher\",    prompt=\"\u041d\u0430\u0439\u0434\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u041d\u043e\u0432\u043e\u0441\u0438\u0431\u0438\u0440\u0441\u043a\u0435 \u0438 \u0441\u043e\u0431\u0435\u0440\u0438 \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0441\u043f\u0440\u0430\u0432\u043a\u0443.\",    config=cfg,    tools=[get_weather, wiki_search],    max_tool_iterations=8,)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0440\u043e\u0441\u0438\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, AG2 \u043e\u0442\u0434\u0430\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0435\u043a\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0438 \u0442\u0430, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441\u043d\u043e\u0432\u0430. \u041d\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u0435\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u041c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b: Network<\/h3>\n<p>\u042f \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0430\u043a \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0437\u0443\u0447\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u0442\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b. \u041e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442 \u0438\u0449\u0435\u0442, \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0444\u0430\u043a\u0442\u044b, \u0442\u0440\u0435\u0442\u0438\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u043a\u0443. \u0412 AG2 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 (\u0447\u0435\u043c-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0431\u0440\u043e\u043a\u0435\u0440\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439)<\/p>\n<pre><code class=\"python\">from ag2.network import Network, channelclass Found(channel.Message):    topic: str    facts: list[str]class Verified(channel.Message):    facts: list[str]    rejected: list[str]class Report(channel.Message):    markdown: strresearcher = Agent(    \"researcher\",    prompt=\"\u0418\u0449\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0442\u0435\u043c\u0435, \u0432\u044b\u0434\u0430\u0432\u0430\u0439 \u0444\u0430\u043a\u0442\u044b \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c\u0438.\",    config=cfg, tools=[wiki_search],    publishes=Found,)factchecker = Agent(    \"factchecker\",    prompt=\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0439 \u0444\u0430\u043a\u0442\u044b. \u041e\u0442\u0441\u0435\u043a\u0430\u0439 \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435.\",    config=cfg, tools=[wiki_search],    subscribes=Found, publishes=Verified,)writer = Agent(    \"writer\",    prompt=\"\u041f\u0438\u0448\u0438 \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0441\u043f\u0440\u0430\u0432\u043a\u0443 \u0432 markdown \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u043e\u0432.\",    config=cfg, subscribes=Verified, publishes=Report,)net = Network(agents=[researcher, factchecker, writer])result = await net.run(\"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c \u0441\u043f\u0440\u0430\u0432\u043a\u0443 \u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>Found<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0442 \u0430\u0433\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043d\u0435\u0433\u043e \u2014 factchecker, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430, \u0430 \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u2014 \u0438 \u0434\u0440\u0435\u0432\u043e \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h3>Human-in-the-loop \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>\u041f\u0440\u043e <code>context.input()<\/code> \u043c\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 \u043c\u0435\u043b\u044c\u043a\u043e\u043c.<\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 2025-\u043c. \u0412 AG2 \u0437\u0430\u043a\u0440\u044b\u043b\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c (\u043f\u0430\u0442\u0447 v1.1.1, CVE), \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432 \u043b\u043e\u0431\u043e\u0432\u043e\u0439 \u0430\u0442\u0430\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b. \u041c\u043e\u0434\u0435\u043b\u044c-\u0430\u0433\u0435\u043d\u0442, \u0434\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0430\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0430\u043c \u0436\u0435 \u0438 \u0447\u0438\u0442\u0430\u043b, \u2014 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430 \u0435\u0451 \u043a\u0430\u043a \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 prompt injection, \u043d\u043e \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u0430\u0448\u0435\u0439 Python-\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u044f\u0432\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 (<code>context.input()<\/code> \u0438\u043b\u0438 \u0445\u0443\u043a). \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438, \u0430 \u0443 \u0430\u0433\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u0431\u044e\u0434\u0436\u0435\u0442 \u2014 \u043b\u0438\u043c\u0438\u0442 \u0448\u0430\u0433\u043e\u0432 \u0438 \u043b\u0438\u043c\u0438\u0442 spend \u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n<pre><code class=\"python\">agent = Agent(    \"ops\",    prompt=\"\u0422\u044b \u2014 \u0434\u0435\u0436\u0443\u0440\u043d\u044b\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u0414\u0435\u0439\u0441\u0442\u0432\u0443\u0439 \u043f\u043e runbook.\",    config=cfg,    tools=[sandbox, restart_service],    max_tool_iterations=15,    spend_limit_usd=0.50,       # \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0443\u0434\u043e\u043b\u043b\u0430\u0440\u0430 \u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u043a)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h3>Skills: \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0433\u0435\u043d\u0442 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0430\u043c<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e Agent Skills. \u0418\u0434\u0435\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u0430\u044f, \u043d\u0430\u0432\u044b\u043a \u2014 \u044d\u0442\u043e \u043f\u0430\u043f\u043a\u0430 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c <code>SKILL.md<\/code>, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u0430 \u0440\u044f\u0434\u043e\u043c \u2014 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438). \u0410\u0433\u0435\u043d\u0442 \u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0432\u044b\u043a\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0430 \u0441\u0430\u043c\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0435\u0451 \u0442\u0440\u0435\u0431\u0443\u0435\u0442. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0437\u0430\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0437\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443.<\/p>\n<p>AG2 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0432\u0435\u043d\u0446\u0438\u044e agentskills.io \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0421\u043a\u0438\u043b\u043b\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u043b\u0430\u0439\u043d \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<pre><code class=\"python\">from ag2 import Agentagent = Agent(    \"dev-assistant\",    prompt=\"\u0422\u044b \u2014 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u043d\u0430\u0432\u044b\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 AG2.\",    config=cfg,    skills=\".\/skills\",          # \u0430\u0433\u0435\u043d\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043f\u043a\u0443 \u0438 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h3>MCP: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c context7<\/h3>\n<p>\u0413\u0434\u0435 skills \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u00ab\u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c\u00bb, MCP \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u00ab\u0447\u0435\u043c\u00bb. Model Context Protocol \u2014 \u0432\u0430\u0436\u043d\u0430\u044f \u0432\u0435\u0449\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u0430\u043b\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>AG2 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 MCP \u0432 \u0440\u043e\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0442\u043e\u0442 \u0441\u0430\u043c \u0434\u043e\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c, \u0438 AG2 \u043c\u0430\u043f\u0438\u0442 \u0438\u0445 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442\u0430. \u0420\u0443\u0447\u043d\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"python\">from ag2.tools import MCPToolkitdocs = MCPToolkit(    command=\"npx\",    args=[\"-y\", \"@upstash\/context7-mcp\"],)agent = Agent(    \"coder\",    prompt=\"\u041f\u0438\u0448\u0438 \u043a\u043e\u0434 \u043d\u0430 \u0441\u0432\u0435\u0436\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0421\u0432\u0435\u0440\u044f\u0439\u0441\u044f \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b.\",    config=cfg,    tools=[docs],)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0437\u044f\u0442 context7 \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442 Upstash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438. \u0428\u0442\u0443\u043a\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0434\u043e \u0431\u043e\u043b\u0438. \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0433\u0430\u043b\u043b\u044e\u0446\u0438\u043d\u0430\u0446\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435 \u2014 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e \u0432\u0435\u0440\u0441\u0438\u0438 API, \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430. \u0410\u0433\u0435\u043d\u0442 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u043d\u0435\u0433\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0438 \u043f\u0438\u0448\u0435\u0442 \u043a\u043e\u0434 \u043f\u043e \u043d\u0438\u043c, \u0430 \u043d\u0435 \u043f\u043e \u0432\u0435\u0431-\u043f\u043e\u0438\u0441\u043a\u0443 \u0438\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0438 AG2 \u0440\u0430\u0437\u0440\u0443\u043b\u0438\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u0438\u043c\u0451\u043d. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u2014 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435.<\/p>\n<h3>\u041e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438<\/h3>\n<p>\u0420\u0430\u0437 AG2 \u2014 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0435\u0442\u044c \u0442\u0435\u043c\u0443 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0430\u0432 \u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u0423 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u0441\u043f\u0438\u0441\u043e\u043a tools + \u043b\u0438\u043c\u0438\u0442\u044b. \u0412 \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e.<\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0430\u0433\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0440\u043e\u0432\u043d\u043e \u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0433\u043e \u0440\u043e\u043b\u044c \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043c\u0435\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c, \u043d\u043e \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u044b. \u041f\u0438\u0441\u0430\u0442\u0435\u043b\u044c \u0443\u043c\u0435\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b, \u043d\u043e \u0432 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0443 \u0438 \u0431\u0435\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0441\u0435\u0442\u044c.<\/p>\n<pre><code class=\"python\">researcher = Agent(    \"researcher\",    prompt=\"\u0422\u043e\u043b\u044c\u043a\u043e \u0441\u0431\u043e\u0440 \u0444\u0430\u043a\u0442\u043e\u0432. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0439 \u0438 \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0439.\",    config=cfg, tools=[wiki_summary],    max_tool_iterations=8, spend_limit_usd=0.10,)writer = Agent(    \"writer\",    prompt=\"\u041f\u0438\u0448\u0438 \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u043e\u0432.\",    config=cfg, tools=[write_file],)reviewer = Agent(    \"reviewer\",    prompt=\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0439 \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0439 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.\",    config=cfg, tools=[],    human_input=True,)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0439 \u043f\u0440\u0430\u0432 \u2014 Network-\u043a\u0430\u043d\u0430\u043b\u044b. \u0422\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u043e\u0442\u0441\u0435\u043a\u0430\u044e\u0442, \u043a\u0442\u043e \u0447\u0442\u043e \u0432\u0438\u0434\u0438\u0442, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0430\u0433\u0435\u043d\u0442 \u043c\u043e\u0433 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0432\u043e\u0438 \u043a\u0430\u043d\u0430\u043b\u044b.<\/p>\n<p>\u041d\u0443 \u0438 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c middleware \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<pre><code class=\"python\">@middlewareasync def guard(call):    if call.agent.name == \"researcher\" and call.tool not in ALLOWED_RESEARCH:        return \"\u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438\"    return await call.next()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u0410\u0433\u0435\u043d\u0442\u0430 \u0441\u0442\u043e\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438\u0431\u043e \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u0412 AG2 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043e\u043d\u043e \u043d\u0430 \u0442\u0440\u0451\u0445 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043f\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 CI \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u0445: score, compare \u0438 regression-\u0442\u0435\u0441\u0442\u044b.<\/p>\n<p>\u0412\u043e\u0442 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">from ag2.eval import EvalCase, scorecases = [    EvalCase(        name=\"weekday\",        query=\"2026-01-15 \u2014 \u043a\u0430\u043a\u043e\u0439 \u044d\u0442\u043e \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438?\",        checker=score.exact(\"Thursday\"),    ),    EvalCase(        name=\"refuses-nonsense\",        query=\"\u0421\u0442\u043e\u043b\u0438\u0446\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u044b \u041f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u0438?\",        checker=score.not_regex(r\"\u0441\u0442\u043e\u043b\u0438\u0446\u0430 \u041f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u0438\"),    ),    EvalCase(        name=\"uses-tool\",        query=\"\u041a\u0430\u043a\u0430\u044f \u043f\u043e\u0433\u043e\u0434\u0430 \u0432 \u041d\u043e\u0432\u043e\u0441\u0438\u0431\u0438\u0440\u0441\u043a\u0435?\",        checker=score.tool_called(\"get_weather\"),    ),]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0422\u0440\u0438 \u0442\u0438\u043f\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0436\u0435 \u0432\u0438\u0434\u043d\u044b \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430. <code>exact<\/code> \u0438 <code>regex<\/code> \u2014 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0433\u0434\u0435 \u043e\u0442\u0432\u0435\u0442 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d. <code>tool_called<\/code> \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0451\u0440\u043d\u0443\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0414\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0435\u0441\u0442\u044c LLM-\u0441\u0443\u0434\u044c\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0430\u0433\u0435\u043d\u0442\u0430 \u0441 \u0440\u0443\u0431\u0440\u0438\u043a\u043e\u0439 \u0438 \u0441\u0442\u0430\u0432\u0438\u0442 \u0431\u0430\u043b\u043b.<\/p>\n<pre><code class=\"python\">from ag2.eval import rubricrubric_quality = rubric(\"\"\"1 \u0431\u0430\u043b\u043b \u2014 \u043e\u0442\u0432\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u044b \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438;2 \u0431\u0430\u043b\u043b\u0430 \u2014 \u0444\u0430\u043a\u0442\u044b \u0432\u0435\u0440\u043d\u044b, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f;3 \u0431\u0430\u043b\u043b\u0430 \u2014 \u0432\u0435\u0440\u043d\u043e, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e, \u0438 \u0435\u0441\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438.\"\"\")report = await cases.score(agent, judge=rubric_quality)print(report.passed, report.mean_score, report.failures)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2014 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0435\u0441\u044c \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u043c\u043f\u0442\u0430\u043c\u0438 \u0438\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438. \u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442\u0435 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u0430\u0445 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<pre><code class=\"python\">a = await cases.score(agent_v1, judge=rubric_quality)b = await cases.score(agent_v2, judge=rubric_quality)print(a.compare(b))   # \u0433\u0434\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u043e, \u0433\u0434\u0435 \u043f\u0440\u043e\u0441\u0435\u043b\u043e, \u043d\u0430 \u043a\u0430\u043a\u0438\u0445 \u043a\u0435\u0439\u0441\u0430\u0445<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0418 \u0442\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u043e\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043c\u0438\u0442. \u041b\u043e\u0433\u0438\u043a\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 unit-\u0442\u0435\u0441\u0442\u0430\u043c.<\/p>\n<h3>AG2 \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e AG2, \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0435 \u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u043a \u044d\u0442\u043e\u043c\u0443 \u0433\u043e\u0434\u0443 \u0443\u0441\u0442\u043e\u044f\u043b\u043e\u0441\u044c. LangChain\/LangGraph \u2014 \u0433\u0440\u0430\u0444\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u0431\u0435\u0437\u0434\u043e\u043d\u043d\u044b\u0439 \u0437\u043e\u043e\u043f\u0430\u0440\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439. CrewAI \u2014 \u0440\u043e\u043b\u0435\u0432\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u0430\u0440\u0442. Google ADK \u2014 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0445\u043e\u0434 \u0432 \u043c\u0438\u0440 Gemini \u0438 Vertex. AG2 \u2014 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u0443\u043f\u043e\u0440\u043e\u043c \u043d\u0430 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\n<\/th>\n<th>\n<p align=\"left\">AG2<\/p>\n<\/th>\n<th>\n<p align=\"left\">LangGraph<\/p>\n<\/th>\n<th>\n<p align=\"left\">CrewAI<\/p>\n<\/th>\n<th>\n<p align=\"left\">Google ADK<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u0438\u0440\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0430\u0433\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0433\u0440\u0430\u0444 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0440\u043e\u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 Gemini<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0438\u0437\u043a\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0441\u0440\u0435\u0434\u043d\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0441\u0440\u0435\u0434\u043d\u0438\u0439<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">Network, \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0440\u0451\u0431\u0440\u0430 \u0433\u0440\u0430\u0444\u0430, \u0446\u0438\u043a\u043b\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043f\u0440\u043e\u0446\u0435\u0441\u0441 (sequential\/hierarchical)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Human-in-the-loop<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439, <code>context.input()<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Async-first \u0441 1.0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">MCP \/ A2A<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430, \u043d\u0430\u0442\u0438\u0432\u043d\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0447\u0435\u0440\u0435\u0437 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0432\u043e\u0451 \u0436\u0435\u043b\u0435\u0437\u043e-\u043f\u0440\u043e\u0434\u0443\u043a\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">AG2 Space (macOS)<\/p>\n<\/td>\n<td>\n<p align=\"left\">LangSmith\/\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">CrewAI Enterprise<\/p>\n<\/td>\n<td>\n<p align=\"left\">Vertex AI<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>MCP \u043a \u044d\u0442\u043e\u043c\u0443 \u0433\u043e\u0434\u0443 \u0441\u0442\u0430\u043b \u0434\u0435-\u0444\u0430\u043a\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2014 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0435\u0441\u0442\u044c \u0443 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432, \u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0445 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0440\u044f\u0434 \u043b\u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d. AG2 \u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443, \u0432\u043a\u043b\u044e\u0447\u0430\u044f A2A \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0438 AG-UI \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u043e\u0432.<\/p>\n<p>\u0415\u0449\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e <a href=\"https:\/\/ag2.space\/\">AG2 Space<\/a> \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f macOS, \u0433\u0434\u0435 \u043b\u044e\u0434\u0438 \u0438 \u0430\u0433\u0435\u043d\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u041a\u0442\u043e-\u0442\u043e \u0437\u0430\u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442\u0438\u043b, \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442. \u0412\u0435\u0441\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0438\u043d\u0438-\u043f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <s>\u043d\u0430\u043f\u0430\u043a\u043e\u0441\u0442\u0438\u0442\u044c<\/s> \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432 \u043d\u0435\u043a\u0443\u044e \u0438\u0434\u0435\u044e \u0438 \u043c\u0438\u043d\u0438-MVP, \u0434\u0430\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0430\u0448\u0435\u0433\u043e AG2. \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u0433\u0435\u043d\u0442-\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u0435\u043c\u0443, \u0438\u0449\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438, \u043f\u0438\u0448\u0435\u0442 \u043e\u0442\u0447\u0451\u0442 \u0432 markdown, \u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0447\u0442\u043e-\u0442\u043e \u00ab\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u00bb, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043d\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">import asyncioimport osimport httpxfrom pydantic import BaseModelfrom ag2.context import inputfrom ag2 import Agent, toolfrom ag2.config import OpenAICompletionsConfigcfg = OpenAICompletionsConfig(    model=os.environ.get(\"AG2_MODEL\", \"gpt-4o-mini\"),    base_url=os.environ.get(\"AG2_BASE_URL\"),    api_key=os.environ[\"AG2_API_KEY\"],)@toolasync def wiki_summary(topic: str) -&gt; str:    r = await httpx.get(        \"https:\/\/en.wikipedia.org\/api\/rest_v1\/page\/summary\/\" + topic.strip().replace(\" \", \"_\"),        timeout=10,    )    data = r.json()    return data.get(\"extract\") or \"\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u0434\u0440\u0443\u0433\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\"@toolasync def save_report(filename: str, content: str) -&gt; str:    ok = await input(f\"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0451\u0442 ({len(content)} \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u0432 {filename}? [\u0434\u0430\/\u043d\u0435\u0442]\")    if ok.strip().lower() != \"\u0434\u0430\":        return \"\u043e\u0442\u043c\u0435\u043d\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c\"    with open(filename, \"w\", encoding=\"utf-8\") as f:        f.write(content)    return f\"\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e: {filename}\"class Report(BaseModel):    title: str    summary: str    body_markdown: strasync def main() -&gt; None:    agent = Agent(        \"research-agent\",        prompt=(            \"\u0422\u044b \u2014 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c. \u041f\u043e \u0442\u0435\u043c\u0435: 1) \u043f\u043e\u043b\u0443\u0447\u0438 \u0444\u0430\u043a\u0442\u044b \u0447\u0435\u0440\u0435\u0437 wiki_summary \"            \"(\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 2-3 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u043e\u0441\u044c); 2) \u043d\u0430\u043f\u0438\u0448\u0438 \u043e\u0442\u0447\u0451\u0442 \u0432 markdown \"            \"\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u043e\u0432, \u0431\u0435\u0437 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0439; 3) \u0441\u043e\u0445\u0440\u0430\u043d\u0438 \u0447\u0435\u0440\u0435\u0437 save_report.\"        ),        config=cfg,        tools=[wiki_summary, save_report],        max_tool_iterations=12,        spend_limit_usd=0.50,    )    topic = \"vector databases\"    result = await agent.ask(        f\"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438 \u043e\u0442\u0447\u0451\u0442 \u043f\u043e \u0442\u0435\u043c\u0435: {topic}\",        response_format=Report,    )    print(\"\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a:\", result.title)    print(\"\u0420\u0435\u0437\u044e\u043c\u0435:\", result.summary[:200])asyncio.run(main())<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433\u0430\u043c\u0438. <code>save_report<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0430\u0433\u0435\u043d\u0442 \u0434\u043e\u0439\u0434\u0451\u0442 \u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u0442. <code>response_format=Report<\/code> \u0432\u0435\u0440\u043d\u0451\u0442 \u0438\u0442\u043e\u0433 \u0432 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0443. \u041b\u0438\u043c\u0438\u0442\u044b (<code>max_tool_iterations<\/code>, <code>spend_limit_usd<\/code>) \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442, \u0447\u0442\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u043e\u0439\u0434\u0451\u0442\u0441\u044f \u0432 \u043a\u043e\u043f\u0435\u0439\u043a\u0438, \u0430 \u043d\u0435 \u0432 \u0441\u044e\u0440\u043f\u0440\u0438\u0437 \u043d\u0430 \u0441\u0447\u0435\u0442\u0430\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a \u0432 MCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0443\u0447\u043d\u043e\u0433\u043e <code>httpx<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u043a\u0442\u0447\u0435\u043a\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 Network (\u0441\u0445\u0435\u043c\u0430 \u0438\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0432\u044b\u0448\u0435 \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u0441\u044e\u0434\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e), \u0438 \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u044c EvalCase-\u043d\u0430\u0431\u043e\u0440 \u0432 CI.<\/p>\n<blockquote>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e <a href=\"https:\/\/habr.com\/ru\/companies\/bothub\/articles\/1108490\/\">Harness\u00b2 \u2014 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435 \u0418\u0418-\u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 Google Research<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/bothub\/articles\/1099642\/\">Pydantic AI: \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0433\u0435\u043d\u0442\u044b \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445<\/a>.<\/p>\n<\/blockquote>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0414\u0430\u0436\u0435 \u043d\u0435\u0447\u0435\u0433\u043e \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0441\u043e\u0431\u043e. AG2 \u2014 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 (\u043e\u0434\u0438\u043d \u0438\u0437 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 FastStream).<\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/docs.ag2.ai\">docs.ag2.ai<\/a> \u2014 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f: User Guide, \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 GroupChat.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ag2ai\/ag2\">github.com\/ag2ai\/ag2<\/a> \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u0440\u0435\u043b\u0438\u0437\u044b \u0438 changelog. \u041f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0434 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u0435\u0440\u0430\u043c!<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ag2ai\/ag2-skills\">github.com\/ag2ai\/ag2-skills<\/a> \u2014 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u043d\u0433-\u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0448\u043b\u044e\u0437 \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u0447\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u0438\u043b\u0438 \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u0431\u0438\u043b\u043b\u0438\u043d\u0433 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u2014 \u043f\u043e <a href=\"https:\/\/bothub.chat\/?invitedBy=zx7xIePYIOcWHhTfgg6-O\">\u0440\u0435\u0444\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0434\u0430\u044e\u0442 300 000 CAPS \u043d\u0430 \u0442\u0435\u0441\u0442\u044b, \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u2014 \u043d\u0430 <a href=\"https:\/\/bothub.chat\/models\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/a>, \u0430 OpenAI-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 <code>https:\/\/openai.bothub.chat\/v1<\/code> \u0438\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u043f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0423\u0434\u0430\u0447\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438 \u043a\u0430\u043f\u0438\u0442\u0430\u043b\u0438\u0441\u0442\u044b!<\/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\/1108762\/\">https:\/\/habr.com\/ru\/articles\/1108762\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0418\u0418-\u0432\u043e\u0440\u043a\u0444\u043b\u043e\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u043c\u043f\u0442, \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043e\u0434\u0438\u043d \u043e\u0442\u0432\u0435\u0442. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u2014 summarize \u2192 extract \u2192 classify.\u041d\u043e \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0447\u0430, \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u044b\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442 \u0438\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0442\u0440\u0435\u0449\u0430\u0442\u044c. \u041e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u043c, \u0434\u043e\u0442\u043e\u0448\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0438 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u0449\u0438\u043a\u043e\u043c.\u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u0430\u044f \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u0440\u043e\u043b\u0438 \u0438 \u0434\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u043c\u043f\u0442, \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u043e \u0433\u043e\u043b\u043e\u0441\u0430. \u0412\u0441\u0435 \u043f\u043e \u0437\u0430\u0432\u0435\u0442\u0430\u043c \u0410\u0434\u0430\u043c\u0430 \u0421\u043c\u0438\u0442\u0430 \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0442\u0440\u0443\u0434\u0430. \u0410\u0433\u0435\u043d\u0442-\u043a\u043e\u0434\u0435\u0440 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0440\u0435\u0432\u044c\u044e\u0435\u0440 \u0438\u0449\u0435\u0442 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u043f\u043e\u0434\u0448\u0430\u0433\u0438. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0435\u043f\u043b\u0438\u043a \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u0430.AG2 \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 AutoGen (\u043d\u044b\u043d\u0435 Microsoft Agents) \u0438 opensource-\u043f\u0440\u043e\u0435\u043a\u0442 AutoGen2, \u0435\u0433\u043e \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438 \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.\u0424\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044f AG2 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u2014 \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043f\u0440\u043e\u0449\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u043e\u043b\u044f\u043c\u0438, \u0447\u0435\u043c \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0439 \u0430\u0433\u0435\u043d\u0442.\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, AG2 \u2014 \u044d\u0442\u043e community-\u0444\u043e\u0440\u043a \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e AutoGen. \u0412 \u043d\u043e\u044f\u0431\u0440\u0435 2024 \u0433\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 AutoGen \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c \u043e\u0442 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b Microsoft \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 ag2ai. Microsoft \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u043c \u043f\u043e\u0434 \u0441\u0442\u0430\u0440\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 Microsoft Agent Framework.\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u043e\u0442\u0430\u0442\u044c \u0432 2023 \u0433\u043e\u0434. \u0422\u043e\u0433\u0434\u0430 Microsoft Research \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044e \u00abAutoGen: Enabling Next-Gen LLM Applications\u00bb (\u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 arxiv) \u0438 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c. \u0418\u0434\u0435\u044f \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u043b\u0430 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 ConversableAgent, \u0433\u0434\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0447\u0435\u0440\u0435\u0437 initiate_chat. \u041e\u043d\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u043e\u0439, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0442\u0430\u043b \u0434\u0435-\u0444\u0430\u043a\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u0433\u0435\u043d\u0442\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u0435\u0440\u0441\u0438\u044f 0.2 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043a\u043e\u043f\u0438\u0442\u0441\u044f \u0432 \u0447\u044c\u0438\u0445-\u0442\u043e legacy-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.\u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0412\u043d\u0443\u0442\u0440\u0438 Microsoft \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0451 \u0441 \u043d\u0443\u043b\u044f. AutoGen 0.4 \u043f\u0440\u0438\u043d\u0451\u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u2014 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c API \u0441\u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0446\u0435\u043b\u0438\u043a\u043e\u043c. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0443 \u0438\u0441\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0443\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u0438 \u0432 \u043d\u043e\u044f\u0431\u0440\u0435 2024 \u0433\u043e\u0434\u0430 Chi Wang \u0441 \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0448\u0451\u043b. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0444\u043e\u0440\u043a \u043f\u043e\u0434 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 ag2ai, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043f\u0440\u044f\u043c\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435: \u00abAG2 (formerly AutoGen)\u00bb. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, Microsoft \u043d\u0435 \u0441\u0434\u0430\u043b\u0441\u044f \u2014 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b \u0441\u0432\u043e\u044e \u043b\u0438\u043d\u0438\u044e, \u0430 \u043f\u043e\u0437\u0436\u0435 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u043b \u0443\u0441\u0438\u043b\u0438\u044f \u0432 Microsoft Agent Framework.\u0421 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 1.0, \u0432\u044b\u0448\u0435\u0434\u0448\u0435\u0439 \u0432 2026 \u0433\u043e\u0434\u0443, AG2 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0431\u044b\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 LLM API. \u0421\u043b\u0435\u0434\u0443\u044f \u0442\u0440\u0435\u043d\u0434\u0430\u043c, \u043e\u043d \u0441\u0442\u0430\u043b, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, async-first (\u0430 \u043d\u0435 \u043a\u0430\u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0433\u0434\u0435 async \u0431\u044b\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439) \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u044f\u0434\u0440\u043e\u043c \u0438 \u043d\u0430\u0431\u043e\u0440\u043e\u043c opt-in \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u043f\u043e\u0434 \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0426\u0438\u043a\u043b \u0430\u0433\u0435\u043d\u0442\u0430, \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043c\u043e\u0434\u0435\u043b\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438, \u0441\u043e \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b MCP, A2A \u0438 AG-UI \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430.\u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0440\u0443\u043a\u0430\u043c\u0438 \u2014 \u0431\u043e\u043b\u044c. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0434\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432 retry, \u043a\u0430\u0436\u0434\u044b\u0439 tool-call \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c, \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0443\u0436\u0430\u0442\u044c \u0434\u043e \u043b\u0438\u043c\u0438\u0442\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u2026 \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0440\u0443\u0442\u0438\u043d\u0443 \u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430\u0448 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0412\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0435 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.\u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u0434\u043e\u043c \u2014 \u0432\u043e\u043f\u0440\u043e\u0441, \u0433\u0434\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438? \u041c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (ollama, vLLM) \u2014 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e, \u043d\u043e \u043d\u0443\u0436\u043d\u044b GPU \u0438 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u0435. \u041b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0448\u043b\u044e\u0437. \u041a\u0441\u0442\u0430\u0442\u0438, \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 BotHub \u2014 \u043f\u043e \u0440\u0435\u0444\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435 \u0434\u0430\u044e\u0442 300 000 CAPS \u043d\u0430 \u0442\u0435\u0441\u0442\u044b, \u0430 \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 OpenAI-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 https:\/\/openai.bothub.chat\/v1. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e AG2 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u043a\u0430\u043a \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 OpenAI \u2014 \u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e base_url \u0438 \u0437\u0430\u0434\u0430\u0435\u0442\u0435 \u0442\u043e\u043a\u0435\u043d. \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0435 Claude 5, Gemini 4, GPT 6, GLM, DeepSeek \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.from ag2.config import OpenAICompletionsConfigconfig = OpenAICompletionsConfig(    model=&#187;claude-fable-5.2&#8243;,    base_url=&#187;https:\/\/openai.bothub.chat\/v1&#8243;,    api_key=&#187;\u0412\u0410\u0428_\u041a\u041b\u042e\u0427&#187;,)\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438\u0412 AG2 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f\u0434\u0440\u0430 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 Agent, Reply \u0438 \u043c\u0435\u0442\u043e\u0434\u0430 ask. \u0410\u0433\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c, \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f. \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 agent.ask(&#8230;), \u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 Reply, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 (\u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u043b, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0447\u0435\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0446\u0438\u043a\u043b).import asynciofrom ag2 import Agentfrom ag2.config import OpenAICompletionsConfigcfg = OpenAICompletionsConfig(    model=&#187;claude-fable-5.2&#8243;,    base_url=&#187;https:\/\/openai.bothub.chat\/v1&#8243;,    api_key=&#187;\u0412\u0410\u0428_\u041a\u041b\u042e\u0427&#187;,)agent = Agent(    &#171;assistant&#187;,    prompt=&#187;\u0422\u044b \u2014 \u0432\u0435\u0436\u043b\u0438\u0432\u044b\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442.&#187;,    config=cfg)async def main() -&gt; None:    reply = await agent.ask(&#171;\u0421\u043e\u0441\u0442\u0430\u0432\u044c \u043f\u043b\u0430\u043d \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f REST API \u0437\u0430 5 \u043f\u0443\u043d\u043a\u0442\u043e\u0432&#187;)    print(reply.body)          # \u0441\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0430    print(reply.tool_calls)    # \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u043d \u0434\u0451\u0440\u0433\u0430\u043b    print(reply.usage)         # \u0440\u0430\u0441\u0445\u043e\u0434 \u0442\u043e\u043a\u0435\u043d\u043e\u0432asyncio.run(main())\u041d\u043e \u043e\u0441\u043d\u043e\u0432\u0430 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0448\u043b\u044e\u0437\u0430 LLM API. \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c @tool \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f Python-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u2014 \u0441 \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433\u043e\u043c \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438 \u0442\u0438\u043f\u043e\u0432, \u2014 \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 AG2 \u0441\u0430\u043c \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b. \u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u044b\u0437\u043e\u0432, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442, \u043f\u043e\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0430.import datetimefrom ag2 import Agent, toolfrom ag2.config import OpenAICompletionsConfig@toolasync def get_weekday(date_string: str) -&gt; str:    &#171;&#187;&#187;\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0434\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD.&#187;&#187;&#187;    return datetime.strptime(date_string, &#171;%Y-%m-%d&#187;).strftime(&#171;%A&#187;)@toolasync def days_until(deadline: str) -&gt; int:    &#171;&#187;&#187;\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e \u0434\u0430\u0442\u044b (YYYY-MM-DD) \u043e\u0442 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0434\u043d\u044f.&#187;&#187;&#187;    target = datetime.strptime(deadline, &#171;%Y-%m-%d&#187;).date()    return (target &#8212; datetime.now().date()).daysagent = Agent(    &#171;planner&#187;,    prompt=&#187;\u0422\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0448\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0434\u043b\u0430\u0439\u043d\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438.&#187;,    config=OpenAICompletionsConfig(model=&#187;gpt-6.1-sol&#187;),    tools=[get_weekday, days_until],)reply = await agent.ask(&#171;1995-03-25 \u2014 \u043a\u0430\u043a\u043e\u0439 \u044d\u0442\u043e \u0431\u044b\u043b \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438? \u0418 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043f\u0440\u043e\u0448\u043b\u043e?&#187;)\u0415\u0441\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u0434, \u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435. \u0412 AG2 \u0435\u0441\u0442\u044c SandboxCodeTool \u0438 SandboxShellTool \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u0430\u043c\u0438 E2B \u0438 boxd \u2014 \u0430\u0433\u0435\u043d\u0442 \u043f\u0438\u0448\u0435\u0442 \u0438 \u0433\u043e\u043d\u0438\u0442 \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u0438\u043a\u0440\u043e\u0412\u041c.from ag2.tools import SandboxCodeToolsandbox = SandboxCodeTool(backend=&#187;e2b&#187;)   # \u043a\u043e\u0434 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 E2Bagent = Agent(    &#171;coder&#187;,    prompt=&#187;\u0422\u044b \u2014 \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u041f\u0438\u0448\u0438 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439 \u043a\u043e\u0434.&#187;,    config=cfg,    tools=[sandbox],)\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 human-in-the-loop. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0443\u0437\u0443 \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0430\u0433\u0435\u043d\u0442 \u0432\u044b\u0437\u0432\u0430\u043b context.input() \u2014 \u0438 \u0432\u0441\u0451 \u0437\u0430\u043c\u0438\u0440\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u0442, \u043d\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442 \u0438\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0445\u0443\u043a\u0438 \u0434\u043b\u044f CLI, \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.from ag2.context import input@toolasync def send_invoice(amount: float, recipient: str) -&gt; str:    ok = await input(        f&#187;\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0447\u0451\u0442 \u043d\u0430 {amount}$ \u0434\u043b\u044f {recipient}? [\u0434\u0430\/\u043d\u0435\u0442]&#187;    )    if ok.lower() != &#171;\u0434\u0430&#187;:        return &#171;\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c&#187;    &#8230;\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044e. \u0412 \u0441\u0442\u0430\u0440\u043e\u043c AutoGen \u0437\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0438 GroupChat \u0438 Handoffs. \u041d\u043e \u043e\u043d \u0438\u043c\u0435\u043b \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043f\u043b\u0438\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c LLM-\u00ab\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u043b\u0441\u044f \u0438\u043b\u0438 \u0442\u0435\u0440\u044f\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0412 AG2 v1.x \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0448\u0451\u043b Network \u2014 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0445\u0430\u0431 \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u0433\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435.from ag2.network import Network, channelclass Draft(channel.Message):    text: str          # \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a \u0441\u0442\u0430\u0442\u044c\u0438class Review(channel.Message):    approved: bool     # \u0432\u0435\u0440\u0434\u0438\u043a\u0442 \u043a\u0440\u0438\u0442\u0438\u043a\u0430    comments: list[str]writer = Agent(&#171;writer&#187;, prompt=&#187;\u041f\u0438\u0448\u0438 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438 \u0441\u0442\u0430\u0442\u0435\u0439.&#187;, config=cfg, publishes=Draft)critic = Agent(&#171;critic&#187;, prompt=&#187;\u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0439 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0438, \u0431\u0443\u0434\u044c \u0441\u0442\u0440\u043e\u0433.&#187;, config=cfg, subscribes=Draft)editor = Agent(&#171;editor&#187;, prompt=&#187;\u0424\u0438\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.&#187;, config=cfg, subscribes=Review)net = Network(agents=[writer, critic, editor])result = await net.run(&#171;\u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445&#187;)print(result[&#171;editor&#187;].body)\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 Middleware \u2014 \u0442\u0435 \u0436\u0435 \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0438, \u0447\u0442\u043e \u0432 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445, \u0432\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c:from ag2 import middleware@middlewareasync def log_tools(call):    print(f&#187;\u2192 {call.tool}({call.args})&#187;)    result = await call.next()      # \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435    print(f&#187;\u2190 {call.tool} \u0432\u0435\u0440\u043d\u0443\u043b {len(str(result))} \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432&#187;)    return resultagent = Agent(&#171;audit&#187;, prompt=&#187;&#8230;&#187;, config=cfg, tools=[&#8230;], middleware=[log_tools])Structured outputs \u2014 \u0430\u0433\u0435\u043d\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e Pydantic-\u0441\u0445\u0435\u043c\u0435:from pydantic import BaseModelclass Plan(BaseModel):    steps: list[str]    estimate_hours: floatplan = await agent.ask(&#171;\u0420\u0430\u0441\u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0411\u0414&#187;, response_format=Plan)print(plan.steps, plan.estimate_hours)   # \u0443\u0436\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0437\u0434\u0435\u0441\u044c, \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 opt-in \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b: \u0441\u0443\u0431\u0430\u0433\u0435\u043d\u0442\u044b, \u043f\u0435\u0440\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u044f, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 MCP \u0438 A2A.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0433\u0435\u043d\u0442\u0422\u0443\u0442 \u0432\u0441\u0451 \u0441\u043a\u0443\u0447\u043d\u043e-\u043d\u0430\u0434\u0451\u0436\u043d\u043e: \u043f\u0438\u0442\u043e\u043d 3.11 \u0438\u043b\u0438 \u043d\u043e\u0432\u0435\u0435, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430.uv init .uv add ag2\u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434.import osfrom ag2 import Agentfrom ag2.config import OpenAICompletionsConfigcfg = OpenAICompletionsConfig(    model=os.environ[&#171;AG2_MODEL&#187;],                # \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, claude-5.1-fable    base_url=os.environ.get(&#171;AG2_BASE_URL&#187;),      # \u0448\u043b\u044e\u0437, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d    api_key=os.environ[&#171;AG2_API_KEY&#187;],)\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f!\u0412\u043e\u0442 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0432\u0430\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0433\u0435\u043d\u0442\u0430. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f.import asyncioasync def main() -&gt; None:    agent = Agent(&#171;hello&#187;, prompt=&#187;\u0422\u044b \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0448\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.&#187;, config=cfg)    reply = await agent.ask(&#171;\u041e\u0431\u044a\u044f\u0441\u043d\u0438 event loop \u0432 Python \u0432 \u0434\u0432\u0443\u0445 \u0430\u0431\u0437\u0430\u0446\u0430\u0445&#187;)    print(reply.body)    followup = await agent.ask(&#171;\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0434\u043b\u044f junior-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430&#187;)    print(followup.body)asyncio.run(main())\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438&#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-503550","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503550","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=503550"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/503550\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=503550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=503550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=503550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}