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