ag2 0.9.9__py3-none-any.whl → 0.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ag2 might be problematic. Click here for more details.

Files changed (113) hide show
  1. {ag2-0.9.9.dist-info → ag2-0.10.0.dist-info}/METADATA +243 -214
  2. {ag2-0.9.9.dist-info → ag2-0.10.0.dist-info}/RECORD +113 -87
  3. autogen/_website/generate_mkdocs.py +3 -3
  4. autogen/_website/notebook_processor.py +1 -1
  5. autogen/_website/utils.py +1 -1
  6. autogen/a2a/__init__.py +36 -0
  7. autogen/a2a/agent_executor.py +105 -0
  8. autogen/a2a/client.py +280 -0
  9. autogen/a2a/errors.py +18 -0
  10. autogen/a2a/httpx_client_factory.py +79 -0
  11. autogen/a2a/server.py +221 -0
  12. autogen/a2a/utils.py +165 -0
  13. autogen/agentchat/__init__.py +3 -0
  14. autogen/agentchat/agent.py +0 -2
  15. autogen/agentchat/assistant_agent.py +15 -15
  16. autogen/agentchat/chat.py +57 -41
  17. autogen/agentchat/contrib/agent_eval/criterion.py +1 -1
  18. autogen/agentchat/contrib/capabilities/text_compressors.py +5 -5
  19. autogen/agentchat/contrib/capabilities/tools_capability.py +1 -1
  20. autogen/agentchat/contrib/capabilities/transforms.py +1 -1
  21. autogen/agentchat/contrib/captainagent/agent_builder.py +1 -1
  22. autogen/agentchat/contrib/captainagent/captainagent.py +20 -19
  23. autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py +2 -5
  24. autogen/agentchat/contrib/graph_rag/graph_rag_capability.py +5 -5
  25. autogen/agentchat/contrib/graph_rag/neo4j_graph_query_engine.py +18 -17
  26. autogen/agentchat/contrib/llava_agent.py +1 -13
  27. autogen/agentchat/contrib/rag/mongodb_query_engine.py +2 -2
  28. autogen/agentchat/contrib/rag/query_engine.py +11 -11
  29. autogen/agentchat/contrib/retrieve_assistant_agent.py +3 -0
  30. autogen/agentchat/contrib/swarm_agent.py +3 -2
  31. autogen/agentchat/contrib/vectordb/couchbase.py +1 -1
  32. autogen/agentchat/contrib/vectordb/mongodb.py +1 -1
  33. autogen/agentchat/contrib/web_surfer.py +1 -1
  34. autogen/agentchat/conversable_agent.py +359 -150
  35. autogen/agentchat/group/context_expression.py +21 -21
  36. autogen/agentchat/group/group_tool_executor.py +46 -15
  37. autogen/agentchat/group/guardrails.py +41 -33
  38. autogen/agentchat/group/handoffs.py +11 -11
  39. autogen/agentchat/group/multi_agent_chat.py +56 -2
  40. autogen/agentchat/group/on_condition.py +11 -11
  41. autogen/agentchat/group/safeguards/__init__.py +21 -0
  42. autogen/agentchat/group/safeguards/api.py +241 -0
  43. autogen/agentchat/group/safeguards/enforcer.py +1158 -0
  44. autogen/agentchat/group/safeguards/events.py +119 -0
  45. autogen/agentchat/group/safeguards/validator.py +435 -0
  46. autogen/agentchat/groupchat.py +102 -49
  47. autogen/agentchat/realtime/experimental/clients/realtime_client.py +2 -2
  48. autogen/agentchat/realtime/experimental/function_observer.py +2 -3
  49. autogen/agentchat/realtime/experimental/realtime_agent.py +2 -3
  50. autogen/agentchat/realtime/experimental/realtime_swarm.py +22 -13
  51. autogen/agentchat/user_proxy_agent.py +55 -53
  52. autogen/agents/experimental/document_agent/document_agent.py +1 -10
  53. autogen/agents/experimental/document_agent/parser_utils.py +5 -1
  54. autogen/browser_utils.py +4 -4
  55. autogen/cache/abstract_cache_base.py +2 -6
  56. autogen/cache/disk_cache.py +1 -6
  57. autogen/cache/in_memory_cache.py +2 -6
  58. autogen/cache/redis_cache.py +1 -5
  59. autogen/coding/__init__.py +10 -2
  60. autogen/coding/base.py +2 -1
  61. autogen/coding/docker_commandline_code_executor.py +1 -6
  62. autogen/coding/factory.py +9 -0
  63. autogen/coding/jupyter/docker_jupyter_server.py +1 -7
  64. autogen/coding/jupyter/jupyter_client.py +2 -9
  65. autogen/coding/jupyter/jupyter_code_executor.py +2 -7
  66. autogen/coding/jupyter/local_jupyter_server.py +2 -6
  67. autogen/coding/local_commandline_code_executor.py +0 -65
  68. autogen/coding/yepcode_code_executor.py +197 -0
  69. autogen/environments/docker_python_environment.py +3 -3
  70. autogen/environments/system_python_environment.py +5 -5
  71. autogen/environments/venv_python_environment.py +5 -5
  72. autogen/events/agent_events.py +1 -1
  73. autogen/events/client_events.py +1 -1
  74. autogen/fast_depends/utils.py +10 -0
  75. autogen/graph_utils.py +5 -7
  76. autogen/import_utils.py +3 -1
  77. autogen/interop/pydantic_ai/pydantic_ai.py +8 -5
  78. autogen/io/processors/console_event_processor.py +8 -3
  79. autogen/llm_config/client.py +3 -2
  80. autogen/llm_config/config.py +168 -91
  81. autogen/llm_config/entry.py +38 -26
  82. autogen/llm_config/types.py +35 -0
  83. autogen/llm_config/utils.py +223 -0
  84. autogen/mcp/mcp_proxy/operation_grouping.py +48 -39
  85. autogen/messages/agent_messages.py +1 -1
  86. autogen/messages/client_messages.py +1 -1
  87. autogen/oai/__init__.py +8 -1
  88. autogen/oai/bedrock.py +0 -13
  89. autogen/oai/client.py +25 -11
  90. autogen/oai/client_utils.py +31 -1
  91. autogen/oai/cohere.py +4 -14
  92. autogen/oai/gemini.py +4 -6
  93. autogen/oai/gemini_types.py +1 -0
  94. autogen/oai/openai_utils.py +44 -115
  95. autogen/remote/__init__.py +18 -0
  96. autogen/remote/agent.py +199 -0
  97. autogen/remote/agent_service.py +142 -0
  98. autogen/remote/errors.py +17 -0
  99. autogen/remote/httpx_client_factory.py +131 -0
  100. autogen/remote/protocol.py +37 -0
  101. autogen/remote/retry.py +102 -0
  102. autogen/remote/runtime.py +96 -0
  103. autogen/testing/__init__.py +12 -0
  104. autogen/testing/messages.py +45 -0
  105. autogen/testing/test_agent.py +111 -0
  106. autogen/tools/dependency_injection.py +4 -8
  107. autogen/tools/experimental/reliable/reliable.py +3 -2
  108. autogen/tools/experimental/web_search_preview/web_search_preview.py +1 -1
  109. autogen/tools/function_utils.py +2 -1
  110. autogen/version.py +1 -1
  111. {ag2-0.9.9.dist-info → ag2-0.10.0.dist-info}/WHEEL +0 -0
  112. {ag2-0.9.9.dist-info → ag2-0.10.0.dist-info}/licenses/LICENSE +0 -0
  113. {ag2-0.9.9.dist-info → ag2-0.10.0.dist-info}/licenses/NOTICE.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ag2
3
- Version: 0.9.9
3
+ Version: 0.10.0
4
4
  Summary: A programming framework for agentic AI
5
5
  Project-URL: Homepage, https://ag2.ai/
6
6
  Project-URL: Documentation, https://docs.ag2.ai
@@ -28,9 +28,8 @@ Classifier: Topic :: Software Development
28
28
  Classifier: Topic :: Software Development :: Libraries
29
29
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
30
30
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
- Requires-Python: <3.14,>=3.10
31
+ Requires-Python: >=3.10
32
32
  Requires-Dist: anyio<5.0.0,>=3.0.0
33
- Requires-Dist: asyncer==0.0.8
34
33
  Requires-Dist: diskcache
35
34
  Requires-Dist: docker
36
35
  Requires-Dist: httpx<1,>=0.28.1
@@ -39,6 +38,8 @@ Requires-Dist: pydantic<3,>=2.6.1
39
38
  Requires-Dist: python-dotenv
40
39
  Requires-Dist: termcolor
41
40
  Requires-Dist: tiktoken
41
+ Provides-Extra: a2a
42
+ Requires-Dist: a2a-sdk[http-server]<0.4,>=0.3.7; extra == 'a2a'
42
43
  Provides-Extra: anthropic
43
44
  Requires-Dist: anthropic[vertex]>=0.23.1; extra == 'anthropic'
44
45
  Provides-Extra: autobuild
@@ -61,7 +62,7 @@ Requires-Dist: cerebras-cloud-sdk>=1.0.0; extra == 'cerebras'
61
62
  Provides-Extra: cohere
62
63
  Requires-Dist: cohere>=5.13.5; extra == 'cohere'
63
64
  Provides-Extra: commsagent-discord
64
- Requires-Dist: discord-py<2.6,>=2.4.0; extra == 'commsagent-discord'
65
+ Requires-Dist: discord-py<2.7,>=2.4.0; extra == 'commsagent-discord'
65
66
  Provides-Extra: commsagent-slack
66
67
  Requires-Dist: slack-sdk<3.40,>=3.33.0; extra == 'commsagent-slack'
67
68
  Provides-Extra: commsagent-telegram
@@ -73,61 +74,63 @@ Requires-Dist: crawl4ai<0.8,>=0.4.247; extra == 'crawl4ai'
73
74
  Provides-Extra: deepseek
74
75
  Requires-Dist: openai>=1.99.3; extra == 'deepseek'
75
76
  Provides-Extra: dev
77
+ Requires-Dist: a2a-sdk[http-server]<0.4,>=0.3.7; extra == 'dev'
76
78
  Requires-Dist: cairosvg; extra == 'dev'
77
79
  Requires-Dist: codespell==2.4.1; extra == 'dev'
78
80
  Requires-Dist: detect-secrets==1.5.0; extra == 'dev'
79
81
  Requires-Dist: dirty-equals==0.9.0; extra == 'dev'
80
82
  Requires-Dist: fastapi==0.116.1; extra == 'dev'
83
+ Requires-Dist: freezegun==1.5.5; extra == 'dev'
81
84
  Requires-Dist: ipykernel==6.30.1; extra == 'dev'
82
85
  Requires-Dist: jinja2==3.1.6; extra == 'dev'
83
86
  Requires-Dist: mcp>=1.11.0; extra == 'dev'
84
87
  Requires-Dist: mdx-include==1.4.2; extra == 'dev'
85
88
  Requires-Dist: mike==2.1.3; extra == 'dev'
86
89
  Requires-Dist: mkdocs-git-revision-date-localized-plugin==1.4.7; extra == 'dev'
87
- Requires-Dist: mkdocs-glightbox==0.4.0; extra == 'dev'
90
+ Requires-Dist: mkdocs-glightbox==0.5.1; extra == 'dev'
88
91
  Requires-Dist: mkdocs-literate-nav==0.6.2; extra == 'dev'
89
- Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'dev'
90
- Requires-Dist: mkdocs-material==9.6.16; extra == 'dev'
92
+ Requires-Dist: mkdocs-macros-plugin==1.3.9; extra == 'dev'
93
+ Requires-Dist: mkdocs-material==9.6.19; extra == 'dev'
91
94
  Requires-Dist: mkdocs-minify-plugin==0.8.0; extra == 'dev'
92
95
  Requires-Dist: mkdocs-redirects==1.2.2; extra == 'dev'
93
96
  Requires-Dist: mkdocstrings[python]==0.30.0; extra == 'dev'
94
- Requires-Dist: mock==5.2.0; extra == 'dev'
95
97
  Requires-Dist: mypy==1.17.1; extra == 'dev'
96
98
  Requires-Dist: nbclient==0.10.2; extra == 'dev'
97
99
  Requires-Dist: nbconvert==7.16.6; extra == 'dev'
98
100
  Requires-Dist: nbformat==5.10.4; extra == 'dev'
99
101
  Requires-Dist: openai>=1.99.3; extra == 'dev'
100
- Requires-Dist: pandas==2.3.1; extra == 'dev'
102
+ Requires-Dist: pandas==2.3.2; extra == 'dev'
101
103
  Requires-Dist: pdoc3==0.11.6; extra == 'dev'
102
104
  Requires-Dist: pillow; extra == 'dev'
103
105
  Requires-Dist: pre-commit==4.3.0; extra == 'dev'
104
106
  Requires-Dist: pytest-asyncio==1.1.0; extra == 'dev'
105
- Requires-Dist: pytest-cov==6.2.1; extra == 'dev'
106
- Requires-Dist: pytest==8.4.1; extra == 'dev'
107
+ Requires-Dist: pytest-cov==6.3.0; extra == 'dev'
108
+ Requires-Dist: pytest==8.4.2; extra == 'dev'
107
109
  Requires-Dist: pyupgrade-directories==0.3.0; extra == 'dev'
108
110
  Requires-Dist: pyyaml==6.0.2; extra == 'dev'
109
- Requires-Dist: ruff==0.12.8; extra == 'dev'
111
+ Requires-Dist: ruff==0.12.12; extra == 'dev'
110
112
  Requires-Dist: termcolor==3.1.0; extra == 'dev'
111
113
  Requires-Dist: toml==0.10.2; extra == 'dev'
112
- Requires-Dist: typer==0.16.0; extra == 'dev'
114
+ Requires-Dist: typer==0.17.4; extra == 'dev'
113
115
  Requires-Dist: types-decorator; extra == 'dev'
114
116
  Requires-Dist: types-pycurl; extra == 'dev'
115
117
  Requires-Dist: types-python-dateutil; extra == 'dev'
116
118
  Requires-Dist: types-pyyaml; extra == 'dev'
117
119
  Requires-Dist: types-requests; extra == 'dev'
118
120
  Requires-Dist: types-ujson; extra == 'dev'
119
- Requires-Dist: uv==0.8.8; extra == 'dev'
121
+ Requires-Dist: uv==0.8.15; extra == 'dev'
120
122
  Provides-Extra: docs
123
+ Requires-Dist: a2a-sdk[http-server]<0.4,>=0.3.7; extra == 'docs'
121
124
  Requires-Dist: cairosvg; extra == 'docs'
122
125
  Requires-Dist: jinja2==3.1.6; extra == 'docs'
123
126
  Requires-Dist: mcp>=1.11.0; extra == 'docs'
124
127
  Requires-Dist: mdx-include==1.4.2; extra == 'docs'
125
128
  Requires-Dist: mike==2.1.3; extra == 'docs'
126
129
  Requires-Dist: mkdocs-git-revision-date-localized-plugin==1.4.7; extra == 'docs'
127
- Requires-Dist: mkdocs-glightbox==0.4.0; extra == 'docs'
130
+ Requires-Dist: mkdocs-glightbox==0.5.1; extra == 'docs'
128
131
  Requires-Dist: mkdocs-literate-nav==0.6.2; extra == 'docs'
129
- Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
130
- Requires-Dist: mkdocs-material==9.6.16; extra == 'docs'
132
+ Requires-Dist: mkdocs-macros-plugin==1.3.9; extra == 'docs'
133
+ Requires-Dist: mkdocs-material==9.6.19; extra == 'docs'
131
134
  Requires-Dist: mkdocs-minify-plugin==0.8.0; extra == 'docs'
132
135
  Requires-Dist: mkdocs-redirects==1.2.2; extra == 'docs'
133
136
  Requires-Dist: mkdocstrings[python]==0.30.0; extra == 'docs'
@@ -136,7 +139,7 @@ Requires-Dist: pdoc3==0.11.6; extra == 'docs'
136
139
  Requires-Dist: pillow; extra == 'docs'
137
140
  Requires-Dist: pyyaml==6.0.2; extra == 'docs'
138
141
  Requires-Dist: termcolor==3.1.0; extra == 'docs'
139
- Requires-Dist: typer==0.16.0; extra == 'docs'
142
+ Requires-Dist: typer==0.17.4; extra == 'docs'
140
143
  Provides-Extra: duckduckgo
141
144
  Requires-Dist: duckduckgo-search>=8.0.2; extra == 'duckduckgo'
142
145
  Provides-Extra: flaml
@@ -171,23 +174,25 @@ Requires-Dist: matplotlib; extra == 'graph'
171
174
  Requires-Dist: networkx; extra == 'graph'
172
175
  Provides-Extra: graph-rag-falkor-db
173
176
  Requires-Dist: falkordb>=1.0.10; extra == 'graph-rag-falkor-db'
174
- Requires-Dist: graphrag-sdk==0.7.1; extra == 'graph-rag-falkor-db'
177
+ Requires-Dist: graphrag-sdk==0.8.0; extra == 'graph-rag-falkor-db'
175
178
  Provides-Extra: groq
176
179
  Requires-Dist: groq>=0.9.0; extra == 'groq'
177
180
  Provides-Extra: interop
178
181
  Requires-Dist: crewai[tools]<1,>=0.76; (python_version >= '3.10' and python_version < '3.13') and extra == 'interop'
182
+ Requires-Dist: fasta2a; extra == 'interop'
179
183
  Requires-Dist: langchain-community<1,>=0.3.12; extra == 'interop'
180
- Requires-Dist: litellm<=1.75.5.post1; extra == 'interop'
181
- Requires-Dist: pydantic-ai==0.6.2; extra == 'interop'
184
+ Requires-Dist: litellm<=1.76.3; extra == 'interop'
185
+ Requires-Dist: pydantic-ai>=1.0.12; extra == 'interop'
182
186
  Requires-Dist: weaviate-client<5,>=4; (python_version >= '3.10' and python_version < '3.13') and extra == 'interop'
183
187
  Provides-Extra: interop-crewai
184
188
  Requires-Dist: crewai[tools]<1,>=0.76; (python_version >= '3.10' and python_version < '3.13') and extra == 'interop-crewai'
185
- Requires-Dist: litellm<=1.75.5.post1; extra == 'interop-crewai'
189
+ Requires-Dist: litellm<=1.76.3; extra == 'interop-crewai'
186
190
  Requires-Dist: weaviate-client<5,>=4; (python_version >= '3.10' and python_version < '3.13') and extra == 'interop-crewai'
187
191
  Provides-Extra: interop-langchain
188
192
  Requires-Dist: langchain-community<1,>=0.3.12; extra == 'interop-langchain'
189
193
  Provides-Extra: interop-pydantic-ai
190
- Requires-Dist: pydantic-ai==0.6.2; extra == 'interop-pydantic-ai'
194
+ Requires-Dist: fasta2a; extra == 'interop-pydantic-ai'
195
+ Requires-Dist: pydantic-ai>=1.0.12; extra == 'interop-pydantic-ai'
191
196
  Provides-Extra: jupyter-executor
192
197
  Requires-Dist: ipykernel>=6.29.0; extra == 'jupyter-executor'
193
198
  Requires-Dist: jupyter-client>=8.6.0; extra == 'jupyter-executor'
@@ -197,7 +202,7 @@ Requires-Dist: websocket-client; extra == 'jupyter-executor'
197
202
  Provides-Extra: lint
198
203
  Requires-Dist: codespell==2.4.1; extra == 'lint'
199
204
  Requires-Dist: pyupgrade-directories==0.3.0; extra == 'lint'
200
- Requires-Dist: ruff==0.12.8; extra == 'lint'
205
+ Requires-Dist: ruff==0.12.12; extra == 'lint'
201
206
  Provides-Extra: lmm
202
207
  Requires-Dist: pillow; extra == 'lmm'
203
208
  Requires-Dist: replicate; extra == 'lmm'
@@ -218,9 +223,10 @@ Provides-Extra: mistral
218
223
  Requires-Dist: mistralai>=1.0.1; extra == 'mistral'
219
224
  Provides-Extra: neo4j
220
225
  Requires-Dist: docx2txt==0.9; extra == 'neo4j'
221
- Requires-Dist: llama-index-graph-stores-neo4j==0.5.0; extra == 'neo4j'
222
- Requires-Dist: llama-index-readers-web==0.5.0; extra == 'neo4j'
223
- Requires-Dist: llama-index<1,>=0.12; extra == 'neo4j'
226
+ Requires-Dist: llama-index-core<0.14,>=0.12; extra == 'neo4j'
227
+ Requires-Dist: llama-index-graph-stores-neo4j<0.6,>=0.4; extra == 'neo4j'
228
+ Requires-Dist: llama-index-readers-web<0.6,>=0.4; extra == 'neo4j'
229
+ Requires-Dist: llama-index<0.14,>=0.12; extra == 'neo4j'
224
230
  Provides-Extra: ollama
225
231
  Requires-Dist: fix-busted-json>=0.0.18; extra == 'ollama'
226
232
  Requires-Dist: ollama>=0.4.7; extra == 'ollama'
@@ -232,11 +238,14 @@ Requires-Dist: openai[realtime]; extra == 'openai-realtime'
232
238
  Provides-Extra: rag
233
239
  Requires-Dist: chromadb<2,>=0.5; extra == 'rag'
234
240
  Requires-Dist: docling<3,>=2.15.1; extra == 'rag'
235
- Requires-Dist: llama-index-embeddings-huggingface==0.6.0; extra == 'rag'
236
- Requires-Dist: llama-index-llms-langchain==0.7.0; extra == 'rag'
237
- Requires-Dist: llama-index-vector-stores-chroma==0.4.1; extra == 'rag'
238
- Requires-Dist: llama-index-vector-stores-mongodb==0.8.0; extra == 'rag'
239
- Requires-Dist: llama-index<1,>=0.12; extra == 'rag'
241
+ Requires-Dist: llama-index-core<0.14,>=0.12; extra == 'rag'
242
+ Requires-Dist: llama-index-embeddings-huggingface<0.7,>=0.5; extra == 'rag'
243
+ Requires-Dist: llama-index-embeddings-openai<0.6,>=0.3; extra == 'rag'
244
+ Requires-Dist: llama-index-llms-langchain<0.8,>=0.6; extra == 'rag'
245
+ Requires-Dist: llama-index-llms-openai<0.6,>=0.4; extra == 'rag'
246
+ Requires-Dist: llama-index-vector-stores-chroma<0.6,>=0.4; extra == 'rag'
247
+ Requires-Dist: llama-index-vector-stores-mongodb<0.9,>=0.6; extra == 'rag'
248
+ Requires-Dist: llama-index<0.14,>=0.12; extra == 'rag'
240
249
  Requires-Dist: requests<3,>=2.32.3; extra == 'rag'
241
250
  Requires-Dist: selenium<5,>=4.28.1; extra == 'rag'
242
251
  Requires-Dist: webdriver-manager==4.0.2; extra == 'rag'
@@ -244,50 +253,50 @@ Provides-Extra: redis
244
253
  Requires-Dist: redis; extra == 'redis'
245
254
  Provides-Extra: retrievechat
246
255
  Requires-Dist: beautifulsoup4; extra == 'retrievechat'
247
- Requires-Dist: chromadb==1.0.16; extra == 'retrievechat'
256
+ Requires-Dist: chromadb==1.0.20; extra == 'retrievechat'
248
257
  Requires-Dist: ipython; extra == 'retrievechat'
249
258
  Requires-Dist: markdownify; extra == 'retrievechat'
250
- Requires-Dist: protobuf==6.31.1; extra == 'retrievechat'
259
+ Requires-Dist: protobuf==6.32.0; extra == 'retrievechat'
251
260
  Requires-Dist: pypdf; extra == 'retrievechat'
252
261
  Requires-Dist: sentence-transformers<=5.1.0; extra == 'retrievechat'
253
262
  Provides-Extra: retrievechat-couchbase
254
263
  Requires-Dist: beautifulsoup4; extra == 'retrievechat-couchbase'
255
- Requires-Dist: chromadb==1.0.16; extra == 'retrievechat-couchbase'
264
+ Requires-Dist: chromadb==1.0.20; extra == 'retrievechat-couchbase'
256
265
  Requires-Dist: couchbase>=4.3.0; extra == 'retrievechat-couchbase'
257
266
  Requires-Dist: ipython; extra == 'retrievechat-couchbase'
258
267
  Requires-Dist: markdownify; extra == 'retrievechat-couchbase'
259
268
  Requires-Dist: numpy; extra == 'retrievechat-couchbase'
260
- Requires-Dist: protobuf==6.31.1; extra == 'retrievechat-couchbase'
269
+ Requires-Dist: protobuf==6.32.0; extra == 'retrievechat-couchbase'
261
270
  Requires-Dist: pypdf; extra == 'retrievechat-couchbase'
262
271
  Requires-Dist: sentence-transformers<=5.1.0; extra == 'retrievechat-couchbase'
263
272
  Provides-Extra: retrievechat-mongodb
264
273
  Requires-Dist: beautifulsoup4; extra == 'retrievechat-mongodb'
265
- Requires-Dist: chromadb==1.0.16; extra == 'retrievechat-mongodb'
274
+ Requires-Dist: chromadb==1.0.20; extra == 'retrievechat-mongodb'
266
275
  Requires-Dist: ipython; extra == 'retrievechat-mongodb'
267
276
  Requires-Dist: markdownify; extra == 'retrievechat-mongodb'
268
277
  Requires-Dist: numpy; extra == 'retrievechat-mongodb'
269
- Requires-Dist: protobuf==6.31.1; extra == 'retrievechat-mongodb'
278
+ Requires-Dist: protobuf==6.32.0; extra == 'retrievechat-mongodb'
270
279
  Requires-Dist: pymongo>=4.0.0; extra == 'retrievechat-mongodb'
271
280
  Requires-Dist: pypdf; extra == 'retrievechat-mongodb'
272
281
  Requires-Dist: sentence-transformers<=5.1.0; extra == 'retrievechat-mongodb'
273
282
  Provides-Extra: retrievechat-pgvector
274
283
  Requires-Dist: beautifulsoup4; extra == 'retrievechat-pgvector'
275
- Requires-Dist: chromadb==1.0.16; extra == 'retrievechat-pgvector'
284
+ Requires-Dist: chromadb==1.0.20; extra == 'retrievechat-pgvector'
276
285
  Requires-Dist: ipython; extra == 'retrievechat-pgvector'
277
286
  Requires-Dist: markdownify; extra == 'retrievechat-pgvector'
278
287
  Requires-Dist: pgvector>=0.2.5; extra == 'retrievechat-pgvector'
279
- Requires-Dist: protobuf==6.31.1; extra == 'retrievechat-pgvector'
288
+ Requires-Dist: protobuf==6.32.0; extra == 'retrievechat-pgvector'
280
289
  Requires-Dist: psycopg>=3.1.18; (platform_system == 'Linux') and extra == 'retrievechat-pgvector'
281
290
  Requires-Dist: psycopg[binary]>=3.1.18; (platform_system == 'Windows' or platform_system == 'Darwin') and extra == 'retrievechat-pgvector'
282
291
  Requires-Dist: pypdf; extra == 'retrievechat-pgvector'
283
292
  Requires-Dist: sentence-transformers<=5.1.0; extra == 'retrievechat-pgvector'
284
293
  Provides-Extra: retrievechat-qdrant
285
294
  Requires-Dist: beautifulsoup4; extra == 'retrievechat-qdrant'
286
- Requires-Dist: chromadb==1.0.16; extra == 'retrievechat-qdrant'
295
+ Requires-Dist: chromadb==1.0.20; extra == 'retrievechat-qdrant'
287
296
  Requires-Dist: fastembed>=0.3.1; extra == 'retrievechat-qdrant'
288
297
  Requires-Dist: ipython; extra == 'retrievechat-qdrant'
289
298
  Requires-Dist: markdownify; extra == 'retrievechat-qdrant'
290
- Requires-Dist: protobuf==6.31.1; extra == 'retrievechat-qdrant'
299
+ Requires-Dist: protobuf==6.32.0; extra == 'retrievechat-qdrant'
291
300
  Requires-Dist: pypdf; extra == 'retrievechat-qdrant'
292
301
  Requires-Dist: qdrant-client; extra == 'retrievechat-qdrant'
293
302
  Requires-Dist: sentence-transformers<=5.1.0; extra == 'retrievechat-qdrant'
@@ -298,15 +307,15 @@ Requires-Dist: chromadb; extra == 'teachable'
298
307
  Provides-Extra: test
299
308
  Requires-Dist: dirty-equals==0.9.0; extra == 'test'
300
309
  Requires-Dist: fastapi==0.116.1; extra == 'test'
310
+ Requires-Dist: freezegun==1.5.5; extra == 'test'
301
311
  Requires-Dist: ipykernel==6.30.1; extra == 'test'
302
312
  Requires-Dist: mcp>=1.11.0; extra == 'test'
303
- Requires-Dist: mock==5.2.0; extra == 'test'
304
313
  Requires-Dist: nbconvert==7.16.6; extra == 'test'
305
314
  Requires-Dist: nbformat==5.10.4; extra == 'test'
306
- Requires-Dist: pandas==2.3.1; extra == 'test'
315
+ Requires-Dist: pandas==2.3.2; extra == 'test'
307
316
  Requires-Dist: pytest-asyncio==1.1.0; extra == 'test'
308
- Requires-Dist: pytest-cov==6.2.1; extra == 'test'
309
- Requires-Dist: pytest==8.4.1; extra == 'test'
317
+ Requires-Dist: pytest-cov==6.3.0; extra == 'test'
318
+ Requires-Dist: pytest==8.4.2; extra == 'test'
310
319
  Provides-Extra: together
311
320
  Requires-Dist: together>=1.2; extra == 'together'
312
321
  Provides-Extra: twilio
@@ -314,19 +323,20 @@ Requires-Dist: fastapi<1,>=0.115.0; extra == 'twilio'
314
323
  Requires-Dist: twilio>=9.3.2; extra == 'twilio'
315
324
  Requires-Dist: uvicorn<1,>=0.30.6; extra == 'twilio'
316
325
  Provides-Extra: types
326
+ Requires-Dist: a2a-sdk[http-server]<0.4,>=0.3.7; extra == 'types'
317
327
  Requires-Dist: dirty-equals==0.9.0; extra == 'types'
318
328
  Requires-Dist: fastapi==0.116.1; extra == 'types'
329
+ Requires-Dist: freezegun==1.5.5; extra == 'types'
319
330
  Requires-Dist: ipykernel==6.30.1; extra == 'types'
320
331
  Requires-Dist: mcp>=1.11.0; extra == 'types'
321
- Requires-Dist: mock==5.2.0; extra == 'types'
322
332
  Requires-Dist: mypy==1.17.1; extra == 'types'
323
333
  Requires-Dist: nbconvert==7.16.6; extra == 'types'
324
334
  Requires-Dist: nbformat==5.10.4; extra == 'types'
325
335
  Requires-Dist: openai>=1.99.3; extra == 'types'
326
- Requires-Dist: pandas==2.3.1; extra == 'types'
336
+ Requires-Dist: pandas==2.3.2; extra == 'types'
327
337
  Requires-Dist: pytest-asyncio==1.1.0; extra == 'types'
328
- Requires-Dist: pytest-cov==6.2.1; extra == 'types'
329
- Requires-Dist: pytest==8.4.1; extra == 'types'
338
+ Requires-Dist: pytest-cov==6.3.0; extra == 'types'
339
+ Requires-Dist: pytest==8.4.2; extra == 'types'
330
340
  Requires-Dist: types-decorator; extra == 'types'
331
341
  Requires-Dist: types-pycurl; extra == 'types'
332
342
  Requires-Dist: types-python-dateutil; extra == 'types'
@@ -342,6 +352,9 @@ Requires-Dist: pathvalidate; extra == 'websurfer'
342
352
  Requires-Dist: pdfminer-six; extra == 'websurfer'
343
353
  Provides-Extra: wikipedia
344
354
  Requires-Dist: wikipedia-api<1.0,>=0.8.1; extra == 'wikipedia'
355
+ Provides-Extra: yepcode
356
+ Requires-Dist: python-dotenv; extra == 'yepcode'
357
+ Requires-Dist: yepcode-run>=1.6.1; extra == 'yepcode'
345
358
  Description-Content-Type: text/markdown
346
359
 
347
360
  <a name="readme-top"></a>
@@ -411,9 +424,9 @@ The project is currently maintained by a [dynamic group of volunteers](MAINTAINE
411
424
  - [Tools](#tools)
412
425
  - [Advanced agentic design patterns](#advanced-agentic-design-patterns)
413
426
  - [Announcements](#announcements)
414
- - [Contributors Wall](#contributors-wall)
415
427
  - [Code style and linting](#code-style-and-linting)
416
428
  - [Related papers](#related-papers)
429
+ - [Contributors Wall](#contributors-wall)
417
430
  - [Cite the project](#cite-the-project)
418
431
  - [License](#license)
419
432
 
@@ -425,22 +438,30 @@ For a step-by-step walk through of AG2 concepts and code, see [Basic Concepts](h
425
438
 
426
439
  AG2 requires **Python version >= 3.10, < 3.14**. AG2 is available via `ag2` (or its alias `autogen`) on PyPI.
427
440
 
441
+ **Windows/Linux:**
428
442
  ```bash
429
443
  pip install ag2[openai]
430
444
  ```
431
445
 
446
+ **Mac:**
447
+ ```bash
448
+ pip install 'ag2[openai]'
449
+ ```
450
+
432
451
  Minimal dependencies are installed by default. You can install extra options based on the features you need.
433
452
 
434
453
  ### Setup your API keys
435
454
 
436
- To keep your LLM dependencies neat we recommend using the `OAI_CONFIG_LIST` file to store your API keys.
455
+ To keep your LLM dependencies neat and avoid accidentally checking in code with your API key, we recommend storing your keys in a configuration file.
437
456
 
438
- You can use the sample file `OAI_CONFIG_LIST_sample` as a template.
457
+ In our examples, we use a file named **`OAI_CONFIG_LIST`** to store API keys. You can choose any filename, but make sure to add it to `.gitignore` so it will not be committed to source control.
458
+
459
+ You can use the following content as a template:
439
460
 
440
461
  ```json
441
462
  [
442
463
  {
443
- "model": "gpt-4o",
464
+ "model": "gpt-5",
444
465
  "api_key": "<your OpenAI API key here>"
445
466
  }
446
467
  ]
@@ -455,12 +476,11 @@ from autogen import AssistantAgent, UserProxyAgent, LLMConfig
455
476
 
456
477
  llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
457
478
 
479
+ assistant = AssistantAgent("assistant", llm_config=llm_config)
458
480
 
459
- with llm_config:
460
- assistant = AssistantAgent("assistant")
461
481
  user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
462
- user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
463
- # This initiates an automated chat between the two agents to solve the task
482
+
483
+ user_proxy.run(assistant, message="Summarize the main differences between Python lists and tuples.").process()
464
484
  ```
465
485
 
466
486
  ## Example applications
@@ -484,208 +504,216 @@ We have several agent concepts in AG2 to help you build your AI agents. We intro
484
504
 
485
505
  The [ConversableAgent](https://docs.ag2.ai/latest/docs/api-reference/autogen/ConversableAgent) is the fundamental building block of AG2, designed to enable seamless communication between AI entities. This core agent type handles message exchange and response generation, serving as the base class for all agents in the framework.
486
506
 
487
- In the example below, we'll create a simple information validation workflow with two specialized agents that communicate with each other:
488
-
489
- Note: Before running this code, make sure to set your `OPENAI_API_KEY` as an environment variable. This example uses `gpt-4o-mini`, but you can replace it with any other [model](https://docs.ag2.ai/latest/docs/user-guide/models/amazon-bedrock) supported by AG2.
507
+ Let's begin with a simple example where two agents collaborate:
508
+ - A **coder agent** that writes Python code.
509
+ - A **reviewer agent** that critiques the code without rewriting it.
490
510
 
491
511
  ```python
492
- # 1. Import ConversableAgent class
512
+ import logging
493
513
  from autogen import ConversableAgent, LLMConfig
494
514
 
495
- # 2. Define our LLM configuration for OpenAI's GPT-4o mini
496
- # uses the OPENAI_API_KEY environment variable
497
- llm_config = LLMConfig(api_type="openai", model="gpt-4o-mini")
498
-
499
-
500
- # 3. Create our LLM agent
501
- with llm_config:
502
- # Create an AI agent
503
- assistant = ConversableAgent(
504
- name="assistant",
505
- system_message="You are an assistant that responds concisely.",
506
- )
507
-
508
- # Create another AI agent
509
- fact_checker = ConversableAgent(
510
- name="fact_checker",
511
- system_message="You are a fact-checking assistant.",
512
- )
513
-
514
- # 4. Start the conversation
515
- assistant.initiate_chat(
516
- recipient=fact_checker,
517
- message="What is AG2?",
518
- max_turns=2
515
+ # Configure logging
516
+ logging.basicConfig(level=logging.INFO)
517
+ logger = logging.getLogger(__name__)
518
+
519
+ # Load LLM configuration
520
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
521
+
522
+ # Define agents
523
+ coder = ConversableAgent(
524
+ name="coder",
525
+ system_message="You are a Python developer. Write short Python scripts.",
526
+ llm_config=llm_config,
519
527
  )
520
- ```
521
528
 
522
- ### Human in the loop
529
+ reviewer = ConversableAgent(
530
+ name="reviewer",
531
+ system_message="You are a code reviewer. Analyze provided code and suggest improvements. "
532
+ "Do not generate code, only suggest improvements.",
533
+ llm_config=llm_config,
534
+ )
523
535
 
524
- Human oversight is crucial for many AI workflows, especially when dealing with critical decisions, creative tasks, or situations requiring expert judgment. AG2 makes integrating human feedback seamless through its human-in-the-loop functionality.
525
- You can configure how and when human input is solicited using the `human_input_mode` parameter:
536
+ # Start a conversation
537
+ response = reviewer.run(
538
+ recipient=coder,
539
+ message="Write a Python function that computes Fibonacci numbers.",
540
+ max_turns=10
541
+ )
526
542
 
527
- - `ALWAYS`: Requires human input for every response
528
- - `NEVER`: Operates autonomously without human involvement
529
- - `TERMINATE`: Only requests human input to end conversations
543
+ response.process()
530
544
 
531
- For convenience, AG2 provides the specialized `UserProxyAgent` class that automatically sets `human_input_mode` to `ALWAYS` and supports code execution:
545
+ logger.info("Final output:\n%s", response.summary)
546
+ ```
547
+
548
+ ---
549
+ ### Orchestrating Multiple Agents
550
+
551
+ AG2 enables sophisticated multi-agent collaboration through flexible orchestration patterns, allowing you to create dynamic systems where specialized agents work together to solve complex problems.
532
552
 
533
- Note: Before running this code, make sure to set your `OPENAI_API_KEY` as an environment variable. This example uses `gpt-4o-mini`, but you can replace it with any other [model](https://docs.ag2.ai/latest/docs/user-guide/models/amazon-bedrock) supported by AG2.
553
+ Here’s how to build a team of **teacher**, **lesson planner**, and **reviewer** agents working together to design a lesson plan:
534
554
 
535
555
  ```python
536
- # 1. Import ConversableAgent and UserProxyAgent classes
537
- from autogen import ConversableAgent, UserProxyAgent, LLMConfig
556
+ import logging
557
+ from autogen import ConversableAgent, LLMConfig
558
+ from autogen.agentchat import run_group_chat
559
+ from autogen.agentchat.group.patterns import AutoPattern
538
560
 
539
- # 2. Define our LLM configuration for OpenAI's GPT-4o mini
540
- # uses the OPENAI_API_KEY environment variable
541
- llm_config = LLMConfig(api_type="openai", model="gpt-4o-mini")
561
+ logging.basicConfig(level=logging.INFO)
562
+ logger = logging.getLogger(__name__)
542
563
 
564
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
543
565
 
544
- # 3. Create our LLM agent
545
- with llm_config:
546
- assistant = ConversableAgent(
547
- name="assistant",
548
- system_message="You are a helpful assistant.",
549
- )
566
+ # Define lesson planner and reviewer
567
+ planner_message = "You are a classroom lesson planner. Given a topic, write a lesson plan for a fourth grade class."
568
+ reviewer_message = "You are a classroom lesson reviewer. Compare the plan to the curriculum and suggest up to 3 improvements."
550
569
 
551
- # 4. Create a human agent with manual input mode
552
- human = ConversableAgent(
553
- name="human",
554
- human_input_mode="ALWAYS"
570
+ lesson_planner = ConversableAgent(
571
+ name="planner_agent",
572
+ system_message=planner_message,
573
+ description="Creates or revises lesson plans.",
574
+ llm_config=llm_config,
555
575
  )
556
- # or
557
- human = UserProxyAgent(name="human", code_execution_config={"work_dir": "coding", "use_docker": False})
558
576
 
559
- # 5. Start the chat
560
- human.initiate_chat(
561
- recipient=assistant,
562
- message="Hello! What's 2 + 2?"
577
+ lesson_reviewer = ConversableAgent(
578
+ name="reviewer_agent",
579
+ system_message=reviewer_message,
580
+ description="Provides one round of feedback to lesson plans.",
581
+ llm_config=llm_config,
563
582
  )
564
583
 
565
- ```
584
+ teacher_message = "You are a classroom teacher. You decide topics and collaborate with planner and reviewer to finalize lesson plans. When satisfied, output DONE!"
566
585
 
567
- ### Orchestrating multiple agents
586
+ teacher = ConversableAgent(
587
+ name="teacher_agent",
588
+ system_message=teacher_message,
589
+ is_termination_msg=lambda x: "DONE!" in (x.get("content", "") or "").upper(),
590
+ llm_config=llm_config,
591
+ )
568
592
 
569
- AG2 enables sophisticated multi-agent collaboration through flexible orchestration patterns, allowing you to create dynamic systems where specialized agents work together to solve complex problems.
593
+ auto_selection = AutoPattern(
594
+ agents=[teacher, lesson_planner, lesson_reviewer],
595
+ initial_agent=lesson_planner,
596
+ group_manager_args={"name": "group_manager", "llm_config": llm_config},
597
+ )
598
+
599
+ response = run_group_chat(
600
+ pattern=auto_selection,
601
+ messages="Let's introduce our kids to the solar system.",
602
+ max_rounds=20,
603
+ )
570
604
 
571
- The framework offers both custom orchestration and several built-in collaboration patterns including `GroupChat` and `Swarm`.
605
+ response.process()
606
+
607
+ logger.info("Final output:\n%s", response.summary)
608
+ ```
572
609
 
573
- Here's how to implement a collaborative team for curriculum development using GroupChat:
610
+ ---
574
611
 
575
- Note: Before running this code, make sure to set your `OPENAI_API_KEY` as an environment variable. This example uses `gpt-4o-mini`, but you can replace it with any other [model](https://docs.ag2.ai/latest/docs/user-guide/models/amazon-bedrock) supported by AG2.
612
+ ### Human in the Loop
613
+
614
+ Human oversight is often essential for validating or guiding AI outputs.
615
+ AG2 provides the `UserProxyAgent` for seamless integration of human feedback.
616
+
617
+ Here we extend the **teacher–planner–reviewer** example by introducing a **human agent** who validates the final lesson:
576
618
 
577
619
  ```python
578
- from autogen import ConversableAgent, GroupChat, GroupChatManager, LLMConfig
579
-
580
- # Put your key in the OPENAI_API_KEY environment variable
581
- llm_config = LLMConfig(api_type="openai", model="gpt-4o-mini")
582
-
583
- planner_message = """You are a classroom lesson agent.
584
- Given a topic, write a lesson plan for a fourth grade class.
585
- Use the following format:
586
- <title>Lesson plan title</title>
587
- <learning_objectives>Key learning objectives</learning_objectives>
588
- <script>How to introduce the topic to the kids</script>
589
- """
590
-
591
- reviewer_message = """You are a classroom lesson reviewer.
592
- You compare the lesson plan to the fourth grade curriculum and provide a maximum of 3 recommended changes.
593
- Provide only one round of reviews to a lesson plan.
594
- """
595
-
596
- # 1. Add a separate 'description' for our planner and reviewer agents
597
- planner_description = "Creates or revises lesson plans."
598
-
599
- reviewer_description = """Provides one round of reviews to a lesson plan
600
- for the lesson_planner to revise."""
601
-
602
- with llm_config:
603
- lesson_planner = ConversableAgent(
604
- name="planner_agent",
605
- system_message=planner_message,
606
- description=planner_description,
607
- )
608
-
609
- lesson_reviewer = ConversableAgent(
610
- name="reviewer_agent",
611
- system_message=reviewer_message,
612
- description=reviewer_description,
613
- )
614
-
615
- # 2. The teacher's system message can also be used as a description, so we don't define it
616
- teacher_message = """You are a classroom teacher.
617
- You decide topics for lessons and work with a lesson planner.
618
- and reviewer to create and finalise lesson plans.
619
- When you are happy with a lesson plan, output "DONE!".
620
- """
621
-
622
- with llm_config:
623
- teacher = ConversableAgent(
624
- name="teacher_agent",
625
- system_message=teacher_message,
626
- # 3. Our teacher can end the conversation by saying DONE!
627
- is_termination_msg=lambda x: "DONE!" in (x.get("content", "") or "").upper(),
628
- )
629
-
630
- # 4. Create the GroupChat with agents and selection method
631
- groupchat = GroupChat(
632
- agents=[teacher, lesson_planner, lesson_reviewer],
633
- speaker_selection_method="auto",
634
- messages=[],
620
+ import logging
621
+ from autogen import ConversableAgent, LLMConfig, UserProxyAgent
622
+ from autogen.agentchat import run_group_chat
623
+ from autogen.agentchat.group.patterns import AutoPattern
624
+
625
+ logging.basicConfig(level=logging.INFO)
626
+ logger = logging.getLogger(__name__)
627
+
628
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
629
+
630
+ # Same agents as before, but now the human validator will pass to the planner who will check for "APPROVED" and terminate
631
+ planner_message = "You are a classroom lesson planner. Given a topic, write a lesson plan for a fourth grade class."
632
+ reviewer_message = "You are a classroom lesson reviewer. Compare the plan to the curriculum and suggest up to 3 improvements."
633
+ teacher_message = "You are an experienced classroom teacher. You don't prepare plans, you provide simple guidance to the planner to prepare a lesson plan on the key topic."
634
+
635
+ lesson_planner = ConversableAgent(
636
+ name="planner_agent",
637
+ system_message=planner_message,
638
+ description="Creates or revises lesson plans before having them reviewed.",
639
+ is_termination_msg=lambda x: "APPROVED" in (x.get("content", "") or "").upper(),
640
+ human_input_mode="NEVER",
641
+ llm_config=llm_config,
635
642
  )
636
643
 
637
- # 5. Our GroupChatManager will manage the conversation and uses an LLM to select the next agent
638
- manager = GroupChatManager(
639
- name="group_manager",
640
- groupchat=groupchat,
644
+ lesson_reviewer = ConversableAgent(
645
+ name="reviewer_agent",
646
+ system_message=reviewer_message,
647
+ description="Provides one round of feedback to lesson plans back to the lesson planner before requiring the human validator.",
641
648
  llm_config=llm_config,
642
649
  )
643
650
 
644
- # 6. Initiate the chat with the GroupChatManager as the recipient
645
- teacher.initiate_chat(
646
- recipient=manager,
647
- message="Today, let's introduce our kids to the solar system."
651
+ teacher = ConversableAgent(
652
+ name="teacher_agent",
653
+ system_message=teacher_message,
654
+ description="Provides guidance on the topic and content, if required.",
655
+ llm_config=llm_config,
656
+ )
657
+
658
+ human_validator = UserProxyAgent(
659
+ name="human_validator",
660
+ system_message="You are a human educator who provides final approval for lesson plans.",
661
+ description="Evaluates the proposed lesson plan and either approves it or requests revisions, before returning to the planner.",
648
662
  )
649
- ```
650
663
 
651
- When executed, this code creates a collaborative system where the teacher initiates the conversation, and the lesson planner and reviewer agents work together to create and refine a lesson plan. The GroupChatManager orchestrates the conversation, selecting the next agent to respond based on the context of the discussion.
664
+ auto_selection = AutoPattern(
665
+ agents=[teacher, lesson_planner, lesson_reviewer],
666
+ initial_agent=teacher,
667
+ user_agent=human_validator,
668
+ group_manager_args={"name": "group_manager", "llm_config": llm_config},
669
+ )
652
670
 
653
- For workflows requiring more structured processes, explore the Group Chat pattern in the detailed [documentation](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/orchestration/group-chat/introduction).
671
+ response = run_group_chat(
672
+ pattern=auto_selection,
673
+ messages="Let's introduce our kids to the solar system.",
674
+ max_rounds=20,
675
+ )
654
676
 
655
- ### Tools
677
+ response.process()
656
678
 
657
- Agents gain significant utility through tools as they provide access to external data, APIs, and functionality.
679
+ logger.info("Final output:\n%s", response.summary)
680
+ ```
681
+
682
+ ---
683
+
684
+ ### Tools
658
685
 
659
- Note: Before running this code, make sure to set your `OPENAI_API_KEY` as an environment variable. This example uses `gpt-4o-mini`, but you can replace it with any other [model](https://docs.ag2.ai/latest/docs/user-guide/models/amazon-bedrock) supported by AG2.
686
+ Agents gain significant utility through **tools**, which extend their capabilities with external data, APIs, or functions.
660
687
 
661
688
  ```python
689
+ import logging
662
690
  from datetime import datetime
663
691
  from typing import Annotated
664
-
665
692
  from autogen import ConversableAgent, register_function, LLMConfig
666
693
 
667
- # Put your key in the OPENAI_API_KEY environment variable
668
- llm_config = LLMConfig(api_type="openai", model="gpt-4o-mini")
694
+ logging.basicConfig(level=logging.INFO)
695
+ logger = logging.getLogger(__name__)
696
+
697
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
669
698
 
670
- # 1. Our tool, returns the day of the week for a given date
699
+ # Tool: returns weekday for a given date
671
700
  def get_weekday(date_string: Annotated[str, "Format: YYYY-MM-DD"]) -> str:
672
701
  date = datetime.strptime(date_string, "%Y-%m-%d")
673
702
  return date.strftime("%A")
674
703
 
675
- # 2. Agent for determining whether to run the tool
676
- with llm_config:
677
- date_agent = ConversableAgent(
678
- name="date_agent",
679
- system_message="You get the day of the week for a given date.",
680
- )
704
+ date_agent = ConversableAgent(
705
+ name="date_agent",
706
+ system_message="You find the day of the week for a given date.",
707
+ llm_config=llm_config,
708
+ )
681
709
 
682
- # 3. And an agent for executing the tool
683
710
  executor_agent = ConversableAgent(
684
711
  name="executor_agent",
685
712
  human_input_mode="NEVER",
713
+ llm_config=llm_config,
686
714
  )
687
715
 
688
- # 4. Registers the tool with the agents, the description will be used by the LLM
716
+ # Register tool
689
717
  register_function(
690
718
  get_weekday,
691
719
  caller=date_agent,
@@ -693,14 +721,14 @@ register_function(
693
721
  description="Get the day of the week for a given date",
694
722
  )
695
723
 
696
- # 5. Two-way chat ensures the executor agent follows the suggesting agent
724
+ # Use tool in chat
697
725
  chat_result = executor_agent.initiate_chat(
698
726
  recipient=date_agent,
699
- message="I was born on the 25th of March 1995, what day was it?",
727
+ message="I was born on 1995-03-25, what day was it?",
700
728
  max_turns=2,
701
729
  )
702
730
 
703
- print(chat_result.chat_history[-1]["content"])
731
+ logger.info("Final output:\n%s", chat_result.chat_history[-1]["content"])
704
732
  ```
705
733
 
706
734
  ### Advanced agentic design patterns
@@ -712,6 +740,7 @@ AG2 supports more advanced concepts to help you build your AI agent workflows. Y
712
740
  - [Retrieval Augmented Generation (RAG)](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/rag/)
713
741
  - [Code Execution](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/code-execution)
714
742
  - [Tools with Secrets](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/tools/tools-with-secrets/)
743
+ - [Pattern Cookbook (9 group orchestrations)](https://docs.ag2.ai/latest/docs/user-guide/advanced-concepts/pattern-cookbook/overview/)
715
744
 
716
745
  ## Announcements
717
746
 
@@ -729,12 +758,6 @@ We adopt the Apache 2.0 license from v0.3. This enhances our commitment to open-
729
758
 
730
759
  [More Announcements](announcements.md)
731
760
 
732
- ## Contributors Wall
733
-
734
- <a href="https://github.com/ag2ai/ag2/graphs/contributors">
735
- <img src="https://contrib.rocks/image?repo=ag2ai/ag2&max=204" />
736
- </a>
737
-
738
761
  ## Code style and linting
739
762
 
740
763
  This project uses pre-commit hooks to maintain code quality. Before contributing:
@@ -764,6 +787,12 @@ pre-commit run --all-files
764
787
 
765
788
  - [StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows](https://arxiv.org/abs/2403.11322)
766
789
 
790
+ ## Contributors Wall
791
+
792
+ <a href="https://github.com/ag2ai/ag2/graphs/contributors">
793
+ <img src="https://contrib.rocks/image?repo=ag2ai/ag2&max=204" />
794
+ </a>
795
+
767
796
  ## Cite the project
768
797
 
769
798
  ```