ag2 0.8.2rc0__tar.gz → 0.8.4__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ag2
3
- Version: 0.8.2rc0
3
+ Version: 0.8.4
4
4
  Summary: Alias package for pyautogen
5
5
  Home-page: https://github.com/ag2ai/ag2
6
6
  Author: Chi Wang & Qingyun Wu
@@ -161,13 +161,13 @@ You can use the sample file `OAI_CONFIG_LIST_sample` as a template.
161
161
  Create a script or a Jupyter Notebook and run your first agent.
162
162
 
163
163
  ```python
164
- from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
164
+ from autogen import AssistantAgent, UserProxyAgent, LLMConfig
165
+
166
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
165
167
 
166
- llm_config = {
167
- "config_list": config_list_from_json(env_or_file="OAI_CONFIG_LIST")
168
- }
169
168
 
170
- assistant = AssistantAgent("assistant", llm_config=llm_config)
169
+ with llm_config:
170
+ assistant = AssistantAgent("assistant")
171
171
  user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
172
172
  user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
173
173
  # This initiates an automated chat between the two agents to solve the task
@@ -198,19 +198,18 @@ It serves as a base class for all agents in AG2.
198
198
  ```python
199
199
  from autogen import ConversableAgent
200
200
 
201
- # Create an AI agent
202
- assistant = ConversableAgent(
203
- name="assistant",
204
- system_message="You are an assistant that responds concisely.",
205
- llm_config=llm_config
206
- )
201
+ with llm_config:
202
+ # Create an AI agent
203
+ assistant = ConversableAgent(
204
+ name="assistant",
205
+ system_message="You are an assistant that responds concisely.",
206
+ )
207
207
 
208
- # Create another AI agent
209
- fact_checker = ConversableAgent(
210
- name="fact_checker",
211
- system_message="You are a fact-checking assistant.",
212
- llm_config=llm_config
213
- )
208
+ # Create another AI agent
209
+ fact_checker = ConversableAgent(
210
+ name="fact_checker",
211
+ system_message="You are a fact-checking assistant.",
212
+ )
214
213
 
215
214
  # Start the conversation
216
215
  assistant.initiate_chat(
@@ -234,11 +233,11 @@ We created a class which sets the `human_input_mode` to `ALWAYS` for you. Its ca
234
233
  from autogen import ConversableAgent
235
234
 
236
235
  # Create an AI agent
237
- assistant = ConversableAgent(
238
- name="assistant",
239
- system_message="You are a helpful assistant.",
240
- llm_config=llm_config
241
- )
236
+ with llm_config:
237
+ assistant = ConversableAgent(
238
+ name="assistant",
239
+ system_message="You are a helpful assistant.",
240
+ )
242
241
 
243
242
  # Create a human agent with manual input mode
244
243
  human = ConversableAgent(
@@ -304,11 +303,11 @@ def get_weekday(date_string: Annotated[str, "Format: YYYY-MM-DD"]) -> str:
304
303
  return date.strftime("%A")
305
304
 
306
305
  # 2. Agent for determining whether to run the tool
307
- date_agent = ConversableAgent(
308
- name="date_agent",
309
- system_message="You get the day of the week for a given date.",
310
- llm_config=llm_config,
311
- )
306
+ with llm_config:
307
+ date_agent = ConversableAgent(
308
+ name="date_agent",
309
+ system_message="You get the day of the week for a given date.",
310
+ )
312
311
 
313
312
  # 3. And an agent for executing the tool
314
313
  executor_agent = ConversableAgent(
@@ -93,13 +93,13 @@ You can use the sample file `OAI_CONFIG_LIST_sample` as a template.
93
93
  Create a script or a Jupyter Notebook and run your first agent.
94
94
 
95
95
  ```python
96
- from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
96
+ from autogen import AssistantAgent, UserProxyAgent, LLMConfig
97
+
98
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
97
99
 
98
- llm_config = {
99
- "config_list": config_list_from_json(env_or_file="OAI_CONFIG_LIST")
100
- }
101
100
 
102
- assistant = AssistantAgent("assistant", llm_config=llm_config)
101
+ with llm_config:
102
+ assistant = AssistantAgent("assistant")
103
103
  user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
104
104
  user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
105
105
  # This initiates an automated chat between the two agents to solve the task
@@ -130,19 +130,18 @@ It serves as a base class for all agents in AG2.
130
130
  ```python
131
131
  from autogen import ConversableAgent
132
132
 
133
- # Create an AI agent
134
- assistant = ConversableAgent(
135
- name="assistant",
136
- system_message="You are an assistant that responds concisely.",
137
- llm_config=llm_config
138
- )
133
+ with llm_config:
134
+ # Create an AI agent
135
+ assistant = ConversableAgent(
136
+ name="assistant",
137
+ system_message="You are an assistant that responds concisely.",
138
+ )
139
139
 
140
- # Create another AI agent
141
- fact_checker = ConversableAgent(
142
- name="fact_checker",
143
- system_message="You are a fact-checking assistant.",
144
- llm_config=llm_config
145
- )
140
+ # Create another AI agent
141
+ fact_checker = ConversableAgent(
142
+ name="fact_checker",
143
+ system_message="You are a fact-checking assistant.",
144
+ )
146
145
 
147
146
  # Start the conversation
148
147
  assistant.initiate_chat(
@@ -166,11 +165,11 @@ We created a class which sets the `human_input_mode` to `ALWAYS` for you. Its ca
166
165
  from autogen import ConversableAgent
167
166
 
168
167
  # Create an AI agent
169
- assistant = ConversableAgent(
170
- name="assistant",
171
- system_message="You are a helpful assistant.",
172
- llm_config=llm_config
173
- )
168
+ with llm_config:
169
+ assistant = ConversableAgent(
170
+ name="assistant",
171
+ system_message="You are a helpful assistant.",
172
+ )
174
173
 
175
174
  # Create a human agent with manual input mode
176
175
  human = ConversableAgent(
@@ -236,11 +235,11 @@ def get_weekday(date_string: Annotated[str, "Format: YYYY-MM-DD"]) -> str:
236
235
  return date.strftime("%A")
237
236
 
238
237
  # 2. Agent for determining whether to run the tool
239
- date_agent = ConversableAgent(
240
- name="date_agent",
241
- system_message="You get the day of the week for a given date.",
242
- llm_config=llm_config,
243
- )
238
+ with llm_config:
239
+ date_agent = ConversableAgent(
240
+ name="date_agent",
241
+ system_message="You get the day of the week for a given date.",
242
+ )
244
243
 
245
244
  # 3. And an agent for executing the tool
246
245
  executor_agent = ConversableAgent(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ag2
3
- Version: 0.8.2rc0
3
+ Version: 0.8.4
4
4
  Summary: Alias package for pyautogen
5
5
  Home-page: https://github.com/ag2ai/ag2
6
6
  Author: Chi Wang & Qingyun Wu
@@ -161,13 +161,13 @@ You can use the sample file `OAI_CONFIG_LIST_sample` as a template.
161
161
  Create a script or a Jupyter Notebook and run your first agent.
162
162
 
163
163
  ```python
164
- from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
164
+ from autogen import AssistantAgent, UserProxyAgent, LLMConfig
165
+
166
+ llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
165
167
 
166
- llm_config = {
167
- "config_list": config_list_from_json(env_or_file="OAI_CONFIG_LIST")
168
- }
169
168
 
170
- assistant = AssistantAgent("assistant", llm_config=llm_config)
169
+ with llm_config:
170
+ assistant = AssistantAgent("assistant")
171
171
  user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
172
172
  user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
173
173
  # This initiates an automated chat between the two agents to solve the task
@@ -198,19 +198,18 @@ It serves as a base class for all agents in AG2.
198
198
  ```python
199
199
  from autogen import ConversableAgent
200
200
 
201
- # Create an AI agent
202
- assistant = ConversableAgent(
203
- name="assistant",
204
- system_message="You are an assistant that responds concisely.",
205
- llm_config=llm_config
206
- )
201
+ with llm_config:
202
+ # Create an AI agent
203
+ assistant = ConversableAgent(
204
+ name="assistant",
205
+ system_message="You are an assistant that responds concisely.",
206
+ )
207
207
 
208
- # Create another AI agent
209
- fact_checker = ConversableAgent(
210
- name="fact_checker",
211
- system_message="You are a fact-checking assistant.",
212
- llm_config=llm_config
213
- )
208
+ # Create another AI agent
209
+ fact_checker = ConversableAgent(
210
+ name="fact_checker",
211
+ system_message="You are a fact-checking assistant.",
212
+ )
214
213
 
215
214
  # Start the conversation
216
215
  assistant.initiate_chat(
@@ -234,11 +233,11 @@ We created a class which sets the `human_input_mode` to `ALWAYS` for you. Its ca
234
233
  from autogen import ConversableAgent
235
234
 
236
235
  # Create an AI agent
237
- assistant = ConversableAgent(
238
- name="assistant",
239
- system_message="You are a helpful assistant.",
240
- llm_config=llm_config
241
- )
236
+ with llm_config:
237
+ assistant = ConversableAgent(
238
+ name="assistant",
239
+ system_message="You are a helpful assistant.",
240
+ )
242
241
 
243
242
  # Create a human agent with manual input mode
244
243
  human = ConversableAgent(
@@ -304,11 +303,11 @@ def get_weekday(date_string: Annotated[str, "Format: YYYY-MM-DD"]) -> str:
304
303
  return date.strftime("%A")
305
304
 
306
305
  # 2. Agent for determining whether to run the tool
307
- date_agent = ConversableAgent(
308
- name="date_agent",
309
- system_message="You get the day of the week for a given date.",
310
- llm_config=llm_config,
311
- )
306
+ with llm_config:
307
+ date_agent = ConversableAgent(
308
+ name="date_agent",
309
+ system_message="You get the day of the week for a given date.",
310
+ )
312
311
 
313
312
  # 3. And an agent for executing the tool
314
313
  executor_agent = ConversableAgent(
@@ -14,6 +14,8 @@ test/test_conftest.py
14
14
  test/test_graph_utils.py
15
15
  test/test_import.py
16
16
  test/test_import_utils.py
17
+ test/test_json_utils.py
18
+ test/test_llm_config.py
17
19
  test/test_logging.py
18
20
  test/test_notebook.py
19
21
  test/test_retrieve_utils.py
@@ -0,0 +1,154 @@
1
+ pyautogen==0.8.4
2
+
3
+ [anthropic]
4
+ pyautogen[anthropic]==0.8.4
5
+
6
+ [autobuild]
7
+ pyautogen[autobuild]==0.8.4
8
+
9
+ [bedrock]
10
+ pyautogen[bedrock]==0.8.4
11
+
12
+ [blendsearch]
13
+ pyautogen[blendsearch]==0.8.4
14
+
15
+ [browser-use]
16
+ pyautogen[browser-use]==0.8.4
17
+
18
+ [captainagent]
19
+ pyautogen[captainagent]==0.8.4
20
+
21
+ [cerebras]
22
+ pyautogen[cerebras]==0.8.4
23
+
24
+ [cohere]
25
+ pyautogen[cohere]==0.8.4
26
+
27
+ [commsagent-discord]
28
+ pyautogen[commsagent-discord]==0.8.4
29
+
30
+ [commsagent-slack]
31
+ pyautogen[commsagent-slack]==0.8.4
32
+
33
+ [commsagent-telegram]
34
+ pyautogen[commsagent-telegram]==0.8.4
35
+
36
+ [cosmosdb]
37
+ pyautogen[cosmosdb]==0.8.4
38
+
39
+ [crawl4ai]
40
+ pyautogen[crawl4ai]==0.8.4
41
+
42
+ [deepseek]
43
+ pyautogen[deepseek]==0.8.4
44
+
45
+ [dev]
46
+ pyautogen[dev]==0.8.4
47
+
48
+ [docs]
49
+ pyautogen[docs]==0.8.4
50
+
51
+ [flaml]
52
+ pyautogen[flaml]==0.8.4
53
+
54
+ [gemini]
55
+ pyautogen[gemini]==0.8.4
56
+
57
+ [gemini-realtime]
58
+ pyautogen[gemini-realtime]==0.8.4
59
+
60
+ [google-search]
61
+ pyautogen[google-search]==0.8.4
62
+
63
+ [graph]
64
+ pyautogen[graph]==0.8.4
65
+
66
+ [graph-rag-falkor-db]
67
+ pyautogen[graph-rag-falkor-db]==0.8.4
68
+
69
+ [groq]
70
+ pyautogen[groq]==0.8.4
71
+
72
+ [interop]
73
+ pyautogen[interop]==0.8.4
74
+
75
+ [interop-crewai]
76
+ pyautogen[interop-crewai]==0.8.4
77
+
78
+ [interop-langchain]
79
+ pyautogen[interop-langchain]==0.8.4
80
+
81
+ [interop-pydantic-ai]
82
+ pyautogen[interop-pydantic-ai]==0.8.4
83
+
84
+ [jupyter-executor]
85
+ pyautogen[jupyter-executor]==0.8.4
86
+
87
+ [lint]
88
+ pyautogen[lint]==0.8.4
89
+
90
+ [lmm]
91
+ pyautogen[lmm]==0.8.4
92
+
93
+ [long-context]
94
+ pyautogen[long-context]==0.8.4
95
+
96
+ [mathchat]
97
+ pyautogen[mathchat]==0.8.4
98
+
99
+ [mistral]
100
+ pyautogen[mistral]==0.8.4
101
+
102
+ [neo4j]
103
+ pyautogen[neo4j]==0.8.4
104
+
105
+ [ollama]
106
+ pyautogen[ollama]==0.8.4
107
+
108
+ [openai]
109
+ pyautogen[openai]==0.8.4
110
+
111
+ [openai-realtime]
112
+ pyautogen[openai-realtime]==0.8.4
113
+
114
+ [rag]
115
+ pyautogen[rag]==0.8.4
116
+
117
+ [redis]
118
+ pyautogen[redis]==0.8.4
119
+
120
+ [retrievechat]
121
+ pyautogen[retrievechat]==0.8.4
122
+
123
+ [retrievechat-couchbase]
124
+ pyautogen[retrievechat-couchbase]==0.8.4
125
+
126
+ [retrievechat-mongodb]
127
+ pyautogen[retrievechat-mongodb]==0.8.4
128
+
129
+ [retrievechat-pgvector]
130
+ pyautogen[retrievechat-pgvector]==0.8.4
131
+
132
+ [retrievechat-qdrant]
133
+ pyautogen[retrievechat-qdrant]==0.8.4
134
+
135
+ [teachable]
136
+ pyautogen[teachable]==0.8.4
137
+
138
+ [test]
139
+ pyautogen[test]==0.8.4
140
+
141
+ [together]
142
+ pyautogen[together]==0.8.4
143
+
144
+ [twilio]
145
+ pyautogen[twilio]==0.8.4
146
+
147
+ [types]
148
+ pyautogen[types]==0.8.4
149
+
150
+ [websockets]
151
+ pyautogen[websockets]==0.8.4
152
+
153
+ [websurfer]
154
+ pyautogen[websurfer]==0.8.4
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [metadata]
6
6
  license_file = "LICENSE"
7
- description-file = "README.md"
7
+ description_file = "README.md"
8
8
 
9
9
  [project]
10
10
  name = "pyautogen"
@@ -163,9 +163,8 @@ google-search = [
163
163
 
164
164
  neo4j = [
165
165
  "docx2txt==0.8",
166
- "llama-index==0.12.22",
166
+ "llama-index>=0.12,<1",
167
167
  "llama-index-graph-stores-neo4j==0.4.6",
168
- "llama-index-core==0.12.22",
169
168
  "llama-index-readers-web==0.3.7",
170
169
  ]
171
170
 
@@ -201,7 +200,6 @@ gemini = [
201
200
  "google-auth",
202
201
  "pillow",
203
202
  "jsonschema",
204
- "jsonref>=1,<2",
205
203
  ]
206
204
 
207
205
  gemini-realtime = [
@@ -220,7 +218,7 @@ cerebras = ["cerebras_cloud_sdk>=1.0.0"]
220
218
  mistral = ["mistralai>=1.0.1"]
221
219
  groq = ["groq>=0.9.0"]
222
220
  cohere = ["cohere>=5.13.5"]
223
- ollama = ["ollama>=0.4.5", "fix_busted_json>=0.0.18"]
221
+ ollama = ["ollama>=0.4.7", "fix_busted_json>=0.0.18"]
224
222
  bedrock = ["boto3>=1.34.149"]
225
223
  deepseek = ["pyautogen[openai]"]
226
224
 
@@ -238,17 +236,18 @@ test = [
238
236
  "pytest-cov==6.0.0",
239
237
  "pytest-asyncio==0.25.3",
240
238
  "pytest==8.3.5",
241
- "mock==5.1.0",
239
+ "mock==5.2.0",
242
240
  "pandas==2.2.3",
243
241
  "fastapi==0.115.11",
244
242
  "dirty-equals==0.9.0",
245
243
  ]
246
244
 
247
245
  docs = [
248
- "mkdocs-material==9.6.7",
249
- "mkdocstrings[python]==0.28.2",
246
+ "mkdocs-material==9.6.9",
247
+ "mkdocstrings[python]==0.29.0",
250
248
  "mkdocs-literate-nav==0.6.1",
251
249
  "mdx-include==1.4.2",
250
+ # currently problematic and cannot be upgraded
252
251
  "mkdocs-git-revision-date-localized-plugin==1.3.0",
253
252
  "mike==2.1.3",
254
253
  "typer==0.15.2",
@@ -259,7 +258,7 @@ docs = [
259
258
  "pillow", # required for mkdocs-glightbo
260
259
  "cairosvg", # required for mkdocs-glightbo
261
260
  "pdoc3==0.11.5",
262
- "jinja2==3.1.5",
261
+ "jinja2==3.1.6",
263
262
  "pyyaml==6.0.2",
264
263
  "termcolor==2.5.0",
265
264
  "nbclient==0.10.2",
@@ -281,7 +280,7 @@ dev = [
281
280
  "pyautogen[lint,test,types,docs]",
282
281
  "pre-commit==4.1.0",
283
282
  "detect-secrets==1.5.0",
284
- "uv==0.6.4",
283
+ "uv==0.6.6",
285
284
  ]
286
285
 
287
286
 
@@ -436,6 +435,7 @@ convention = "google"
436
435
  [tool.mypy]
437
436
  files = [
438
437
  "autogen/agentchat/agent.py",
438
+ # "autogen/agentchat/cenversable_agent.py",
439
439
  "autogen/agentchat/contrib/rag",
440
440
  "autogen/agentchat/contrib/graph_rag",
441
441
  "autogen/agentchat/contrib/swarm_agent.py",
@@ -448,8 +448,11 @@ files = [
448
448
  "autogen/import_utils.py",
449
449
  "autogen/interop",
450
450
  "autogen/io",
451
+ "autogen/json_utils.py",
452
+ "autogen/llm_config.py",
451
453
  "autogen/logger",
452
454
  "autogen/messages",
455
+ "autogen/oai/gemini_types.py",
453
456
  "autogen/oai/oai_models",
454
457
  "autogen/oai/openai_utils.py",
455
458
  "autogen/tools",
@@ -464,12 +467,15 @@ files = [
464
467
  # "test/fast_depends",
465
468
  "test/interop",
466
469
  "test/io",
470
+ "test/oai/test_oai_models.py",
471
+ "test/oai/test_gemini_types.py",
472
+ "test/test_json_utils.py",
473
+ "test/test_llm_config.py",
467
474
  "test/messages",
468
475
  "test/test_import_utils.py",
469
476
  "test/test_import.py",
470
477
  "test/tools",
471
478
  "test/website",
472
- "test/oai/test_oai_models.py",
473
479
  ]
474
480
 
475
481
  exclude = [
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2023 - 2025, AG2ai, Inc., AG2ai open-source projects maintainers and core contributors
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ import pytest
6
+ from jsonschema.exceptions import _RefResolutionError
7
+
8
+ from autogen.json_utils import resolve_json_references # Replace 'your_module' with the actual module name
9
+
10
+
11
+ def test_resolve_json_references_no_refs() -> None:
12
+ schema = {"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}}
13
+ resolved_schema = resolve_json_references(schema)
14
+ assert resolved_schema == schema
15
+
16
+
17
+ def test_resolve_json_references_with_refs() -> None:
18
+ schema = {
19
+ "type": "object",
20
+ "properties": {"name": {"type": "string"}, "address": {"$ref": "#/definitions/address"}},
21
+ "definitions": {
22
+ "address": {"type": "object", "properties": {"street": {"type": "string"}, "city": {"type": "string"}}}
23
+ },
24
+ }
25
+ expected_resolved_schema = {
26
+ "type": "object",
27
+ "properties": {
28
+ "name": {"type": "string"},
29
+ "address": {"type": "object", "properties": {"street": {"type": "string"}, "city": {"type": "string"}}},
30
+ },
31
+ "definitions": {
32
+ "address": {"type": "object", "properties": {"street": {"type": "string"}, "city": {"type": "string"}}}
33
+ },
34
+ }
35
+ resolved_schema = resolve_json_references(schema)
36
+ assert resolved_schema == expected_resolved_schema
37
+
38
+
39
+ def test_resolve_json_references_invalid_ref() -> None:
40
+ schema = {
41
+ "type": "object",
42
+ "properties": {"name": {"type": "string"}, "address": {"$ref": "#/definitions/non_existent"}},
43
+ "definitions": {
44
+ "address": {"type": "object", "properties": {"street": {"type": "string"}, "city": {"type": "string"}}}
45
+ },
46
+ }
47
+ with pytest.raises(_RefResolutionError, match="Unresolvable JSON pointer: 'definitions/non_existent'"):
48
+ resolve_json_references(schema)