ag2 0.7.4b1__tar.gz → 0.7.5__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.

ag2-0.7.5/PKG-INFO ADDED
@@ -0,0 +1,416 @@
1
+ Metadata-Version: 2.1
2
+ Name: ag2
3
+ Version: 0.7.5
4
+ Summary: Alias package for pyautogen
5
+ Home-page: https://github.com/ag2ai/ag2
6
+ Author: Chi Wang & Qingyun Wu
7
+ Author-email: support@ag2.ai
8
+ License: Apache Software License 2.0
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.9,<3.14
14
+ Description-Content-Type: text/markdown
15
+ Provides-Extra: flaml
16
+ Provides-Extra: jupyter-executor
17
+ Provides-Extra: retrievechat
18
+ Provides-Extra: retrievechat-pgvector
19
+ Provides-Extra: retrievechat-mongodb
20
+ Provides-Extra: retrievechat-qdrant
21
+ Provides-Extra: retrievechat-couchbase
22
+ Provides-Extra: graph-rag-falkor-db
23
+ Provides-Extra: rag
24
+ Provides-Extra: crawl4ai
25
+ Provides-Extra: browser-use
26
+ Provides-Extra: neo4j
27
+ Provides-Extra: twilio
28
+ Provides-Extra: interop-crewai
29
+ Provides-Extra: interop-langchain
30
+ Provides-Extra: interop-pydantic-ai
31
+ Provides-Extra: interop
32
+ Provides-Extra: autobuild
33
+ Provides-Extra: blendsearch
34
+ Provides-Extra: mathchat
35
+ Provides-Extra: captainagent
36
+ Provides-Extra: teachable
37
+ Provides-Extra: lmm
38
+ Provides-Extra: graph
39
+ Provides-Extra: gemini
40
+ Provides-Extra: together
41
+ Provides-Extra: websurfer
42
+ Provides-Extra: redis
43
+ Provides-Extra: cosmosdb
44
+ Provides-Extra: websockets
45
+ Provides-Extra: long-context
46
+ Provides-Extra: anthropic
47
+ Provides-Extra: cerebras
48
+ Provides-Extra: mistral
49
+ Provides-Extra: groq
50
+ Provides-Extra: cohere
51
+ Provides-Extra: ollama
52
+ Provides-Extra: bedrock
53
+ Provides-Extra: commsagent-discord
54
+ Provides-Extra: commsagent-slack
55
+ Provides-Extra: commsagent-telegram
56
+ Provides-Extra: test
57
+ Provides-Extra: docs
58
+ Provides-Extra: types
59
+ Provides-Extra: lint
60
+ Provides-Extra: dev
61
+ License-File: LICENSE
62
+ License-File: NOTICE.md
63
+
64
+ <a name="readme-top"></a>
65
+
66
+ <p align="center">
67
+ <!-- The image URL points to the GitHub-hosted content, ensuring it displays correctly on the PyPI website.-->
68
+ <img src="https://raw.githubusercontent.com/ag2ai/ag2/27b37494a6f72b1f8050f6bd7be9a7ff232cf749/website/static/img/ag2.svg" width="150" title="hover text">
69
+ <br>
70
+ <br>
71
+ <img src="https://img.shields.io/pypi/dm/pyautogen?label=PyPI%20downloads">
72
+ <a href="https://badge.fury.io/py/autogen"><img src="https://badge.fury.io/py/autogen.svg"></a>
73
+ <a href="https://github.com/ag2ai/ag2/actions/workflows/python-package.yml">
74
+ <img src="https://github.com/ag2ai/ag2/actions/workflows/python-package.yml/badge.svg">
75
+ </a>
76
+ <img src="https://img.shields.io/badge/3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue">
77
+ <a href="https://discord.gg/pAbnFJrkgZ">
78
+ <img src="https://img.shields.io/discord/1153072414184452236?logo=discord&style=flat">
79
+ </a>
80
+ <a href="https://x.com/ag2oss">
81
+ <img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40ag2ai">
82
+ </a>
83
+ </p>
84
+
85
+ <p align="center">
86
+ <a href="https://docs.ag2.ai/">📚 Documentation</a> |
87
+ <a href="https://github.com/ag2ai/build-with-ag2">💡 Examples</a> |
88
+ <a href="https://docs.ag2.ai/docs/contributor-guide/contributing">🤝 Contributing</a> |
89
+ <a href="#related-papers">📝 Cite paper</a> |
90
+ <a href="https://discord.gg/pAbnFJrkgZ">💬 Join Discord</a>
91
+ </p>
92
+
93
+ <p align="center">
94
+ AG2 was evolved from AutoGen. Fully open-sourced. We invite collaborators from all organizations to contribute.
95
+ </p>
96
+
97
+ # AG2: Open-Source AgentOS for AI Agents
98
+
99
+ AG2 (formerly AutoGen) is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AG2 aims to streamline the development and research of agentic AI. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.
100
+
101
+ The project is currently maintained by a [dynamic group of volunteers](MAINTAINERS.md) from several organizations. Contact project administrators Chi Wang and Qingyun Wu via [support@ag2.ai](mailto:support@ag2.ai) if you are interested in becoming a maintainer.
102
+
103
+ ## Table of contents
104
+
105
+ - [AG2: Open-Source AgentOS for AI Agents](#ag2-open-source-agentos-for-ai-agents)
106
+ - [Table of contents](#table-of-contents)
107
+ - [Getting started](#getting-started)
108
+ - [Installation](#installation)
109
+ - [Setup your API keys](#setup-your-api-keys)
110
+ - [Run your first agent](#run-your-first-agent)
111
+ - [Example applications](#example-applications)
112
+ - [Introduction of different agent concepts](#introduction-of-different-agent-concepts)
113
+ - [Conversable agent](#conversable-agent)
114
+ - [Human in the loop](#human-in-the-loop)
115
+ - [Orchestrating multiple agents](#orchestrating-multiple-agents)
116
+ - [Tools](#tools)
117
+ - [Advanced agentic design patterns](#advanced-agentic-design-patterns)
118
+ - [Announcements](#announcements)
119
+ - [Contributors Wall](#contributors-wall)
120
+ - [Code style and linting](#code-style-and-linting)
121
+ - [Related papers](#related-papers)
122
+ - [Cite the project](#cite-the-project)
123
+ - [License](#license)
124
+
125
+ ## Getting started
126
+
127
+ For a step-by-step walk through of AG2 concepts and code, see [Basic Concepts](https://docs.ag2.ai/docs/user-guide/basic-concepts) in our documentation.
128
+
129
+ ### Installation
130
+
131
+ AG2 requires **Python version >= 3.9, < 3.14**. AG2 is available via `ag2` (or its alias `pyautogen` or `autogen`) on PyPI.
132
+
133
+ ```bash
134
+ pip install ag2
135
+ ```
136
+
137
+ Minimal dependencies are installed by default. You can install extra options based on the features you need.
138
+
139
+ ### Setup your API keys
140
+
141
+ To keep your LLM dependencies neat we recommend using the `OAI_CONFIG_LIST` file to store your API keys.
142
+
143
+ You can use the sample file `OAI_CONFIG_LIST_sample` as a template.
144
+
145
+ ```json
146
+ [
147
+ {
148
+ "model": "gpt-4o",
149
+ "api_key": "<your OpenAI API key here>"
150
+ }
151
+ ]
152
+ ```
153
+
154
+ ### Run your first agent
155
+
156
+ Create a script or a Jupyter Notebook and run your first agent.
157
+
158
+ ```python
159
+ from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
160
+
161
+ llm_config = {
162
+ "config_list": config_list_from_json(env_or_file="OAI_CONFIG_LIST")
163
+ }
164
+
165
+ assistant = AssistantAgent("assistant", llm_config=llm_config)
166
+ user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False})
167
+ user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")
168
+ # This initiates an automated chat between the two agents to solve the task
169
+ ```
170
+
171
+ ## Example applications
172
+
173
+ We maintain a dedicated repository with a wide range of applications to help you get started with various use cases or check out our collection of jupyter notebooks as a starting point.
174
+
175
+ - [Build with AG2](https://github.com/ag2ai/build-with-ag2)
176
+ - [Jupyter Notebooks](notebook)
177
+
178
+ ## Introduction of different agent concepts
179
+
180
+ We have several agent concepts in AG2 to help you build your AI agents. We introduce the most common ones here.
181
+
182
+ - **Conversable Agent**: Agents that are able to send messages, receive messages and generate replies using GenAI models, non-GenAI tools, or human inputs.
183
+ - **Human in the loop**: Add human input to the conversation
184
+ - **Orchestrating multiple agents**: Users can orchestrate multiple agents with built-in conversation patterns such as swarms, group chats, nested chats, sequential chats or customize the orchestration by registering custom reply methods.
185
+ - **Tools**: Programs that can be registered, invoked and executed by agents
186
+ - **Advanced Concepts**: AG2 supports more concepts such as structured outputs, rag, code execution, etc.
187
+
188
+ ### Conversable agent
189
+
190
+ The conversable agent is the most used agent and is created for generating conversations among agents.
191
+ It serves as a base class for all agents in AG2.
192
+
193
+ ```python
194
+ from autogen import ConversableAgent
195
+
196
+ # Create an AI agent
197
+ assistant = ConversableAgent(
198
+ name="assistant",
199
+ system_message="You are an assistant that responds concisely.",
200
+ llm_config=llm_config
201
+ )
202
+
203
+ # Create another AI agent
204
+ fact_checker = ConversableAgent(
205
+ name="fact_checker",
206
+ system_message="You are a fact-checking assistant.",
207
+ llm_config=llm_config
208
+ )
209
+
210
+ # Start the conversation
211
+ assistant.initiate_chat(
212
+ recipient=fact_checker,
213
+ message="What is AG2?",
214
+ max_turns=2
215
+ )
216
+ ```
217
+
218
+ ### Human in the loop
219
+
220
+ Sometimes your wished workflow requires human input. Therefore you can enable the human in the loop feature.
221
+
222
+ If you set `human_input_mode` to `ALWAYS` on ConversableAgent you can give human input to the conversation.
223
+
224
+ There are three modes for `human_input_mode`: `ALWAYS`, `NEVER`, `TERMINATE`.
225
+
226
+ We created a class which sets the `human_input_mode` to `ALWAYS` for you. Its called `UserProxyAgent`.
227
+
228
+ ```python
229
+ from autogen import ConversableAgent
230
+
231
+ # Create an AI agent
232
+ assistant = ConversableAgent(
233
+ name="assistant",
234
+ system_message="You are a helpful assistant.",
235
+ llm_config=llm_config
236
+ )
237
+
238
+ # Create a human agent with manual input mode
239
+ human = ConversableAgent(
240
+ name="human",
241
+ human_input_mode="ALWAYS"
242
+ )
243
+ # or
244
+ human = UserProxyAgent(name="human", code_execution_config={"work_dir": "coding", "use_docker": False})
245
+
246
+ # Start the chat
247
+ human.initiate_chat(
248
+ recipient=assistant,
249
+ message="Hello! What's 2 + 2?"
250
+ )
251
+
252
+ ```
253
+
254
+ ### Orchestrating multiple agents
255
+
256
+ Users can define their own orchestration patterns using the flexible programming interface from AG2.
257
+
258
+ Additionally AG2 provides multiple built-in patterns to orchestrate multiple agents, such as `GroupChat` and `Swarm`.
259
+
260
+ Both concepts are used to orchestrate multiple agents to solve a task.
261
+
262
+ The group chat works like a chat where each registered agent can participate in the conversation.
263
+
264
+ ```python
265
+ from autogen import ConversableAgent, GroupChat, GroupChatManager
266
+
267
+ # Create AI agents
268
+ teacher = ConversableAgent(name="teacher", system_message="You suggest lesson topics.")
269
+ planner = ConversableAgent(name="planner", system_message="You create lesson plans.")
270
+ reviewer = ConversableAgent(name="reviewer", system_message="You review lesson plans.")
271
+
272
+ # Create GroupChat
273
+ groupchat = GroupChat(agents=[teacher, planner, reviewer], speaker_selection_method="auto")
274
+
275
+ # Create the GroupChatManager, it will manage the conversation and uses an LLM to select the next agent
276
+ manager = GroupChatManager(name="manager", groupchat=groupchat)
277
+
278
+ # Start the conversation
279
+ teacher.initiate_chat(manager, "Create a lesson on photosynthesis.")
280
+ ```
281
+
282
+ The swarm requires a more rigid structure and the flow needs to be defined with hand-off, post-tool, and post-work transitions from an agent to another agent.
283
+
284
+ Read more about it in the [documentation](https://docs.ag2.ai/docs/user-guide/advanced-concepts/conversation-patterns-deep-dive)
285
+
286
+ ### Tools
287
+
288
+ Agents gain significant utility through tools as they provide access to external data, APIs, and functionality.
289
+
290
+ ```python
291
+ from datetime import datetime
292
+ from typing import Annotated
293
+
294
+ from autogen import ConversableAgent, register_function
295
+
296
+ # 1. Our tool, returns the day of the week for a given date
297
+ def get_weekday(date_string: Annotated[str, "Format: YYYY-MM-DD"]) -> str:
298
+ date = datetime.strptime(date_string, "%Y-%m-%d")
299
+ return date.strftime("%A")
300
+
301
+ # 2. Agent for determining whether to run the tool
302
+ date_agent = ConversableAgent(
303
+ name="date_agent",
304
+ system_message="You get the day of the week for a given date.",
305
+ llm_config=llm_config,
306
+ )
307
+
308
+ # 3. And an agent for executing the tool
309
+ executor_agent = ConversableAgent(
310
+ name="executor_agent",
311
+ human_input_mode="NEVER",
312
+ )
313
+
314
+ # 4. Registers the tool with the agents, the description will be used by the LLM
315
+ register_function(
316
+ get_weekday,
317
+ caller=date_agent,
318
+ executor=executor_agent,
319
+ description="Get the day of the week for a given date",
320
+ )
321
+
322
+ # 5. Two-way chat ensures the executor agent follows the suggesting agent
323
+ chat_result = executor_agent.initiate_chat(
324
+ recipient=date_agent,
325
+ message="I was born on the 25th of March 1995, what day was it?",
326
+ max_turns=1,
327
+ )
328
+ ```
329
+
330
+ ### Advanced agentic design patterns
331
+
332
+ AG2 supports more advanced concepts to help you build your AI agent workflows. You can find more information in the documentation.
333
+
334
+ - [Structured Output](https://docs.ag2.ai/docs/user-guide/basic-concepts/structured-outputs)
335
+ - [Ending a conversation](https://docs.ag2.ai/docs/user-guide/basic-concepts/ending-a-chat)
336
+ - [Retrieval Augmented Generation (RAG)](https://docs.ag2.ai/docs/user-guide/advanced-concepts/rag)
337
+ - [Code Execution](https://docs.ag2.ai/docs/user-guide/advanced-concepts/code-execution)
338
+ - [Tools with Secrets](https://docs.ag2.ai/docs/user-guide/advanced-concepts/tools-with-secrets)
339
+
340
+ ## Announcements
341
+
342
+ 🔥 🎉 **Nov 11, 2024:** We are evolving AutoGen into **AG2**!
343
+ A new organization [AG2AI](https://github.com/ag2ai) is created to host the development of AG2 and related projects with open governance. Check [AG2's new look](https://ag2.ai/).
344
+
345
+ 📄 **License:**
346
+ We adopt the Apache 2.0 license from v0.3. This enhances our commitment to open-source collaboration while providing additional protections for contributors and users alike.
347
+
348
+ 🎉 May 29, 2024: DeepLearning.ai launched a new short course [AI Agentic Design Patterns with AutoGen](https://www.deeplearning.ai/short-courses/ai-agentic-design-patterns-with-autogen), made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators [Chi Wang](https://github.com/sonichi) and [Qingyun Wu](https://github.com/qingyun-wu).
349
+
350
+ 🎉 May 24, 2024: Foundation Capital published an article on [Forbes: The Promise of Multi-Agent AI](https://www.forbes.com/sites/joannechen/2024/05/24/the-promise-of-multi-agent-ai/?sh=2c1e4f454d97) and a video [AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang](https://www.youtube.com/watch?v=RLwyXRVvlNk).
351
+
352
+ 🎉 Apr 17, 2024: Andrew Ng cited AutoGen in [The Batch newsletter](https://www.deeplearning.ai/the-batch/issue-245/) and [What's next for AI agentic workflows](https://youtu.be/sal78ACtGTc?si=JduUzN_1kDnMq0vF) at Sequoia Capital's AI Ascent (Mar 26).
353
+
354
+ [More Announcements](announcements.md)
355
+
356
+ ## Contributors Wall
357
+
358
+ <a href="https://github.com/ag2ai/ag2/graphs/contributors">
359
+ <img src="https://contrib.rocks/image?repo=ag2ai/ag2&max=204" />
360
+ </a>
361
+
362
+ ## Code style and linting
363
+
364
+ This project uses pre-commit hooks to maintain code quality. Before contributing:
365
+
366
+ 1. Install pre-commit:
367
+
368
+ ```bash
369
+ pip install pre-commit
370
+ pre-commit install
371
+ ```
372
+
373
+ 2. The hooks will run automatically on commit, or you can run them manually:
374
+
375
+ ```bash
376
+ pre-commit run --all-files
377
+ ```
378
+
379
+ ## Related papers
380
+
381
+ - [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation](https://arxiv.org/abs/2308.08155)
382
+
383
+ - [EcoOptiGen: Hyperparameter Optimization for Large Language Model Generation Inference](https://arxiv.org/abs/2303.04673)
384
+
385
+ - [MathChat: Converse to Tackle Challenging Math Problems with LLM Agents](https://arxiv.org/abs/2306.01337)
386
+
387
+ - [AgentOptimizer: Offline Training of Language Model Agents with Functions as Learnable Weights](https://arxiv.org/pdf/2402.11359)
388
+
389
+ - [StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows](https://arxiv.org/abs/2403.11322)
390
+
391
+ ## Cite the project
392
+
393
+ ```
394
+ @software{AG2_2024,
395
+ author = {Chi Wang and Qingyun Wu and the AG2 Community},
396
+ title = {AG2: Open-Source AgentOS for AI Agents},
397
+ year = {2024},
398
+ url = {https://github.com/ag2ai/ag2},
399
+ note = {Available at https://docs.ag2.ai/},
400
+ version = {latest}
401
+ }
402
+ ```
403
+
404
+ ## License
405
+
406
+ This project is licensed under the [Apache License, Version 2.0 (Apache-2.0)](./LICENSE).
407
+
408
+ This project is a spin-off of [AutoGen](https://github.com/microsoft/autogen) and contains code under two licenses:
409
+
410
+ - The original code from https://github.com/microsoft/autogen is licensed under the MIT License. See the [LICENSE_original_MIT](./license_original/LICENSE_original_MIT) file for details.
411
+
412
+ - Modifications and additions made in this fork are licensed under the Apache License, Version 2.0. See the [LICENSE](./LICENSE) file for the full license text.
413
+
414
+ We have documented these changes for clarity and to ensure transparency with our user and contributor community. For more details, please see the [NOTICE](./NOTICE.md) file.
415
+
416
+